/** * Renders the display of Template Objects. * * @return void */ function renderTO() { if (intval($this->displayUid)>0) { $row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$this->displayUid); if (is_array($row)) { $tRows=array(); $tRows[]=' <tr class="bgColor5"> <td colspan="2"><strong>' . $GLOBALS['LANG']->getLL('renderTO_toDetails') . ':</strong>'. $this->cshItem('xMOD_tx_templavoila','mapping_to',$this->doc->backPath,''). '</td> </tr>'; // Get title and icon: $icon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_tmplobj', $row); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_tmplobj', $row); $title = t3lib_BEFunc::getRecordTitlePrep($GLOBALS['LANG']->sL($title)); $tRows[]=' <tr class="bgColor4"> <td>'.$GLOBALS['LANG']->getLL('templateObject').':</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_tmplobj', $row['uid'], 1) . $title . '</td> </tr>'; // Session data $sessionKey = $this->MCONF['name'] . '_validatorInfo:' . $row['uid']; $sesDat = array('displayFile' => $row['fileref']); $GLOBALS['BE_USER']->setAndSaveSessionData($sessionKey, $sesDat); // Find the file: $theFile = t3lib_div::getFileAbsFileName($row['fileref'],1); if ($theFile && @is_file($theFile)) { $relFilePath = substr($theFile,strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\''.t3lib_div::getIndpEnv('TYPO3_SITE_URL').$relFilePath.'\',\'FileView\');'; $tRows[]=' <tr class="bgColor4"> <td rowspan="2">'.$GLOBALS['LANG']->getLL('templateFile').':</td> <td><a href="#" onclick="'.htmlspecialchars($onCl).'">'.htmlspecialchars($relFilePath).'</a></td> </tr> <tr class="bgColor4"> <td> <a href="#" onclick ="openValidator(\'' . $sessionKey . '\');return false;"> ' . t3lib_iconWorks::getSpriteIcon('extensions-templavoila-htmlvalidate') . ' ' . $GLOBALS['LANG']->getLL('validateTpl') . ' </a> </td> </tr>'; // Finding Data Structure Record: $DSOfile=''; $dsValue = $row['datastructure']; if ($row['parent']) { $parentRec = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$row['parent'],'datastructure'); $dsValue=$parentRec['datastructure']; } if (tx_templavoila_div::canBeInterpretedAsInteger($dsValue)) { $DS_row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_datastructure',$dsValue); } else { $DSOfile = t3lib_div::getFileAbsFileName($dsValue); } if (is_array($DS_row) || @is_file($DSOfile)) { // Get main DS array: if (is_array($DS_row)) { // Get title and icon: $icon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_datastructure',$DS_row); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_datastructure', $DS_row); $title = t3lib_BEFunc::getRecordTitlePrep($GLOBALS['LANG']->sL($title)); $tRows[]=' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('renderTO_dsRecord') . ':</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_datastructure', $DS_row['uid'] , 1) . $title . '</td> </tr>'; // Link to updating DS/TO: $onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid'] . '&uid=' . $DS_row['uid'] . '&returnUrl=' . $this->returnUrl; $onClMsg = ' if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('renderTO_updateWarningConfirm')) . ')) { document.location=\''.$onCl.'\'; } return false; '; $tRows[]=' <tr class="bgColor4"> <td> </td> <td><input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('renderTO_editDSTO') . '" onclick="'.htmlspecialchars($onClMsg).'"/>'. $this->cshItem('xMOD_tx_templavoila','mapping_to_modifyDSTO',$this->doc->backPath,''). '</td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO($DS_row['dataprot']); } else { // Show filepath of external XML file: $relFilePath = substr($DSOfile,strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\''.t3lib_div::getIndpEnv('TYPO3_SITE_URL').$relFilePath.'\',\'FileView\');'; $tRows[]=' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('renderTO_dsFile') . ':</td> <td><a href="#" onclick="'.htmlspecialchars($onCl).'">'.htmlspecialchars($relFilePath).'</a></td> </tr>'; $onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid'] . '&uid=' . rawurlencode($DSOfile) . '&returnUrl=' . $this->returnUrl; $onClMsg = ' if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('renderTO_updateWarningConfirm')) . ')) { document.location=\''.$onCl.'\'; } return false; '; $tRows[]=' <tr class="bgColor4"> <td> </td> <td><input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('renderTO_editDSTO') . '" onclick="'.htmlspecialchars($onClMsg).'"/>'. $this->cshItem('xMOD_tx_templavoila','mapping_to_modifyDSTO',$this->doc->backPath,''). '</td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO('',$DSOfile); } // Write header of page: $content.= ' <!-- Template Object Header: --> <h3>' . $GLOBALS['LANG']->getLL('renderTO_toInfo') . ':</h3> <table border="0" cellpadding="2" cellspacing="1" id="c-toHeader"> '.implode('',$tRows).' </table> '; // If there is a valid data structure, draw table: if (is_array($dataStruct)) { // Working on Header and Body of HTML source: // -- Processing the header editing -- list($editContent,$currentHeaderMappingInfo) = $this->renderTO_editProcessing($dataStruct,$row,$theFile, 1); // Determine if DS is a template record and if it is a page template: $showBodyTag = !is_array($DS_row) || $DS_row['scope']==1 ? TRUE : FALSE; $parts = array(); $parts[] = array( 'label' => $GLOBALS['LANG']->getLL('tabTODetails'), 'content' => $content ); // -- Processing the head editing $headerContent.=' <!-- HTML header parts selection: --> <h3>'.$GLOBALS['LANG']->getLL('mappingHeadParts').': '.$this->cshItem('xMOD_tx_templavoila','mapping_to_headerParts',$this->doc->backPath,'').'</h3> '.$this->renderHeaderSelection($theFile,$currentHeaderMappingInfo,$showBodyTag,$editContent); $parts[] = array( 'label' => $GLOBALS['LANG']->getLL('tabHeadParts'), 'content' => $headerContent ); // -- Processing the body editing -- list($editContent,$currentMappingInfo) = $this->renderTO_editProcessing($dataStruct,$row,$theFile, 0); $bodyContent.=' <!-- Data Structure mapping table: --> <h3>'.$GLOBALS['LANG']->getLL('mappingBodyParts').':</h3> '.$this->renderTemplateMapper($theFile,$this->displayPath,$dataStruct,$currentMappingInfo,$editContent); $parts[] = array( 'label' => $GLOBALS['LANG']->getLL('tabBodyParts'), 'content' => $bodyContent ); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoDSfound'), $dsValue); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoDSfound'), $dsValue); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorFileNotFound'), $row['fileref']); } else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoTOfound'), $this->displayUid); $parts[0]['content'] = $content; } else { $this->content.=$this->doc->section($GLOBALS['LANG']->getLL('templateObject').' '.$GLOBALS['LANG']->getLL('error'), $GLOBALS['LANG']->getLL('errorNoUidFound'),0,1,3); } // show tab menu if (is_array($parts)) { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('mappingTitle'), ''. $this->doc->getDynTabMenu($parts,'TEMPLAVOILA:templateModule:'.$this->id, 0,0,300) ,0,1); } }