*/ /** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 81: class formRender extends t3lib_TCEforms * 91: function printPalette($palArr) * * * 154: class formRender_vert extends t3lib_TCEforms * 163: function printPalette($palArr) * * * 223: class SC_alt_palette * 247: function init() * 301: function main() * 341: function printContent() * * TOTAL FUNCTIONS: 5 * (This index is automatically created/updated by the extension "extdeveval") * */ require('init.php'); require('template.php'); require_once(PATH_t3lib.'class.t3lib_tceforms.php'); require_once(PATH_t3lib.'class.t3lib_transferdata.php'); require_once(PATH_t3lib.'class.t3lib_loaddbgroup.php'); $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml'); /** * Class for rendering the form fields. * Extending the TCEforms class * * @author Kasper Skaarhoj * @package TYPO3 * @subpackage core */ class formRender extends t3lib_TCEforms { /** * Creates the HTML content for the palette * (Horizontally, for display in the top frame) * (Used if GET var "backRef" IS set) * * @param array Array of information from which the fields are built. * @return string HTML output */ function printPalette($palArr) { $out=''; // For each element on the palette, write a few table cells with the field name, content and control images: foreach($palArr as $content) { $iRow[]=' '. ''. ''. ' '. $content['NAME'].' '. ' '. $content['ITEM'].$content['HELP_ICON']. ''; } // Finally, wrap it all in a table: $out=' '. implode('',$iRow).'
'. ''. '
'; // Return the result: return $out; } } /** * Child class for alternative rendering of form fields (when the secondary fields are shown in a little window rather than the top bar). * (Used if GET var "backRef" is not set, presuming a window is opened instead.) * * @author Kasper Skaarhoj * @package TYPO3 * @subpackage core */ class formRender_vert extends t3lib_TCEforms { /** * Creates the HTML content for the palette. * (Vertically, for display in a browser window, not top frame) * * @param array Array of information from which the fields are built. * @return string HTML output */ function printPalette($palArr) { $out=''; $bgColor=' bgcolor="'.$this->colorScheme[2].'"'; // For each element on the palette, write a few table cells with the field name, content and control images: foreach($palArr as $content) { $iRow[]='   '.$content['NAME'].' '; $iRow[]=' '.$content['ITEM'].$content['HELP_ICON'].' '; } // Adding the close button: $iRow[]='
'; // Finally, wrap it all in a table: $out=' '.implode('',$iRow).'
'; // Return content: return $out; } } /** * Script Class for rendering the palette form for TCEforms in some other frame (in top frame, horizontally) * It can also be called in a pop-up window in which case a vertically oriented set of form fields are rendered instead. * * @author Kasper Skaarhoj * @package TYPO3 * @subpackage core */ class SC_alt_palette { // Internal: var $content; // Content accumulation var $backRef; // String, which is the reference back to the window which opened this one. var $formRef; // String, which is the reference to the form. var $doc; // Template object. // Internal, static: GPvar: var $formName; // Form name var $GPbackref; // The value of the original backRef GPvar (not necessarily the same as $this->backRef) var $inData; // Contains tablename, uid and palette number var $prependFormFieldNames; // Prefix for form fields. var $rec; // The "record" with the data to display in the form fields. /** * Constructor for the class * * @return void */ function init() { // Setting GPvars, etc. $this->formName = t3lib_div::_GP('formName'); $this->GPbackref = t3lib_div::_GP('backRef'); $this->inData = t3lib_div::_GP('inData'); $this->prependFormFieldNames = t3lib_div::_GP('prependFormFieldNames'); $this->rec = t3lib_div::_GP('rec'); // Making references: $this->backRef = $this->GPbackref ? $this->GPbackref : 'window.opener'; # $this->backRef = 'top.content.list_frame.view_frame'; $this->formRef = $this->backRef.'.document.'.$this->formName; // Start template object: $this->doc = t3lib_div::makeInstance('template'); $this->doc->bodyTagMargins['x']=0; $this->doc->bodyTagMargins['y']=0; $this->doc->form='
'; $this->doc->docType = 'xhtml_trans'; $this->doc->backPath = ''; // In case the palette is opened in a SEPARATE window (as the case is with frontend editing) then another body-tag id should be used (so we don't get the background image for the palette shown!) if (!$this->GPbackref) $this->doc->bodyTagId.= '-vert'; // Setting JavaScript functions for the header: $this->doc->JScode = $this->doc->wrapScriptTags(' var serialNumber = ""; function timeout_func() { // if ('.$this->backRef.' && '.$this->backRef.'.document && '.$this->formRef.') { if ('.$this->formRef.'["_serialNumber"]) { if (serialNumber) { if ('.$this->formRef.'["_serialNumber"].value != serialNumber) {closePal(); return false;} } else { serialNumber = '.$this->formRef.'["_serialNumber"].value; } } window.setTimeout("timeout_func();",1*1000); } else closePal(); } function closePal() { // '.($this->GPbackref?'document.location="alt_topmenu_dummy.php";':'close();').' } timeout_func(); onBlur="alert();"; '); } /** * Main function, rendering the palette form * * @return void */ function main() { $this->content=''; $this->content.=$this->doc->startPage('TYPO3 Edit Palette'); $inData = explode(':',$this->inData); // Begin edit: if (is_array($inData) && count($inData)==3) { // Create the TCEforms object: $tceforms = $this->GPbackref ? new formRender() : new formRender_vert(); $tceforms->initDefaultBEMode(); $tceforms->palFieldTemplate='###FIELD_PALETTE###'; $tceforms->palettesCollapsed=0; $tceforms->isPalettedoc=$this->backRef; $tceforms->formName = $this->formName; $tceforms->prependFormFieldNames = $this->prependFormFieldNames; // Initialize other data: $table=$inData[0]; $theUid=$inData[1]; $thePalNum = $inData[2]; $this->rec['uid']=$theUid; // Getting the palette fields rendered: $panel.=$tceforms->getPaletteFields($table,$this->rec,$thePalNum,'',implode(',',array_keys($this->rec))); $formContent=$panel; // Add all the content, including JavaScript as needed. $this->content.=$tceforms->printNeededJSFunctions_top().$formContent.$tceforms->printNeededJSFunctions(); } } /** * Outputting the accumulated content to screen * * @return void */ function printContent() { echo $this->content.$this->doc->endPage(); } } // Include extension? if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_palette.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_palette.php']); } // Make instance: $SOBE = t3lib_div::makeInstance('SC_alt_palette'); $SOBE->init(); $SOBE->main(); $SOBE->printContent(); ?>