Public Member Functions | |
init () | |
Initialization of the class. | |
main () | |
Main function, rendering the content of the TypoScript property browser, including links to online resources. | |
printContent () | |
Outputting the accumulated content to screen. | |
browseTSprop ($mode, $show) | |
Create the content of the module:. | |
getObjTree () | |
Create object tree from static_tsconfig_help table. | |
setObj (&$objTree, $strArr, $params) | |
Sets the information from a static_tsconfig_help record in the object array. | |
revertFromSpecialChars ($str) | |
Converts > and < to > and <. | |
doLink ($params) | |
Creates a link based on input params array:. | |
removePointerObjects ($objArray) | |
Remove pointer strings from an array. | |
linkToObj ($str, $uid, $objString='') | |
Linking string to object by UID. | |
printTable ($table, $objString, $objTree) | |
Creates a table of properties:. | |
linkProperty ($str, $propertyVal, $prefix, $datatype) | |
Creates a link on a property. | |
Public Attributes | |
$doc | |
$content | |
$P | |
$mode | |
$show | |
$objString | |
$onlyProperty |
|
Create the content of the module:.
Definition at line 290 of file wizard_tsconfig.php. 00290 { 00291 global $LANG; 00292 00293 // Get object tree: 00294 $objTree = $this->getObjTree(); 00295 00296 // Show single element, if show is set. 00297 $out=''; 00298 if ($show) { 00299 // Get the entry data: 00300 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_tsconfig_help', 'uid='.intval($show)); 00301 $rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); 00302 $table = unserialize($rec['appdata']); 00303 $obj_string = strtr($this->objString,'()','[]'); // Title: 00304 00305 // Title and description: 00306 $out.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>''))).'" class="typo3-goBack">'. 00307 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'. 00308 htmlspecialchars($obj_string). 00309 '</a><br />'; 00310 if ($rec['title']) $out.= '<strong>'.htmlspecialchars($rec['title']).': </strong>'; 00311 if ($rec['description']) $out.= nl2br(htmlspecialchars(trim($rec['description']))).'<br />'; 00312 00313 // Printing the content: 00314 $out.= '<br />'.$this->printTable($table, $obj_string, $objTree[$mode.'.']); 00315 $out.='<hr />'; 00316 00317 // Printing the "mixer-field": 00318 if (!$this->onlyProperty) { 00319 $links=array(); 00320 $links[]='<a href="#" onclick="mixerField(\'Indent\');return false;">'.$LANG->getLL('tsprop_mixer_indent',1).'</a>'; 00321 $links[]='<a href="#" onclick="mixerField(\'Outdent\');return false;">'.$LANG->getLL('tsprop_mixer_outdent',1).'</a>'; 00322 $links[]='<a href="#" onclick="mixerField(\'Wrap\',unescape(\''.rawurlencode($obj_string).'\'));return false;">'.$LANG->getLL('tsprop_mixer_wrap',1).'</a>'; 00323 $links[]='<a href="#" onclick="mixerField(\'Transfer\');return false;">'.$LANG->getLL('tsprop_mixer_transfer',1).'</a>'; 00324 $out.='<textarea rows="5" name="mixer" wrap="off"'.$this->doc->formWidthText(48,'','off').'></textarea>'; 00325 $out.='<br /><strong>'.implode(' | ',$links).'</strong>'; 00326 $out.='<hr />'; 00327 } 00328 } 00329 00330 00331 // SECTION: Showing property tree: 00332 $tmpl = t3lib_div::makeInstance('ext_TSparser'); 00333 $tmpl->tt_track = 0; // Do not log time-performance information 00334 $tmpl->fixedLgd=0; 00335 $tmpl->linkObjects=0; 00336 $tmpl->bType=''; 00337 $tmpl->ext_expandAllNotes=1; 00338 $tmpl->ext_noPMicons=1; 00339 $tmpl->ext_noSpecialCharsOnLabels=1; 00340 00341 if (is_array($objTree[$mode.'.'])) { 00342 $out.=' 00343 00344 00345 <!-- 00346 TSconfig, object tree: 00347 --> 00348 <table border="0" cellpadding="0" cellspacing="0" id="typo3-objtree"> 00349 <tr> 00350 <td nowrap="nowrap">'.$tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode.'.']),'','').'</td> 00351 </tr> 00352 </table>'; 00353 } 00354 00355 return $out; 00356 }
|
|
Creates a link based on input params array:.
Definition at line 439 of file wizard_tsconfig.php. 00439 { 00440 $title = trim($params[0]['title'])?trim($params[0]['title']):'[GO]'; 00441 $str = $this->linkToObj($title,$params[0]['uid'],$params[1]); 00442 return $str; 00443 }
|
|
Create object tree from static_tsconfig_help table.
Definition at line 376 of file wizard_tsconfig.php. 00376 { 00377 $hash = md5('WIZARD_TSCONFIG-objTree'); 00378 $objTree=array(); 00379 00380 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,obj_string,title', 'static_tsconfig_help', ''); 00381 while($rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00382 $rec['obj_string'] = $this->revertFromSpecialChars($rec['obj_string']); 00383 $p = explode(';',$rec['obj_string']); 00384 while(list(,$v)=each($p)) { 00385 $p2 = t3lib_div::trimExplode(':',$v,1); 00386 $subp=t3lib_div::trimExplode('/',$p2[1],1); 00387 while(list(,$v2)=each($subp)) { 00388 $this->setObj($objTree,explode('.',$p2[0].'.'.$v2),array($rec,$v2)); 00389 } 00390 } 00391 } 00392 return $objTree; 00393 }
|
|
Initialization of the class.
Definition at line 145 of file wizard_tsconfig.php. References t3lib_extMgm::isLoaded(). 00145 { 00146 global $LANG,$BACK_PATH; 00147 00148 // Check if the tsconfig_help extension is loaded - which is mandatory for this wizard to work. 00149 t3lib_extMgm::isLoaded('tsconfig_help',1); 00150 00151 // Init GPvars: 00152 $this->P = t3lib_div::_GP('P'); 00153 $this->mode = t3lib_div::_GP('mode'); 00154 $this->show = t3lib_div::_GP('show'); 00155 $this->objString = t3lib_div::_GP('objString'); 00156 $this->onlyProperty = t3lib_div::_GP('onlyProperty'); 00157 00158 // Preparing some JavaScript code: 00159 if (!is_array($this->P['fieldChangeFunc'])) $this->P['fieldChangeFunc']=array(); 00160 unset($this->P['fieldChangeFunc']['alert']); 00161 reset($this->P['fieldChangeFunc']); 00162 $update=''; 00163 while(list($k,$v)=each($this->P['fieldChangeFunc'])) { 00164 $update.= ' 00165 window.opener.'.$v; 00166 } 00167 00168 // Init the document table object: 00169 $this->doc = t3lib_div::makeInstance('mediumDoc'); 00170 $this->doc->docType = 'xhtml_trans'; 00171 $this->doc->backPath = $BACK_PATH; 00172 $this->doc->form='<form action="" name="editform">'; 00173 00174 // Adding Styles (should go into stylesheet?) 00175 $this->doc->inDocStylesArray[] = ' 00176 A:link {text-decoration: bold; color: '.$this->doc->hoverColor.';} 00177 A:visited {text-decoration: bold; color: '.$this->doc->hoverColor.';} 00178 A:active {text-decoration: bold; color: '.$this->doc->hoverColor.';} 00179 A:hover {color: '.$this->doc->bgColor2.'} 00180 '; 00181 00182 $this->doc->JScode.=$this->doc->wrapScriptTags(' 00183 function checkReference() { // 00184 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) { 00185 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"]; 00186 } else { 00187 close(); 00188 } 00189 } 00190 function setValue(input) { // 00191 var field = checkReference(); 00192 if (field) { 00193 field.value=input+"\n"+field.value; 00194 '.$update.' 00195 window.opener.focus(); 00196 } 00197 close(); 00198 } 00199 function getValue() { // 00200 var field = checkReference(); 00201 if (field) return field.value; 00202 } 00203 function mixerField(cmd,objString) { // 00204 var temp; 00205 switch(cmd) { 00206 case "Indent": 00207 temp = str_replace("\n","\n ","\n"+document.editform.mixer.value); 00208 document.editform.mixer.value = temp.substr(1); 00209 break; 00210 case "Outdent": 00211 temp = str_replace("\n ","\n","\n"+document.editform.mixer.value); 00212 document.editform.mixer.value = temp.substr(1); 00213 break; 00214 case "Transfer": 00215 setValue(document.editform.mixer.value); 00216 break; 00217 case "Wrap": 00218 document.editform.mixer.value=objString+" {\n"+document.editform.mixer.value+"\n}"; 00219 break; 00220 } 00221 } 00222 function str_replace(match,replace,string) { // 00223 var input = ""+string; 00224 var matchStr = ""+match; 00225 if (!matchStr) {return string;} 00226 var output = ""; 00227 var pointer=0; 00228 var pos = input.indexOf(matchStr); 00229 while (pos!=-1) { 00230 output+=""+input.substr(pointer, pos-pointer)+replace; 00231 pointer=pos+matchStr.length; 00232 pos = input.indexOf(match,pos+1); 00233 } 00234 output+=""+input.substr(pointer); 00235 return output; 00236 } 00237 function jump(show,objString) { // 00238 document.location = "'.t3lib_div::linkThisScript(array('show'=>'','objString'=>'')).'&show="+show+"&objString="+objString; 00239 } 00240 '); 00241 00242 00243 // Start the page: 00244 $this->content.=$this->doc->startPage($LANG->getLL('tsprop')); 00245 }
|
|
Creates a link on a property.
Definition at line 565 of file wizard_tsconfig.php. References $out. 00565 { 00566 $out=''; 00567 00568 // Setting preset value: 00569 if (strstr($datatype,'boolean')) { 00570 $propertyVal.='=1'; // add preset "=1" to boolean values. 00571 } else { 00572 $propertyVal.='='; // add preset "=" 00573 } 00574 00575 // Adding mixer features; The plus icon: 00576 if(!$this->onlyProperty) { 00577 $aOnClick = 'document.editform.mixer.value=unescape(\' '.rawurlencode($propertyVal).'\')+\'\n\'+document.editform.mixer.value; return false;'; 00578 $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'. 00579 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('tsprop_addToList',1).'" align="top" alt="" />'. 00580 '</a>'; 00581 $propertyVal = $prefix.'.'.$propertyVal; 00582 } 00583 00584 // Wrap string: 00585 $aOnClick = 'setValue(unescape(\''.rawurlencode($propertyVal).'\')); return false;'; 00586 $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>'; 00587 00588 // Return link: 00589 return $out; 00590 }
|
|
Linking string to object by UID.
Definition at line 471 of file wizard_tsconfig.php. 00471 { 00472 $aOnClick='jump(\''.rawurlencode($uid).'\',\''.rawurlencode($objString).'\');return false;'; 00473 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.htmlspecialchars($str).'</a>'; 00474 }
|
|
Main function, rendering the content of the TypoScript property browser, including links to online resources.
Definition at line 252 of file wizard_tsconfig.php. 00252 { 00253 global $LANG; 00254 00255 // Adding module content: 00256 $this->content.=$this->doc->section($LANG->getLL('tsprop'),$this->browseTSprop($this->mode,$this->show),0,1); 00257 00258 // Adding link to TSref: 00259 if ($this->mode=='tsref') { 00260 $this->content.=$this->doc->section($LANG->getLL('tsprop_TSref'),' 00261 <a href="'.htmlspecialchars('http://typo3.org/documentation/document-library/doc_core_tsref/').'" target="_blank">'.$LANG->getLL('tsprop_TSref',1).'</a> 00262 ',0,1); 00263 } 00264 // Adding link to admin guides etc: 00265 if ($this->mode=='page' || $this->mode=='beuser') { 00266 $this->content.=$this->doc->section($LANG->getLL('tsprop_tsconfig'),' 00267 <a href="'.htmlspecialchars('http://typo3.org/documentation/document-library/doc_core_tsconfig/').'" target="_blank">'.$LANG->getLL('tsprop_tsconfig',1).'</a> 00268 ',0,1); 00269 } 00270 // Ending page: 00271 $this->content.=$this->doc->endPage(); 00272 }
|
|
Outputting the accumulated content to screen.
Definition at line 279 of file wizard_tsconfig.php. 00279 { 00280 echo $this->content; 00281 }
|
|
Creates a table of properties:.
Definition at line 484 of file wizard_tsconfig.php. References stdWrap(), and table(). 00484 { 00485 if (is_array($table['rows'])) { 00486 00487 // Initialize: 00488 $lines=array(); 00489 00490 // Adding header: 00491 $lines[]=' 00492 <tr> 00493 <td><img src="clear.gif" width="175" height="1" alt="" /></td> 00494 <td><img src="clear.gif" width="100" height="1" alt="" /></td> 00495 <td><img src="clear.gif" width="400" height="1" alt="" /></td> 00496 <td><img src="clear.gif" width="70" height="1" alt="" /></td> 00497 </tr>'; 00498 $lines[]=' 00499 <tr class="bgColor5"> 00500 <td><strong>Property:</strong></td> 00501 <td><strong>Data type:</strong></td> 00502 <td><strong>Description:</strong></td> 00503 <td><strong>Default:</strong></td> 00504 </tr>'; 00505 00506 // Traverse the content of "rows": 00507 foreach($table['rows'] as $row) { 00508 00509 // Linking: 00510 $lP=t3lib_div::trimExplode(chr(10),$row['property'],1); 00511 $lP2=array(); 00512 while(list($k,$lStr)=each($lP)) { 00513 $lP2[$k] = $this->linkProperty($lStr,$lStr,$objString,$row['datatype']); 00514 } 00515 $linkedProperties=implode('<hr />',$lP2); 00516 00517 // Data type: 00518 $dataType = $row['datatype']; 00519 00520 // Generally "->[something]" 00521 $reg=array(); 00522 ereg('->[[:alnum:]_]*',$dataType,$reg); 00523 if ($reg[0] && is_array($objTree[$reg[0]])) { 00524 $dataType = str_replace($reg[0],'<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree[$reg[0]][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">'.htmlspecialchars($reg[0]).'</a>',$dataType); 00525 } 00526 00527 // stdWrap 00528 if (!strstr($dataType,'->stdWrap') && strstr(strip_tags($dataType),'stdWrap')) { 00529 // Potential problem can be that "stdWrap" is substituted inside another A-tag. So maybe we should even check if there is already a <A>-tag present and if so, not make a substitution? 00530 $dataType = str_replace('stdWrap','<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree['->stdWrap'][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">stdWrap</a>',$dataType); 00531 } 00532 00533 00534 $lines[]=' 00535 <tr class="bgColor4"> 00536 <td valign="top" class="bgColor4-20"><strong>'.$linkedProperties.'</strong></td> 00537 <td valign="top">'.nl2br($dataType.' ').'</td> 00538 <td valign="top">'.nl2br($row['description']).'</td> 00539 <td valign="top">'.nl2br($row['default']).'</td> 00540 </tr>'; 00541 } 00542 // Return it all: 00543 return ' 00544 00545 00546 00547 <!-- 00548 TSconfig, attribute selector: 00549 --> 00550 <table border="0" cellpadding="0" cellspacing="1" width="500" id="typo3-attributes"> 00551 '.implode('',$lines).' 00552 </table>'; 00553 } 00554 }
|
|
Remove pointer strings from an array.
Definition at line 452 of file wizard_tsconfig.php. 00452 { 00453 reset($objArray); 00454 while(list($k)=each($objArray)) { 00455 if (substr(trim($k),0,2)=="->" && trim($k)!='->.') { 00456 $objArray['->.'][substr(trim($k),2)]=$objArray[$k]; 00457 unset($objArray[$k]); 00458 } 00459 } 00460 return $objArray; 00461 }
|
|
Converts > and < to > and <.
Definition at line 426 of file wizard_tsconfig.php. 00426 { 00427 $str = str_replace('>','>',$str); 00428 $str = str_replace('<','<',$str); 00429 return $str; 00430 }
|
|
Sets the information from a static_tsconfig_help record in the object array. Makes recursive calls.
Definition at line 406 of file wizard_tsconfig.php. References $key. 00406 { 00407 $key = current($strArr); 00408 reset($strArr); 00409 if (count($strArr)>1) { 00410 array_shift($strArr); 00411 if (!isset($objTree[$key.'.'])) $objTree[$key.'.']=array(); 00412 $this->setObj($objTree[$key.'.'],$strArr,$params); 00413 } else { 00414 $objTree[$key]=$params; 00415 $objTree[$key]['_LINK']=$this->doLink($params); 00416 } 00417 }
|
|
Definition at line 127 of file wizard_tsconfig.php. |
|
Definition at line 126 of file wizard_tsconfig.php. |
|
Definition at line 131 of file wizard_tsconfig.php. |
|
Definition at line 133 of file wizard_tsconfig.php. |
|
Definition at line 134 of file wizard_tsconfig.php. |
|
Definition at line 130 of file wizard_tsconfig.php. |
|
Definition at line 132 of file wizard_tsconfig.php. |