Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2001-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 ***************************************************************/ 00031 require_once(t3lib_extMgm::extPath("kickstarter")."class.tx_kickstarter_sectionbase.php"); 00032 00033 class tx_kickstarter_section_pi extends tx_kickstarter_sectionbase { 00034 var $sectionID = 'pi'; 00035 00039 function render_wizard() { 00040 $lines=array(); 00041 00042 $action = explode(":",$this->wizard->modData["wizAction"]); 00043 if ($action[0]=="edit") { 00044 $this->regNewEntry($this->sectionID,$action[1]); 00045 $lines = $this->catHeaderLines($lines,$this->sectionID,$this->wizard->options[$this->sectionID],"<strong>Edit Plugin #".$action[1]."</strong>",$action[1]); 00046 $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; 00047 $ffPrefix='['.$this->sectionID.']['.$action[1].']'; 00048 00049 00050 // Enter title of the plugin 00051 $subContent="<strong>Enter a title for the plugin:</strong><BR>". 00052 $this->renderStringBox_lang("title",$ffPrefix,$piConf); 00053 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00054 00055 $subContent = $this->renderCheckBox($ffPrefix."[plus_user_obj]",$piConf["plus_user_obj"])."USER cObjects are cached. Make it a non-cached USER_INT instead<BR>"; 00056 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00057 00058 $subContent = $this->renderCheckBox($ffPrefix."[plus_not_staticTemplate]",$piConf["plus_not_staticTemplate"])."Enable this option if you want the TypoScript code to be set by default. Otherwise the code will go into a static template file which must be included in the template record (recommended is to <em>not</em> set this option).<BR>"; 00059 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00060 00061 00062 // Position 00063 if (is_array($this->wizard->wizArray["fields"])) { 00064 $optValues = array( 00065 "0" => "", 00066 ); 00067 foreach($this->wizard->wizArray["fields"] as $kk => $fC) { 00068 if ($fC["which_table"]=="tt_content") { 00069 $optValues[$kk]=($fC["title"]?$fC["title"]:"Item ".$kk)." (".count($fC["fields"])." fields)"; 00070 } 00071 } 00072 if (count($optValues)>1) { 00073 $subContent="<strong>Apply a set of extended fields</strong><BR> 00074 If you have configured a set of extra fields (Extend existing Tables) for the tt_content table, you can have them assigned to this plugin. 00075 <BR>". 00076 $this->renderSelectBox($ffPrefix."[apply_extended]",$piConf["apply_extended"],$optValues); 00077 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00078 } 00079 } 00080 00081 /* // Enter title of the plugin 00082 $subContent="<strong>Enter a 'key'-string for the plugin:</strong><BR>". 00083 $this->renderStringBox($ffPrefix."[keystring]",$piConf["keystring"]). 00084 "<BR>(<em>A key string is used as a sub-prefix to the class name, in the database as identification of the plugin etc. If you don't specify any, the wizard will make one based on the title above.<BR> 00085 Example: If your extension has the extension key 'my_extension' and you enter the key value 'crazymenu', then the class, additional fields etc. will be named 'tx_myextension_crazymenu'<BR> 00086 Use a-z characters only.</em>)" 00087 ; 00088 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00089 */ 00090 00091 00092 00093 00094 // Insert Plugin 00095 if (is_array($this->wizard->wizArray["tables"])) { 00096 $optValues = array( 00097 "0" => "", 00098 ); 00099 foreach($this->wizard->wizArray["tables"] as $kk => $fC) { 00100 $optValues[$kk]=($fC["tablename"]||$fC["title"]?$fC["title"]." (".$this->returnName($this->wizard->extKey,"tables").($fC["tablename"]?"_".$fC["tablename"]:"").")":"Item ".$kk)." (".count($fC["fields"])." fields)"; 00101 } 00102 $incListing="<BR><BR>If you have configured custom tables you can select one of the tables to list by default as an example: 00103 <BR>". 00104 $this->renderSelectBox($ffPrefix."[list_default]",$piConf["list_default"],$optValues); 00105 $incListing.="<BR>".$this->renderCheckBox($ffPrefix."[list_default_listmode]",$piConf["list_default_listmode"]). 00106 "Listing: Sections instead of table-rows"; 00107 $incListing.="<BR>".$this->renderCheckBox($ffPrefix."[list_default_singlemode]",$piConf["list_default_singlemode"]). 00108 "Singleview: Sections instead of table-rows"; 00109 } else $incListing=""; 00110 00111 00112 if (!$piConf["addType"]) $piConf["addType"]="list_type"; 00113 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"list_type"). 00114 $this->textSetup( 00115 "Add to 'Insert Plugin' list in Content Elements", 00116 "Most frontend plugins should be added to the Plugin list of Content Element type 'Insert Plugin'. This is what happens with most other plugins you know of.". 00117 $this->resImg("pi_pi.png"). 00118 "<BR>".$this->renderCheckBox($ffPrefix."[plus_wiz]",$piConf["plus_wiz"]). 00119 "Add icon to 'New Content Element' wizard:". 00120 $this->resImg("pi_cewiz.png"). 00121 "Write a description for the entry (if any):<BR>". 00122 $this->renderStringBox_lang("plus_wiz_description",$ffPrefix,$piConf).$incListing 00123 ); 00124 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00125 00126 // Text box 00127 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"textbox"). 00128 $this->textSetup("Add as a 'Textbox' type", 00129 "The Textbox Content Element is not very common but has a confortable set of fields: Bodytext and image upload.". 00130 $this->resImg("pi_textbox.png")); 00131 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00132 00133 // Menu/Sitemap 00134 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"menu_sitemap"). 00135 $this->textSetup("Add as a 'Menu/Sitemap' item", 00136 "Adds the plugin to the Menu/Sitemap list. Use this if your plugin is a list of links to pages or elements on the website. An alternative sitemap? Or some special kind of menu in a special design?". 00137 $this->resImg("pi_menu_sitemap.png")); 00138 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00139 00140 // New content element 00141 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"ce"). 00142 $this->textSetup("Add as a totally new Content Element type", 00143 "You can also take the plunge into a whole new content element type! Scarry eh?". 00144 $this->resImg("pi_ce.png"). 00145 /* $this->renderCheckBox($ffPrefix."[plus_rte]",$piConf["plus_rte"])."Enable Rich Text editing for the bodytext field<BR>". 00146 $this->renderCheckBox($ffPrefix."[plus_images]",$piConf["plus_images"])."Enable images-field<BR>". 00147 $this->renderCheckBox($ffPrefix."[plus_no_header]",$piConf["plus_images"])."Disable header rendering<BR>". 00148 $this->renderCheckBox($ffPrefix."[plus_insert_check]",$piConf["plus_insert_check"])."Insert a custom checkbox field<BR>". 00149 $this->renderCheckBox($ffPrefix."[plus_insert_select]",$piConf["plus_insert_select"])."Insert a custom select field<BR>". 00150 $this->renderCheckBox($ffPrefix."[plus_insert_string]",$piConf["plus_insert_string"])."Insert a custom text string field<BR>". 00151 $this->renderCheckBox($ffPrefix."[plus_insert_file]",$piConf["plus_insert_file"])."Insert a custom file field<BR>". 00152 */ '' 00153 ); 00154 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00155 00156 // New header type 00157 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"header"). 00158 $this->textSetup("Add as a new header type", 00159 "Finally you might insert a new header type here:". 00160 $this->resImg("pi_header.png")); 00161 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00162 00163 // Processing of tags in content. 00164 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"typotags"). 00165 $this->textSetup("Processing of userdefined tag", 00166 htmlspecialchars("If you wish the plugin to process content from a userdefined tag in Content Element text-fields, enter the tagname here. Eg. if you wish the tags <mytag>This is the content</mytag> to be your userdefined tags, just enter 'mytag' in this field (lowercase a-z, 0-9 and underscore):")."<BR>". 00167 $this->renderStringBox($ffPrefix."[tag_name]",$piConf["tag_name"]) 00168 ); 00169 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00170 00171 // Just include library 00172 $subContent=$this->renderRadioBox($ffPrefix."[addType]",$piConf["addType"],"includeLib"). 00173 $this->textSetup("Just include library", 00174 "In this case your library is just included when pages are rendered.<BR><BR>". 00175 $this->renderCheckBox($ffPrefix."[plus_user_ex]",$piConf["plus_user_ex"])."Provide TypoScript example for USER cObject in 'page.1000'<BR>" 00176 ); 00177 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>'; 00178 } 00179 00180 /* HOOK: Place a hook here, so additional output can be integrated */ 00181 if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_pi'])) { 00182 foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_pi'] as $_funcRef) { 00183 $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this->wizard); 00184 } 00185 } 00186 00187 $content = '<table border=0 cellpadding=2 cellspacing=2>'.implode("",$lines).'</table>'; 00188 return $content; 00189 } 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 function render_extPart($k,$config,$extKey) { 00202 $WOP="[pi][".$k."]"; 00203 $cN = $this->returnName($extKey,"class","pi".$k); 00204 $pathSuffix = "pi".$k."/"; 00205 00206 #debug($config); 00207 $setType=""; 00208 switch($config["addType"]) { 00209 case "list_type": 00210 $setType="list_type"; 00211 00212 $this->wizard->ext_tables[]=$this->sPS(' 00213 '.$this->WOPcomment('WOP:'.$WOP.'[addType]')." 00214 t3lib_div::loadTCA('tt_content'); 00215 \$TCA['tt_content']['types']['list']['subtypes_excludelist'][\$_EXTKEY.'_pi".$k."']='layout,select_key'; 00216 ".($config['apply_extended']?"\$TCA['tt_content']['types']['list']['subtypes_addlist'][\$_EXTKEY.'_pi".$k."']='".$this->wizard->_apply_extended_types[$config['apply_extended']]."';":"")." 00217 "); 00218 00219 $this->wizard->ext_localconf[]=$this->sPS(' 00220 '.$this->WOPcomment('WOP:'.$WOP.'[addType] / '.$WOP.'[tag_name]')." 00221 ## Extending TypoScript from static template uid=43 to set up userdefined tag: 00222 t3lib_extMgm::addTypoScript(\$_EXTKEY,'editorcfg',' 00223 tt_content.CSS_editor.ch.".$cN." = < plugin.".$cN.".CSS_editor 00224 ',43); 00225 "); 00226 break; 00227 case "textbox": 00228 $setType="splash_layout"; 00229 00230 if ($config["apply_extended"]) { 00231 $this->wizard->ext_tables[]=$this->sPS(' 00232 '.$this->WOPcomment('WOP:'.$WOP.'[addType]')." 00233 t3lib_div::loadTCA('tt_content'); 00234 \$TCA['tt_content']['types']['splash']['subtype_value_field']='splash_layout'; 00235 \$TCA['tt_content']['types']['splash']['subtypes_addlist'][\$_EXTKEY.'_pi".$k."']='".$this->wizard->_apply_extended_types[$config['apply_extended']]."'; 00236 "); 00237 } 00238 break; 00239 case "menu_sitemap": 00240 $setType="menu_type"; 00241 00242 if ($config["apply_extended"]) { 00243 $this->wizard->ext_tables[]=$this->sPS(' 00244 '.$this->WOPcomment('WOP:'.$WOP.'[addType]')." 00245 t3lib_div::loadTCA('tt_content'); 00246 \$TCA['tt_content']['types']['menu']['subtype_value_field']='menu_type'; 00247 \$TCA['tt_content']['types']['menu']['subtypes_addlist'][\$_EXTKEY.'_pi".$k."']='".$this->wizard->_apply_extended_types[$config['apply_extended']]."'; 00248 "); 00249 } 00250 break; 00251 case "ce": 00252 $setType="CType"; 00253 00254 $tFields=array(); 00255 $tFields[] = "CType;;4;button;1-1-1, header;;3;;2-2-2"; 00256 if ($config["apply_extended"]) { 00257 $tFields[] = $this->wizard->_apply_extended_types[$config["apply_extended"]]; 00258 } 00259 $this->wizard->ext_tables[]=$this->sPS(' 00260 '.$this->WOPcomment('WOP:'.$WOP.'[addType]')." 00261 t3lib_div::loadTCA('tt_content'); 00262 \$TCA['tt_content']['types'][\$_EXTKEY.'_pi".$k."']['showitem']='".implode(', ',$tFields)."'; 00263 "); 00264 break; 00265 case "header": 00266 $setType="header_layout"; 00267 break; 00268 case "includeLib": 00269 if ($config["plus_user_ex"]) $setType="includeLib"; 00270 break; 00271 case "typotags": 00272 $tagName = ereg_replace("[^a-z0-9_]","",strtolower($config["tag_name"])); 00273 if ($tagName) { 00274 $this->wizard->ext_localconf[]=$this->sPS(' 00275 '.$this->WOPcomment('WOP:'.$WOP.'[addType] / '.$WOP.'[tag_name]')." 00276 ## Extending TypoScript from static template uid=43 to set up userdefined tag: 00277 t3lib_extMgm::addTypoScript(\$_EXTKEY,'setup',' 00278 tt_content.text.20.parseFunc.tags.".$tagName." = < plugin.'.t3lib_extMgm::getCN(\$_EXTKEY).'_pi".$k." 00279 ',43); 00280 "); 00281 } 00282 break; 00283 default: 00284 break; 00285 } 00286 00287 $cache= $config["plus_user_obj"] ? 0 : 1; 00288 00289 $this->wizard->ext_localconf[]=$this->sPS(' 00290 '.$this->WOPcomment('WOP:'.$WOP.'[addType]')." 00291 t3lib_extMgm::addPItoST43(\$_EXTKEY,'pi".$k."/class.".$cN.".php','_pi".$k."','".$setType."',".$cache."); 00292 "); 00293 00294 if ($setType && !t3lib_div::inList("typotags,includeLib",$setType)) { 00295 $this->wizard->ext_tables[]=$this->sPS(' 00296 '.$this->WOPcomment('WOP:'.$WOP.'[addType]')." 00297 t3lib_extMgm::addPlugin(Array('".addslashes($this->getSplitLabels_reference($config,'title','tt_content.'.$setType.'_pi'.$k))."', \$_EXTKEY.'_pi".$k."'),'".$setType."'); 00298 "); 00299 } 00300 00301 // Make Plugin class: 00302 switch($config["addType"]) { 00303 case "list_type": 00304 if ($config["list_default"]) { 00305 if (is_array($this->wizard->wizArray["tables"][$config["list_default"]])) { 00306 $tempTableConf = $this->wizard->wizArray["tables"][$config["list_default"]]; 00307 $tableName = $this->returnName($extKey,"tables",$tempTableConf["tablename"]); 00308 00309 $ll=array(); 00310 00311 $theLines = Array(); 00312 $theLines["getListRow"]=Array(); 00313 $theLines["getListHeader"]=Array(); 00314 $theLines["getFieldContent"]=Array(); 00315 $theLines["getFieldHeader"]=Array(); 00316 $theLines["singleRows"]=Array(); 00317 $theLines["listItemRows"]=Array(); 00318 $theLines["singleRows_section"]=Array(); 00319 $P_classes=array(); 00320 00321 $theLines["searchFieldList"]=Array(); 00322 $theLines["orderByList"]=Array(); 00323 00324 $tcol="uid"; 00325 $theLines["getListRow"][$tcol] = '<td><p>\'.$this->getFieldContent(\''.$tcol.'\').\'</p></td>'; 00326 $theLines["getListHeader"][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink(\''.$tcol.'\').\'</p></td>'; 00327 $theLines["orderByList"][$tcol]=$tcol; 00328 00329 if (is_array($tempTableConf["fields"])) { 00330 reset($tempTableConf["fields"]); 00331 while(list(,$fC)=each($tempTableConf["fields"])) { 00332 $tcol = $fC["fieldname"]; 00333 if ($tcol) { 00334 $theLines["singleRows"][$tcol] = trim($this->sPS(' 00335 <tr> 00336 <td nowrap valign="top"\'.$this->pi_classParam(\'singleView-HCell\').\'><p>\'.$this->getFieldHeader(\''.$tcol.'\').\'</p></td> 00337 <td valign="top"><p>\'.$this->getFieldContent(\''.$tcol.'\').\'</p></td> 00338 </tr> 00339 ')); 00340 00341 if ($this->fieldIsRTE($fC)) { 00342 $theLines["singleRows_section"][$tcol] = trim($this->sPS(' 00343 \'.$this->getFieldContent(\''.$tcol.'\').\' 00344 ')); 00345 } else { 00346 $tempN='singleViewField-'.str_replace("_","-",$tcol); 00347 $theLines["singleRows_section"][$tcol] = trim($this->sPS(' 00348 <p\'.$this->pi_classParam("'.$tempN.'").\'><strong>\'.$this->getFieldHeader(\''.$tcol.'\').\':</strong> \'.$this->getFieldContent(\''.$tcol.'\').\'</p> 00349 ')); 00350 $P_classes["SV"][]=$tempN; 00351 } 00352 00353 if (!strstr($fC["type"],"textarea")) { 00354 $theLines["getListRow"][$tcol] = '<td valign="top"><p>\'.$this->getFieldContent(\''.$tcol.'\').\'</p></td>'; 00355 $theLines["getListHeader"][$tcol] = '<td nowrap><p>\'.$this->getFieldHeader(\''.$tcol.'\').\'</p></td>'; 00356 00357 $tempN='listrowField-'.str_replace("_","-",$tcol); 00358 $theLines["listItemRows"][$tcol] = trim($this->sPS(' 00359 <p\'.$this->pi_classParam(\''.$tempN.'\').\'>\'.$this->getFieldContent(\''.$tcol.'\').\'</p> 00360 ')); 00361 $P_classes["LV"][]=$tempN; 00362 } 00363 00364 00365 $this->addLocalConf($ll,array("listFieldHeader_".$tcol=>$fC["title"]),"listFieldHeader_".$tcol,"pi",$k,1,1); 00366 00367 if ($tcol=="title") { 00368 $theLines["getFieldContent"][$tcol] = trim($this->sPS(' 00369 case "'.$tcol.'": 00370 // This will wrap the title in a link. 00371 return $this->pi_list_linkSingle($this->internal[\'currentRow\'][\''.$tcol.'\'],$this->internal[\'currentRow\'][\'uid\'],1); 00372 break; 00373 ')); 00374 $theLines["getFieldHeader"][$tcol] = trim($this->sPS(' 00375 case "'.$tcol.'": 00376 return $this->pi_getLL(\'listFieldHeader_'.$tcol.'\',\'<em>'.$tcol.'</em>\'); 00377 break; 00378 ')); 00379 } elseif ($this->fieldIsRTE($fC)) { 00380 $theLines["getFieldContent"][$tcol] = trim($this->sPS(' 00381 case "'.$tcol.'": 00382 return $this->pi_RTEcssText($this->internal[\'currentRow\'][\''.$tcol.'\']); 00383 break; 00384 ')); 00385 } elseif ($fC["type"]=="datetime") { 00386 $theLines["getFieldContent"][$tcol] = trim($this->sPS(' 00387 case "'.$tcol.'": 00388 return strftime(\'%d-%m-%y %H:%M:%S\',$this->internal[\'currentRow\'][\''.$tcol.'\']); 00389 break; 00390 ')); 00391 } elseif ($fC["type"]=="date") { 00392 $theLines["getFieldContent"][$tcol] = trim($this->sPS(' 00393 case "'.$tcol.'": 00394 // For a numbers-only date, use something like: %d-%m-%y 00395 return strftime(\'%A %e. %B %Y\',$this->internal[\'currentRow\'][\''.$tcol.'\']); 00396 break; 00397 ')); 00398 } 00399 if (strstr($fC["type"],"input")) { 00400 $theLines["getListHeader"][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink(\''.$tcol.'\').\'</p></td>'; 00401 $theLines["orderByList"][$tcol]=$tcol; 00402 } 00403 if (strstr($fC["type"],"input")||strstr($fC["type"],"textarea")) { 00404 $theLines["searchFieldList"][$tcol]=$tcol; 00405 } 00406 } 00407 } 00408 } 00409 00410 $theLines["singleRows"]["tstamp"] = trim($this->sPS(' 00411 <tr> 00412 <td nowrap\'.$this->pi_classParam(\'singleView-HCell\').\'><p>Last updated:</p></td> 00413 <td valign="top"><p>\'.date(\'d-m-Y H:i\',$this->internal[\'currentRow\'][\'tstamp\']).\'</p></td> 00414 </tr> 00415 ')); 00416 $theLines["singleRows"]["crdate"] = trim($this->sPS(' 00417 <tr> 00418 <td nowrap\'.$this->pi_classParam(\'singleView-HCell\').\'><p>Created:</p></td> 00419 <td valign="top"><p>\'.date(\'d-m-Y H:i\',$this->internal[\'currentRow\'][\'crdate\']).\'</p></td> 00420 </tr> 00421 ')); 00422 00423 // Add title to local lang file 00424 $ll = $this->addStdLocalLangConf($ll,$k); 00425 00426 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for plugin "'.$cN.'"'); 00427 00428 00429 $innerMainContent = $this->sPS(' 00433 function main($content,$conf) { 00434 switch((string)$conf[\'CMD\']) { 00435 case \'singleView\': 00436 list($t) = explode(\':\',$this->cObj->currentRecord); 00437 $this->internal[\'currentTable\']=$t; 00438 $this->internal[\'currentRow\']=$this->cObj->data; 00439 return $this->pi_wrapInBaseClass($this->singleView($content,$conf)); 00440 break; 00441 default: 00442 if (strstr($this->cObj->currentRecord,\'tt_content\')) { 00443 $conf[\'pidList\'] = $this->cObj->data[\'pages\']; 00444 $conf[\'recursive\'] = $this->cObj->data[\'recursive\']; 00445 } 00446 return $this->pi_wrapInBaseClass($this->listView($content,$conf)); 00447 break; 00448 } 00449 } 00450 '); 00451 00452 $innerMainContent.= $this->sPS(' 00456 function listView($content,$conf) { 00457 $this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf 00458 $this->pi_setPiVarDefaults(); 00459 $this->pi_loadLL(); // Loading the LOCAL_LANG values 00460 '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').' 00461 $lConf = $this->conf[\'listView.\']; // Local settings for the listView function 00462 00463 if ($this->piVars[\'showUid\']) { // If a single element should be displayed: 00464 $this->internal[\'currentTable\'] = \''.$tableName.'\'; 00465 $this->internal[\'currentRow\'] = $this->pi_getRecord(\''.$tableName.'\',$this->piVars[\'showUid\']); 00466 00467 $content = $this->singleView($content,$conf); 00468 return $content; 00469 } else { 00470 $items=array( 00471 \'1\'=> $this->pi_getLL(\'list_mode_1\',\'Mode 1\'), 00472 \'2\'=> $this->pi_getLL(\'list_mode_2\',\'Mode 2\'), 00473 \'3\'=> $this->pi_getLL(\'list_mode_3\',\'Mode 3\'), 00474 ); 00475 if (!isset($this->piVars[\'pointer\'])) $this->piVars[\'pointer\']=0; 00476 if (!isset($this->piVars[\'mode\'])) $this->piVars[\'mode\']=1; 00477 00478 // Initializing the query parameters: 00479 list($this->internal[\'orderBy\'],$this->internal[\'descFlag\']) = explode(\':\',$this->piVars[\'sort\']); 00480 $this->internal[\'results_at_a_time\']=t3lib_div::intInRange($lConf[\'results_at_a_time\'],0,1000,3); // Number of results to show in a listing. 00481 $this->internal[\'maxPages\']=t3lib_div::intInRange($lConf[\'maxPages\'],0,1000,2);; // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc. 00482 $this->internal[\'searchFieldList\']=\''.implode(",",$theLines["searchFieldList"]).'\'; 00483 $this->internal[\'orderByList\']=\''.implode(",",$theLines["orderByList"]).'\'; 00484 00485 // Get number of records: 00486 $res = $this->pi_exec_query(\''.$tableName.'\',1); 00487 list($this->internal[\'res_count\']) = $GLOBALS[\'TYPO3_DB\']->sql_fetch_row($res); 00488 00489 // Make listing query, pass query to SQL database: 00490 $res = $this->pi_exec_query(\''.$tableName.'\'); 00491 $this->internal[\'currentTable\'] = \''.$tableName.'\'; 00492 00493 // Put the whole list together: 00494 $fullTable=\'\'; // Clear var; 00495 # $fullTable.=t3lib_div::view_array($this->piVars); // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line! 00496 00497 // Adds the mode selector. 00498 $fullTable.=$this->pi_list_modeSelector($items); 00499 00500 // Adds the whole list table 00501 $fullTable.='.($config["list_default_listmode"]?'$this->makelist($res);':'$this->pi_list_makelist($res);').' 00502 00503 // Adds the search box: 00504 $fullTable.=$this->pi_list_searchBox(); 00505 00506 // Adds the result browser: 00507 $fullTable.=$this->pi_list_browseresults(); 00508 00509 // Returns the content from the plugin. 00510 return $fullTable; 00511 } 00512 } 00513 '); 00514 00515 00516 if ($config["list_default_listmode"]) { 00517 $innerMainContent.= $this->wrapBody(' 00521 function makelist($res) { 00522 $items=Array(); 00523 // Make list table rows 00524 while($this->internal[\'currentRow\'] = $GLOBALS[\'TYPO3_DB\']->sql_fetch_assoc($res)) { 00525 $items[]=$this->makeListItem(); 00526 } 00527 00528 $out = \'<div\'.$this->pi_classParam(\'listrow\').\'> 00529 \'.implode(chr(10),$items).\' 00530 </div>\'; 00531 return $out; 00532 } 00533 00537 function makeListItem() { 00538 $out=\' 00539 ',implode(chr(10),$theLines["listItemRows"]),' 00540 \'; 00541 return $out; 00542 } 00543 ',3); 00544 } 00545 00546 // Single display: 00547 if ($config["list_default_singlemode"]) { 00548 $innerMainContent.= $this->wrapBody(' 00552 function singleView($content,$conf) { 00553 $this->conf=$conf; 00554 $this->pi_setPiVarDefaults(); 00555 $this->pi_loadLL(); 00556 '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').' 00557 00558 // This sets the title of the page for use in indexed search results: 00559 if ($this->internal[\'currentRow\'][\'title\']) $GLOBALS[\'TSFE\']->indexedDocTitle=$this->internal[\'currentRow\'][\'title\']; 00560 00561 $content=\'<div\'.$this->pi_classParam(\'singleView\').\'> 00562 <H2>Record "\'.$this->internal[\'currentRow\'][\'uid\'].\'" from table "\'.$this->internal[\'currentTable\'].\'":</H2> 00563 ',implode(chr(10),$theLines["singleRows_section"]),' 00564 <p>\'.$this->pi_list_linkSingle($this->pi_getLL(\'back\',\'Back\'),0).\'</p></div>\'. 00565 $this->pi_getEditPanel(); 00566 00567 return $content; 00568 } 00569 ',3); 00570 } else { 00571 $innerMainContent.= $this->wrapBody(' 00575 function singleView($content,$conf) { 00576 $this->conf=$conf; 00577 $this->pi_setPiVarDefaults(); 00578 $this->pi_loadLL(); 00579 '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').' 00580 00581 // This sets the title of the page for use in indexed search results: 00582 if ($this->internal[\'currentRow\'][\'title\']) $GLOBALS[\'TSFE\']->indexedDocTitle=$this->internal[\'currentRow\'][\'title\']; 00583 00584 $content=\'<div\'.$this->pi_classParam(\'singleView\').\'> 00585 <H2>Record "\'.$this->internal[\'currentRow\'][\'uid\'].\'" from table "\'.$this->internal[\'currentTable\'].\'":</H2> 00586 <table> 00587 ',implode(chr(10),$theLines["singleRows"]),' 00588 </table> 00589 <p>\'.$this->pi_list_linkSingle($this->pi_getLL(\'back\',\'Back\'),0).\'</p></div>\'. 00590 $this->pi_getEditPanel(); 00591 00592 return $content; 00593 } 00594 ',3); 00595 } 00596 00597 $this->wizard->ext_localconf[]=$this->sPS(' 00598 '.$this->WOPcomment('WOP:'.$WOP.'[...]').' 00599 t3lib_extMgm::addTypoScript($_EXTKEY,\'setup\',\' 00600 tt_content.shortcut.20.0.conf.'.$tableName.' = < plugin.\'.t3lib_extMgm::getCN($_EXTKEY).\'_pi'.$k.' 00601 tt_content.shortcut.20.0.conf.'.$tableName.'.CMD = singleView 00602 \',43); 00603 '); 00604 00605 if (!$config["list_default_listmode"]) { 00606 $innerMainContent.= $this->wrapBody(' 00610 function pi_list_row($c) { 00611 $editPanel = $this->pi_getEditPanel(); 00612 if ($editPanel) $editPanel=\'<TD>\'.$editPanel.\'</TD>\'; 00613 00614 return \'<tr\'.($c%2 ? $this->pi_classParam(\'listrow-odd\') : \'\').\'> 00615 ',implode(chr(10),$theLines['getListRow']),' 00616 '.$editPanel.' 00617 </tr>\'; 00618 } 00619 ',3); 00620 $innerMainContent.= $this->wrapBody(' 00624 function pi_list_header() { 00625 return \'<tr\'.$this->pi_classParam(\'listrow-header\').\'> 00626 ',implode(chr(10),$theLines["getListHeader"]),' 00627 </tr>\'; 00628 } 00629 ',3); 00630 } 00631 $innerMainContent.= $this->wrapBody(' 00635 function getFieldContent($fN) { 00636 switch($fN) { 00637 case \'uid\': 00638 return $this->pi_list_linkSingle($this->internal[\'currentRow\'][$fN],$this->internal[\'currentRow\'][\'uid\'],1); // The "1" means that the display of single items is CACHED! Set to zero to disable caching. 00639 break; 00640 ',implode(chr(10),$theLines['getFieldContent']),' 00641 default: 00642 return $this->internal[\'currentRow\'][$fN]; 00643 break; 00644 } 00645 } 00646 ',2); 00647 $innerMainContent.= $this->wrapBody(' 00651 function getFieldHeader($fN) { 00652 switch($fN) { 00653 ',implode(chr(10),$theLines["getFieldHeader"]),' 00654 default: 00655 return $this->pi_getLL(\'listFieldHeader_\'.$fN,\'[\'.$fN.\']\'); 00656 break; 00657 } 00658 } 00659 ',2); 00660 $innerMainContent.= $this->sPS(' 00664 function getFieldHeader_sortLink($fN) { 00665 return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array(\'sort\'=>$fN.\':\'.($this->internal[\'descFlag\']?0:1))); 00666 } 00667 '); 00668 00669 00670 00671 00672 00673 00674 $CSS_editor_code=""; 00675 $pCSSSel = str_replace("_","-",$cN); 00676 00677 if ($config["list_default_listmode"]) { 00678 $temp_merge=array(); 00679 if (is_array($P_classes["LV"])) { 00680 while(list($c,$LVc)=each($P_classes["LV"])) { 00681 $temp_merge[]=$this->sPS(' 00682 P_'.$c.' = ['.$LVc.'] 00683 P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.' 00684 P_'.$c.'.attribs = BODYTEXT 00685 P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> 00686 P_'.$c.'.exampleStop = 1 00687 P_'.$c.'.ch.links = < CSS_editor.ch.A 00688 ',1); 00689 } 00690 } 00691 $CSS_editor_code.=$this->wrapBody(' 00692 list = List display 00693 list.selector = .'.$pCSSSel.'-listrow 00694 list.example = <div class="'.$pCSSSel.'-listrow"><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p></div> 00695 list.exampleWrap = <div class="'.$pCSSSel.'-listrow"> | </div> 00696 list.ch.P < .P 00697 list.ch.P.exampleStop = 0 00698 list.ch.P.ch { 00699 ',implode(chr(10),$temp_merge),' 00700 } 00701 '); 00702 } else { 00703 $CSS_editor_code.=$this->sPS(' 00704 list = List display 00705 list.selector = .'.$pCSSSel.'-listrow 00706 list.example = <div class="'.$pCSSSel.'-listrow"><table><tr class="'.$pCSSSel.'-listrow-header"><td nowrap><p>Time / Date:</p></td><td><p><a HREF="#">Title:</a></p></td></tr><tr><td valign="top"><p>25-08-02</p></td><td valign="top"><p><a HREF="#">New company name...</a></p></td></tr><tr class="'.$pCSSSel.'-listrow-odd"><td valign="top"><p>16-08-02</p></td><td valign="top"><p><a HREF="#">Yet another headline here</a></p></td></tr><tr><td valign="top"><p>05-08-02</p></td><td valign="top"><p><a HREF="#">The third line - even row</a></p></td></tr></table></div> 00707 list.exampleStop = 1 00708 list.ch { 00709 TABLE = Table 00710 TABLE.selector = TABLE 00711 TABLE.attribs = TABLE 00712 TD = Table cells 00713 TD.selector = TD 00714 TD.attribs = TD 00715 TD_header = Header row cells 00716 TD_header.selector = TR.'.$pCSSSel.'-listrow-header TD 00717 TD_header.attribs = TD 00718 TD_odd = Odd rows cells 00719 TD_odd.selector = TR.'.$pCSSSel.'-listrow-odd TD 00720 TD_odd.attribs = TD 00721 } 00722 list.ch.TD.ch.P < .P 00723 list.ch.TD_header.ch.P < .P 00724 list.ch.TD_odd.ch.P < .P 00725 '); 00726 } 00727 00728 if ($config["list_default_singlemode"]) { 00729 $temp_merge=array(); 00730 if (is_array($P_classes["SV"])) { 00731 while(list($c,$LVc)=each($P_classes["SV"])) { 00732 $temp_merge[]=$this->sPS(' 00733 P_'.$c.' = ['.$LVc.'] 00734 P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.' 00735 P_'.$c.'.attribs = BODYTEXT 00736 P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> 00737 P_'.$c.'.exampleStop = 1 00738 P_'.$c.'.ch.links = < CSS_editor.ch.A 00739 ',1); 00740 } 00741 } 00742 $CSS_editor_code.=$this->wrapBody(' 00743 single = Single display 00744 single.selector = .'.$pCSSSel.'-singleView 00745 single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p><p><a href="#">Back</a></p></div> 00746 single.exampleWrap = <div class="'.$pCSSSel.'-singleView"> | </div> 00747 single.ch.P < .P 00748 single.ch.P.exampleStop = 0 00749 single.ch.P.ch { 00750 ',implode(chr(10),$temp_merge),' 00751 } 00752 '); 00753 } else { 00754 $CSS_editor_code.=$this->sPS(' 00755 single = Single display 00756 single.selector = .'.$pCSSSel.'-singleView 00757 single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><table><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Date:</p></td><td valign="top"><p>13-09-02</p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Title:</p></td><td valign="top"><p><a HREF="#">New title line</a></p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Teaser text:</p></td><td valign="top"><p>Vocavitque Deus firmamentum caelum et factum est vespere et mane dies secundus dixit vero Deus congregentur.</p><p>Aquae quae sub caelo sunt in locum unum et appareat arida factumque est ita et vocavit Deus aridam terram congregationesque aquarum appellavit maria et vidit Deus quod esset bonum et ait germinet terra herbam virentem et facientem semen et lignum pomiferum faciens fructum iuxta genus suum cuius semen in semet ipso sit super terram et factum est ita et protulit terra herbam virentem et adferentem semen iuxta genus suum lignumque faciens fructum et habens unumquodque sementem secundum speciem suam et vidit Deus quod esset bonum.</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Last updated:</p></td><td valign="top"><p>25-08-2002 18:28</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Created:</p></td><td valign="top"><p>25-08-2002 18:27</p></td></tr></table><p><a href="#">Back</a></p></div> 00758 single.exampleStop = 1 00759 single.ch { 00760 TABLE = Table 00761 TABLE.selector = TABLE 00762 TABLE.attribs = TABLE 00763 TD = Table cells 00764 TD.selector = TD 00765 TD.attribs = TD 00766 TD.ch { 00767 TD = Header cells 00768 TD.selector = +.'.$pCSSSel.'-singleView-HCell 00769 TD.attribs = TD 00770 } 00771 } 00772 single.ch.P < .P 00773 single.ch.H2 < .H2 00774 single.ch.TD.ch.P < .P 00775 single.ch.TD.ch.TD.ch.P < .P 00776 '); 00777 } 00778 00779 $this->addFileToFileArray($config["plus_not_staticTemplate"]?"ext_typoscript_editorcfg.txt":$pathSuffix."static/editorcfg.txt",$this->wrapBody(' 00780 plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'" 00781 plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.' 00782 plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div> 00783 plugin.'.$cN.'.CSS_editor.ch { 00784 P = Text 00785 P.selector = P 00786 P.attribs = BODYTEXT 00787 P.example = <p>General text wrapped in <P>:<BR>This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> 00788 P.exampleStop = 1 00789 P.ch.links = < CSS_editor.ch.A 00790 00791 H2 = Header 2 00792 H2.selector = H2 00793 H2.attribs = HEADER 00794 H2.example = <H2>Header 2 example <a href="#"> with link</a></H2><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p> 00795 H2.ch.links = < CSS_editor.ch.A 00796 H2.exampleStop = 1 00797 00798 H3 = Header 3 00799 H3.selector = H3 00800 H3.attribs = HEADER 00801 H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p> 00802 H3.ch.links = < CSS_editor.ch.A 00803 H3.exampleStop = 1 00804 00805 00806 ## LISTING: 00807 modeSelector = Mode selector 00808 modeSelector.selector = .'.$pCSSSel.'-modeSelector 00809 modeSelector.example = <div class="'.$pCSSSel.'-modeSelector"><table><tr><td class="'.$pCSSSel.'-modeSelector-SCell"><p><a HREF="#">Mode 1 (S)</a></p></td><td><p><a HREF="#">Mode 2</a></p></td><td><p><a HREF="#">Mode 3</a></p></td></tr></table></div> 00810 modeSelector.exampleStop = 1 00811 modeSelector.ch.P < .P 00812 modeSelector.ch.TABLE = Table 00813 modeSelector.ch.TABLE.selector = TABLE 00814 modeSelector.ch.TABLE.attribs = TABLE 00815 modeSelector.ch.TD = Table cells 00816 modeSelector.ch.TD.selector = TD 00817 modeSelector.ch.TD.attribs = TD 00818 modeSelector.ch.TD.ch { 00819 TD = Selected table cells 00820 TD.selector = + .'.$pCSSSel.'-modeSelector-SCell 00821 TD.attribs = TD 00822 } 00823 modeSelector.ch.TD.ch.TD.ch.P < .P 00824 00825 00826 browsebox = Browsing box 00827 browsebox.selector = .'.$pCSSSel.'-browsebox 00828 browsebox.example = <div class="'.$pCSSSel.'-browsebox"><p>Displaying results <span class="'.$pCSSSel.'-browsebox-strong">1 to 3</span> out of <span class="'.$pCSSSel.'-browsebox-strong">4</span></p><table><tr><td class="'.$pCSSSel.'-browsebox-SCell"><p><a HREF="#">Page 1 (S)</a></p></td><td><p><a HREF="#">Page 2</a></p></td><td><p><a HREF="#">Next ></a></p></td></tr></table></div> 00829 browsebox.exampleStop = 1 00830 browsebox.ch.P < .P 00831 browsebox.ch.P.ch.strong = Emphasized numbers 00832 browsebox.ch.P.ch.strong { 00833 selector = SPAN.'.$pCSSSel.'-browsebox-strong 00834 attribs = TEXT 00835 } 00836 browsebox.ch.TABLE = Table 00837 browsebox.ch.TABLE.selector = TABLE 00838 browsebox.ch.TABLE.attribs = TABLE 00839 browsebox.ch.TD = Table cells 00840 browsebox.ch.TD.selector = TD 00841 browsebox.ch.TD.attribs = TD 00842 browsebox.ch.TD.ch { 00843 TD = Selected table cells 00844 TD.selector = + .'.$pCSSSel.'-browsebox-SCell 00845 TD.attribs = TD 00846 } 00847 browsebox.ch.TD.ch.P < .P 00848 browsebox.ch.TD.ch.TD.ch.P < .P 00849 00850 00851 searchbox = Search box 00852 searchbox.selector = .'.$pCSSSel.'-searchbox 00853 searchbox.example = <div class="'.$pCSSSel.'-searchbox"><table><form action="#" method="POST"><tr><td><input type="text" name="'.$cN.'[sword]" value="Search word" class="'.$pCSSSel.'-searchbox-sword"></td><td><input type="submit" value="Search" class="'.$pCSSSel.'-searchbox-button"></td></tr></form></table></div> 00854 searchbox.exampleStop = 1 00855 searchbox.ch { 00856 TABLE = Table 00857 TABLE.selector = TABLE 00858 TABLE.attribs = TABLE 00859 TD = Table cells 00860 TD.selector = TD 00861 TD.attribs = TD 00862 INPUT = Form fields 00863 INPUT.selector = INPUT 00864 INPUT.attribs = TEXT,background-color,width 00865 INPUT.ch { 00866 sword = Search word field 00867 sword.selector = +.'.$pCSSSel.'-searchbox-sword 00868 sword.attribs = TEXT,background-color,width 00869 00870 button = Submit button 00871 button.selector = +.'.$pCSSSel.'-searchbox-button 00872 button.attribs = TEXT,background-color,width 00873 } 00874 } 00875 ',$CSS_editor_code,' 00876 } 00877 '),1); 00878 00879 $this->addFileToFileArray($config["plus_not_staticTemplate"]?"ext_typoscript_setup.txt":$pathSuffix."static/setup.txt",$this->sPS(' 00880 plugin.'.$cN.' { 00881 CMD = 00882 pidList = 00883 recursive = 00884 } 00885 plugin.'.$cN.'.listView { 00886 results_at_a_time = 00887 maxPages = 00888 } 00889 # Example of default set CSS styles (these go into the document header): 00890 plugin.'.$cN.'._CSS_DEFAULT_STYLE ( 00891 .'.$pCSSSel.' H2 { margin-top: 0px; margin-bottom: 0px; } 00892 ) 00893 # Example of how to overrule LOCAL_LANG values for the plugin: 00894 plugin.'.$cN.'._LOCAL_LANG.default { 00895 pi_list_searchBox_search = Search! 00896 } 00897 # Example of how to set default values from TS in the incoming array, $this->piVars of the plugin: 00898 plugin.'.$cN.'._DEFAULT_PI_VARS.test = test 00899 '),1); 00900 00901 $this->wizard->EM_CONF_presets["clearCacheOnLoad"]=1; 00902 00903 if (!$config["plus_not_staticTemplate"]) { 00904 $this->wizard->ext_tables[]=$this->sPS(' 00905 t3lib_extMgm::addStaticFile($_EXTKEY,\''.$pathSuffix.'static/\',\''.addslashes(trim($config['title'])).'\'); 00906 '); 00907 } 00908 } 00909 } else { 00910 // Add title to local lang file 00911 $ll=$this->addStdLocalLangConf($ll,$k,1); 00912 $this->addLocalConf($ll,array("submit_button_label"=>"Click here to submit value"),"submit_button_label","pi",$k,1,1); 00913 00914 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for plugin "'.$cN.'"'); 00915 00916 00917 $innerMainContent = $this->sPS(' 00921 function main($content,$conf) { 00922 $this->conf=$conf; 00923 $this->pi_setPiVarDefaults(); 00924 $this->pi_loadLL(); 00925 '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').' 00926 00927 $content=\' 00928 <strong>This is a few paragraphs:</strong><BR> 00929 <p>This is line 1</p> 00930 <p>This is line 2</p> 00931 00932 <h3>This is a form:</h3> 00933 <form action="\'.$this->pi_getPageLink($GLOBALS[\'TSFE\']->id).\'" method="POST"> 00934 <input type="hidden" name="no_cache" value="1"> 00935 <input type="text" name="\'.$this->prefixId.\'[input_field]" value="\'.htmlspecialchars($this->piVars[\'input_field\']).\'"> 00936 <input type="submit" name="\'.$this->prefixId.\'[submit_button]" value="\'.htmlspecialchars($this->pi_getLL(\'submit_button_label\')).\'"> 00937 </form> 00938 <BR> 00939 <p>You can click here to \'.$this->pi_linkToPage(\'get to this page again\',$GLOBALS[\'TSFE\']->id).\'</p> 00940 \'; 00941 00942 return $this->pi_wrapInBaseClass($content); 00943 } 00944 '); 00945 00946 00947 $CSS_editor_code=""; 00948 $pCSSSel = str_replace("_","-",$cN); 00949 00950 $this->addFileToFileArray($config["plus_not_staticTemplate"]?"ext_typoscript_editorcfg.txt":$pathSuffix."static/editorcfg.txt",$this->sPS(' 00951 plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'" 00952 plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.' 00953 plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div> 00954 plugin.'.$cN.'.CSS_editor.ch { 00955 P = Text 00956 P.selector = P 00957 P.attribs = BODYTEXT 00958 P.example = <p>General text wrapped in <P>:<BR>This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> 00959 P.exampleStop = 1 00960 P.ch.links = < CSS_editor.ch.A 00961 00962 H3 = Header 3 00963 H3.selector = H3 00964 H3.attribs = HEADER 00965 H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p> 00966 H3.ch.links = < CSS_editor.ch.A 00967 H3.exampleStop = 1 00968 } 00969 '),1); 00970 00971 if (!$config["plus_not_staticTemplate"]) { 00972 $this->wizard->ext_tables[]=$this->sPS(' 00973 t3lib_extMgm::addStaticFile($_EXTKEY,"'.$pathSuffix.'static/","'.addslashes(trim($config['title'])).'"); 00974 '); 00975 } 00976 } 00977 break; 00978 case "textbox": 00979 $this->wizard->ext_localconf[]=$this->sPS(' 00980 ## Setting TypoScript for the image in the textbox: 00981 t3lib_extMgm::addTypoScript($_EXTKEY,\'setup\',\' 00982 plugin.'.$cN.'_pi'.$k.'.IMAGEcObject { 00983 file.width=100 00984 } 00985 \',43); 00986 '); 00987 00988 $innerMainContent = $this->sPS(' 00992 function main($content,$conf) { 00993 00994 // Processes the image-field content: 00995 // $conf[\'IMAGEcObject.\'] is passed to the getImage() function as TypoScript 00996 // configuration for the image (except filename which is set automatically here) 00997 $imageFiles = explode(\',\',$this->cObj->data[\'image\']); // This returns an array with image-filenames, if many 00998 $imageRows=array(); // Accumulates the images 00999 reset($imageFiles); 01000 while(list(,$iFile)=each($imageFiles)) { 01001 $imageRows[] = \'<tr> 01002 <td>\'.$this->getImage($iFile,$conf[\'IMAGEcObject.\']).\'</td> 01003 </tr>\'; 01004 } 01005 $imageBlock = count($imageRows)?\'<table border=0 cellpadding=5 cellspacing=0>\'.implode(\'\',$imageRows).\'</table>\':\'<img src=clear.gif width=100 height=1>\'; 01006 01007 // Sets bodytext 01008 $bodyText = nl2br($this->cObj->data[\'bodytext\']); 01009 01010 // And compiles everything into a table: 01011 $finalContent = \'<table border=1> 01012 <tr> 01013 <td valign=top>\'.$imageBlock.\'</td> 01014 <td valign=top>\'.$bodyText.\'</td> 01015 </tr> 01016 </table>\'; 01017 01018 // And returns content 01019 return $finalContent; 01020 } 01025 function getImage($filename,$TSconf) { 01026 list($theImage)=explode(\',\',$filename); 01027 $TSconf[\'file\'] = \'uploads/pics/\'.$theImage; 01028 $img = $this->cObj->IMAGE($TSconf); 01029 return $img; 01030 } 01031 '); 01032 break; 01033 case "header": 01034 $innerMainContent = $this->sPS(' 01038 function main($content,$conf) { 01039 return \'<H1>\'.$this->cObj->data[\'header\'].\'</H1>\'; 01040 } 01041 '); 01042 break; 01043 case "menu_sitemap": 01044 $innerMainContent = $this->sPS(' 01045 01049 function main($content,$conf) { 01050 // Get the PID from which to make the menu. 01051 // If a page is set as reference in the \'Startingpoint\' field, use that 01052 // Otherwise use the page\'s id-number from TSFE 01053 $menuPid = intval($this->cObj->data[\'pages\']?$this->cObj->data[\'pages\']:$GLOBALS[\'TSFE\']->id); 01054 01055 // Now, get an array with all the subpages to this pid: 01056 // (Function getMenu() is found in class.t3lib_page.php) 01057 $menuItems_level1 = $GLOBALS[\'TSFE\']->sys_page->getMenu($menuPid); 01058 01059 // Prepare vars: 01060 $tRows=array(); 01061 01062 // Traverse menuitems: 01063 reset($menuItems_level1); 01064 while(list($uid,$pages_row)=each($menuItems_level1)) { 01065 $tRows[]=\'<tr bgColor="#cccccc"><td>\'.$this->pi_linkToPage( 01066 $pages_row[\'nav_title\']?$pages_row[\'nav_title\']:$pages_row[\'title\'], 01067 $pages_row[\'uid\'], 01068 $pages_row[\'target\'] 01069 ).\'</td></tr>\'; 01070 } 01071 01072 $totalMenu = \'<table border=0 cellpadding=0 cellspacing=2> 01073 <tr><td>This is a menu. Go to your favourite page:</td></tr> 01074 \'.implode(\'\',$tRows). 01075 \'</table><BR>(\'.$this->tellWhatToDo(\'Click here if you want to know where to change the menu design\').\')\'; 01076 01077 return $totalMenu; 01078 } 01079 01080 function tellWhatToDo($str) { 01081 return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath(\''.$extKey.'\').\''.$pathSuffix.'class.'.$cN.'.php and edit the function main()\nto change how the menu is rendered! It is pure PHP coding!\\\')">\'.$str.\'</a>\'; 01082 } 01083 '); 01084 break; 01085 case "typotags": 01086 $innerMainContent = $this->sPS(' 01090 function main($content,$conf) { 01091 $tag_content = $this->cObj->getCurrentVal(); 01092 return \'<b>\'.$this->tellWhatToDo(strtoupper($tag_content)).\'</b>\'; 01093 } 01094 function tellWhatToDo($str) { 01095 return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath(\''.$extKey.'\').\''.$pathSuffix.'class.'.$cN.'.php and edit the function main()\nto change how the tag content is processed!\\\')">\'.$str.\'</a>\'; 01096 } 01097 '); 01098 break; 01099 default: 01100 $innerMainContent = $this->sPS(' 01104 function main($content,$conf) { 01105 return \'Hello World!<HR> 01106 Here is the TypoScript passed to the method:\'. 01107 t3lib_div::view_array($conf); 01108 } 01109 '); 01110 break; 01111 } 01112 $indexContent= $this->wrapBody(' 01113 require_once(PATH_tslib.\'class.tslib_pibase.php\'); 01114 01115 class '.$cN.' extends tslib_pibase { 01116 var $prefixId = \''.$cN.'\'; // Same as class name 01117 var $scriptRelPath = \''.($pathSuffix."class.".$cN.".php").'\'; // Path to this script relative to the extension dir. 01118 var $extKey = \''.$extKey.'\'; // The extension key. 01119 '.($cache ? 'var $pi_checkCHash = TRUE; 01120 ' : '').' 01121 ',$innerMainContent,' 01122 } 01123 '); 01124 $this->addFileToFileArray($pathSuffix."class.".$cN.".php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN.".php",$indexContent,"Plugin '".$config["title"]."' for the '".$extKey."' extension.")); 01125 01126 // Add wizard? 01127 if ($config["plus_wiz"] && $config["addType"]=="list_type") { 01128 $this->addLocalConf($this->wizard->ext_locallang,$config,"title","pi",$k); 01129 $this->addLocalConf($this->wizard->ext_locallang,$config,"plus_wiz_description","pi",$k); 01130 01131 $indexContent= $this->sPS(' 01132 class '.$cN.'_wizicon { 01133 function proc($wizardItems) { 01134 global $LANG; 01135 01136 $LL = $this->includeLocalLang(); 01137 01138 $wizardItems[\'plugins_'.$cN.'\'] = array( 01139 \'icon\'=>t3lib_extMgm::extRelPath(\''.$extKey.'\').\''.$pathSuffix.'ce_wiz.gif\', 01140 \'title\'=>$LANG->getLLL(\'pi'.$k.'_title\',$LL), 01141 \'description\'=>$LANG->getLLL(\'pi'.$k.'_plus_wiz_description\',$LL), 01142 \'params\'=>\'&defVals[tt_content][CType]=list&defVals[tt_content][list_type]='.$extKey.'_pi'.$k.'\' 01143 ); 01144 01145 return $wizardItems; 01146 } 01147 function includeLocalLang() { 01148 include(t3lib_extMgm::extPath(\''.$extKey.'\').\'locallang.php\'); 01149 return $LOCAL_LANG; 01150 } 01151 } 01152 '); 01153 $this->addFileToFileArray($pathSuffix."class.".$cN."_wizicon.php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN."_wizicon.php",$indexContent,"Class that adds the wizard icon.")); 01154 01155 // Add wizard icon 01156 $this->addFileToFileArray($pathSuffix."ce_wiz.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/wiz.gif")); 01157 01158 // Add clear.gif 01159 $this->addFileToFileArray($pathSuffix."clear.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/clear.gif")); 01160 01161 $this->wizard->ext_tables[]=$this->sPS(' 01162 '.$this->WOPcomment('WOP:'.$WOP.'[plus_wiz]:').' 01163 if (TYPO3_MODE=="BE") $TBE_MODULES_EXT["xMOD_db_new_content_el"]["addElClasses"]["'.$cN.'_wizicon"] = t3lib_extMgm::extPath($_EXTKEY).\'pi'.$k.'/class.'.$cN.'_wizicon.php\'; 01164 '); 01165 } 01166 } 01167 01168 } 01169 01170 01171 // Include ux_class extension? 01172 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_pi.php']) { 01173 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_pi.php']); 01174 } 01175 01176 ?>