"TYPO3 4.0.1: typo3_src-4.0.1/typo3/alt_palette.php Source File", "datetime" => "Sat Dec 2 19:22:20 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00061 require('init.php'); 00062 require('template.php'); 00063 require_once(PATH_t3lib.'class.t3lib_tceforms.php'); 00064 require_once(PATH_t3lib.'class.t3lib_transferdata.php'); 00065 require_once(PATH_t3lib.'class.t3lib_loaddbgroup.php'); 00066 $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml'); 00067 00068 00069 00070 00071 00072 00081 class formRender extends t3lib_TCEforms { 00082 00091 function printPalette($palArr) { 00092 $out=''; 00093 00094 // For each element on the palette, write a few table cells with the field name, content and control images: 00095 foreach($palArr as $content) { 00096 $iRow[]=' 00097 <td>'. 00098 '<img name="req_'.$content['TABLE'].'_'.$content['ID'].'_'.$content['FIELD'].'" class="c-reqIcon" src="clear.gif" width="10" height="10" alt="" />'. 00099 '<img name="cm_'.$content['TABLE'].'_'.$content['ID'].'_'.$content['FIELD'].'" class="c-cmIcon" src="clear.gif" width="7" height="10" alt="" />'. 00100 '</td> 00101 <td class="c-label">'. 00102 $content['NAME'].' '. 00103 '</td> 00104 <td class="c-csh">'. 00105 $content['ITEM'].$content['HELP_ICON']. 00106 '</td>'; 00107 } 00108 00109 // Finally, wrap it all in a table: 00110 $out=' 00111 00112 00113 00114 <!-- 00115 TCEforms palette, rendered in top frame. 00116 --> 00117 <table border="0" cellpadding="0" cellspacing="0" id="typo3-TCEforms-palette"> 00118 <tr> 00119 <td class="c-close">'. 00120 '<a href="#" onclick="closePal();return false;"><img'.t3lib_iconWorks::skinImg('','gfx/close_12h.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close',1).'" alt="" /></a>'. 00121 '</td>'. 00122 implode('',$iRow).' 00123 </tr> 00124 </table> 00125 00126 '; 00127 00128 // Return the result: 00129 return $out; 00130 } 00131 } 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00154 class formRender_vert extends t3lib_TCEforms { 00155 00163 function printPalette($palArr) { 00164 $out=''; 00165 $bgColor=' bgcolor="'.$this->colorScheme[2].'"'; 00166 00167 // For each element on the palette, write a few table cells with the field name, content and control images: 00168 foreach($palArr as $content) { 00169 $iRow[]=' 00170 <tr> 00171 <td><img src="clear.gif" width="'.intval($this->paletteMargin).'" height="1" alt="" /></td> 00172 <td'.$bgColor.'> </td> 00173 <td nowrap="nowrap"'.$bgColor.'><font color="'.$this->colorScheme[4].'">'.$content['NAME'].'</font></td> 00174 </tr>'; 00175 $iRow[]=' 00176 <tr> 00177 <td></td> 00178 <td valign="top"><img name="req_'.$content['TABLE'].'_'.$content['ID'].'_'.$content['FIELD'].'" src="clear.gif" width="10" height="10" vspace="4" alt="" /><img name="cm_'.$content['TABLE'].'_'.$content['ID'].'_'.$content['FIELD'].'" src="clear.gif" width="7" height="10" vspace="4" alt="" /></td> 00179 <td nowrap="nowrap" valign="top">'.$content['ITEM'].$content['HELP_ICON'].'</td> 00180 </tr>'; 00181 } 00182 00183 // Adding the close button: 00184 $iRow[]=' 00185 <tr> 00186 <td></td> 00187 <td></td> 00188 <td nowrap="nowrap" valign="top"> 00189 <br /> 00190 <input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close',1).'" onclick="closePal(); return false;" /> 00191 </td> 00192 </tr>'; 00193 00194 // Finally, wrap it all in a table: 00195 $out=' 00196 <table border="0" cellpadding="0" cellspacing="0" id="typo3-TCEforms-palette-vert"> 00197 '.implode('',$iRow).' 00198 </table>'; 00199 00200 // Return content: 00201 return $out; 00202 } 00203 } 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00223 class SC_alt_palette { 00224 00225 // Internal: 00226 var $content; // Content accumulation 00227 var $backRef; // String, which is the reference back to the window which opened this one. 00228 var $formRef; // String, which is the reference to the form. 00229 var $doc; // Template object. 00230 00231 // Internal, static: GPvar: 00232 var $formName; // Form name 00233 var $GPbackref; // The value of the original backRef GPvar (not necessarily the same as $this->backRef) 00234 var $inData; // Contains tablename, uid and palette number 00235 var $prependFormFieldNames; // Prefix for form fields. 00236 var $rec; // The "record" with the data to display in the form fields. 00237 00238 00239 00240 00241 00247 function init() { 00248 00249 // Setting GPvars, etc. 00250 $this->formName = t3lib_div::_GP('formName'); 00251 $this->GPbackref = t3lib_div::_GP('backRef'); 00252 $this->inData = t3lib_div::_GP('inData'); 00253 $this->prependFormFieldNames = t3lib_div::_GP('prependFormFieldNames'); 00254 $this->rec = t3lib_div::_GP('rec'); 00255 00256 // Making references: 00257 $this->backRef = $this->GPbackref ? $this->GPbackref : 'window.opener'; 00258 # $this->backRef = 'top.content.list_frame.view_frame'; 00259 00260 $this->formRef = $this->backRef.'.document.'.$this->formName; 00261 00262 // Start template object: 00263 $this->doc = t3lib_div::makeInstance('template'); 00264 $this->doc->bodyTagMargins['x']=0; 00265 $this->doc->bodyTagMargins['y']=0; 00266 $this->doc->form='<form action="#" method="post" name="'.htmlspecialchars($this->formName).'" onsubmit="return false;">'; 00267 $this->doc->docType = 'xhtml_trans'; 00268 $this->doc->backPath = ''; 00269 00270 // 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!) 00271 if (!$this->GPbackref) $this->doc->bodyTagId.= '-vert'; 00272 00273 // Setting JavaScript functions for the header: 00274 $this->doc->JScode = $this->doc->wrapScriptTags(' 00275 var serialNumber = ""; 00276 function timeout_func() { // 00277 if ('.$this->backRef.' && '.$this->backRef.'.document && '.$this->formRef.') { 00278 if ('.$this->formRef.'["_serialNumber"]) { 00279 if (serialNumber) { 00280 if ('.$this->formRef.'["_serialNumber"].value != serialNumber) {closePal(); return false;} 00281 } else { 00282 serialNumber = '.$this->formRef.'["_serialNumber"].value; 00283 } 00284 } 00285 window.setTimeout("timeout_func();",1*1000); 00286 } else closePal(); 00287 } 00288 function closePal() { // 00289 '.($this->GPbackref?'window.location.href="alt_topmenu_dummy.php";':'close();').' 00290 } 00291 timeout_func(); 00292 onBlur="alert();"; 00293 '); 00294 } 00295 00301 function main() { 00302 00303 $this->content=''; 00304 $this->content.=$this->doc->startPage('TYPO3 Edit Palette'); 00305 00306 $inData = explode(':',$this->inData); 00307 00308 // Begin edit: 00309 if (is_array($inData) && count($inData)==3) { 00310 00311 // Create the TCEforms object: 00312 $tceforms = $this->GPbackref ? new formRender() : new formRender_vert(); 00313 $tceforms->initDefaultBEMode(); 00314 $tceforms->palFieldTemplate='###FIELD_PALETTE###'; 00315 $tceforms->palettesCollapsed=0; 00316 $tceforms->isPalettedoc=$this->backRef; 00317 00318 $tceforms->formName = $this->formName; 00319 $tceforms->prependFormFieldNames = $this->prependFormFieldNames; 00320 00321 // Initialize other data: 00322 $table=$inData[0]; 00323 $theUid=$inData[1]; 00324 $thePalNum = $inData[2]; 00325 $this->rec['uid']=$theUid; 00326 00327 // Getting the palette fields rendered: 00328 $panel.=$tceforms->getPaletteFields($table,$this->rec,$thePalNum,'',implode(',',array_keys($this->rec))); 00329 $formContent=$panel; 00330 00331 // Add all the content, including JavaScript as needed. 00332 $this->content.=$tceforms->printNeededJSFunctions_top().$formContent.$tceforms->printNeededJSFunctions(); 00333 } 00334 } 00335 00341 function printContent() { 00342 $this->content.= $this->doc->endPage(); 00343 $this->content = $this->doc->insertStylesAndJS($this->content); 00344 echo $this->content; 00345 } 00346 } 00347 00348 // Include extension? 00349 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_palette.php']) { 00350 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_palette.php']); 00351 } 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 // Make instance: 00365 $SOBE = t3lib_div::makeInstance('SC_alt_palette'); 00366 $SOBE->init(); 00367 $SOBE->main(); 00368 $SOBE->printContent(); 00369 ?>