00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00072 $BACK_PATH='';
00073 require ('init.php');
00074 require ('template.php');
00075 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
00076 require_once (PATH_t3lib.'class.t3lib_parsehtml.php');
00077 require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
00078 require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00098 class ext_TSparser extends t3lib_tsparser_ext {
00099
00106 function makeHtmlspecialchars($P) {
00107 return $P['_LINK'];
00108 }
00109 }
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00127 class SC_wizard_tsconfig {
00128
00129
00130 var $doc;
00131 var $content;
00132
00133
00134 var $P;
00135 var $mode;
00136 var $show;
00137 var $objString;
00138 var $onlyProperty;
00139
00140
00141
00142
00143
00149 function init() {
00150 global $LANG,$BACK_PATH;
00151
00152
00153 t3lib_extMgm::isLoaded('tsconfig_help',1);
00154
00155
00156 $this->P = t3lib_div::_GP('P');
00157 $this->mode = t3lib_div::_GP('mode');
00158 $this->show = t3lib_div::_GP('show');
00159 $this->objString = t3lib_div::_GP('objString');
00160 $this->onlyProperty = t3lib_div::_GP('onlyProperty');
00161
00162 if (!is_array($this->P['fieldChangeFunc'])) $this->P['fieldChangeFunc']=array();
00163 unset($this->P['fieldChangeFunc']['alert']);
00164 $update='';
00165 foreach($this->P['fieldChangeFunc'] as $k=>$v) {
00166 $update.= '
00167 window.opener.'.$v;
00168 }
00169
00170
00171 $this->doc = t3lib_div::makeInstance('mediumDoc');
00172 $this->doc->docType = 'xhtml_trans';
00173 $this->doc->backPath = $BACK_PATH;
00174 $this->doc->form='<form action="" name="editform">';
00175
00176
00177 $this->doc->inDocStylesArray[] = '
00178 A:link {text-decoration: bold; color: '.$this->doc->hoverColor.';}
00179 A:visited {text-decoration: bold; color: '.$this->doc->hoverColor.';}
00180 A:active {text-decoration: bold; color: '.$this->doc->hoverColor.';}
00181 A:hover {color: '.$this->doc->bgColor2.'}
00182 ';
00183
00184 $this->doc->JScode.=$this->doc->wrapScriptTags('
00185 function checkReference_name() {
00186 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
00187 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
00188 }
00189 }
00190 function checkReference_value() {
00191 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemValue'].'"] ) {
00192 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemValue'].'"];
00193 }
00194 }
00195
00202 function setValue(field,value) {
00203 var nameField = checkReference_name();
00204 var valueField = checkReference_value();
00205 if (nameField) {
00206 if (valueField) {
00207 nameField.value=field;
00208 valueField.value=value;
00209 } else {
00210 if (value) {
00211 nameField.value=field+"="+value+"\n"+nameField.value;
00212 } else {
00213 nameField.value=field+"\n"+nameField.value;
00214 }
00215 }
00216 '.$update.'
00217 window.opener.focus();
00218 }
00219 close();
00220 }
00221 function getValue() {
00222 var field = checkReference_name();
00223 if (field) {
00224 return field.value;
00225 } else {
00226 close();
00227 }
00228 }
00229
00236 function mixerField(cmd,objString) {
00237 var temp;
00238 switch(cmd) {
00239 case "Indent":
00240 temp = str_replace("\n","\n ","\n"+document.editform.mixer.value);
00241 document.editform.mixer.value = temp.substr(1);
00242 break;
00243 case "Outdent":
00244 temp = str_replace("\n ","\n","\n"+document.editform.mixer.value);
00245 document.editform.mixer.value = temp.substr(1);
00246 break;
00247 case "Transfer":
00248 setValue(document.editform.mixer.value);
00249 break;
00250 case "Wrap":
00251 document.editform.mixer.value=objString+" {\n"+document.editform.mixer.value+"\n}";
00252 break;
00253 }
00254 }
00255
00262 function str_replace(match,replace,string) {
00263 var input = ""+string;
00264 var matchStr = ""+match;
00265 if (!matchStr) {return string;}
00266 var output = "";
00267 var pointer=0;
00268 var pos = input.indexOf(matchStr);
00269 while (pos!=-1) {
00270 output+=""+input.substr(pointer, pos-pointer)+replace;
00271 pointer=pos+matchStr.length;
00272 pos = input.indexOf(match,pos+1);
00273 }
00274 output+=""+input.substr(pointer);
00275 return output;
00276 }
00277
00284 function jump(show,objString) {
00285 window.location.href = "'.t3lib_div::linkThisScript(array('show'=>'','objString'=>'')).'&show="+show+"&objString="+objString;
00286 }
00287 ');
00288
00289
00290
00291 $this->content.=$this->doc->startPage($LANG->getLL('tsprop'));
00292 }
00293
00299 function main() {
00300 global $LANG;
00301
00302
00303 $this->content.=$this->doc->section($LANG->getLL('tsprop'),$this->browseTSprop($this->mode,$this->show),0,1);
00304
00305
00306 if ($this->mode=='tsref') {
00307 $this->content.=$this->doc->section($LANG->getLL('tsprop_TSref'),'
00308 <a href="'.htmlspecialchars('http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/').'" target="_blank">'.$LANG->getLL('tsprop_TSref',1).'</a>
00309 ',0,1);
00310 }
00311
00312 if ($this->mode=='page' || $this->mode=='beuser') {
00313 $this->content.=$this->doc->section($LANG->getLL('tsprop_tsconfig'),'
00314 <a href="'.htmlspecialchars('http://typo3.org/documentation/document-library/references/doc_core_tsconfig/current/view/').'" target="_blank">'.$LANG->getLL('tsprop_tsconfig',1).'</a>
00315 ',0,1);
00316 }
00317 }
00318
00324 function printContent() {
00325 $this->content.= $this->doc->endPage();
00326 $this->content = $this->doc->insertStylesAndJS($this->content);
00327 echo $this->content;
00328 }
00329
00337 function browseTSprop($mode,$show) {
00338 global $LANG;
00339
00340
00341 $objTree = $this->getObjTree();
00342
00343
00344 $out='';
00345 if ($show) {
00346
00347 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_tsconfig_help', 'uid='.intval($show));
00348 $rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00349 $table = unserialize($rec['appdata']);
00350 $obj_string = strtr($this->objString,'()','[]');
00351
00352
00353 $out.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>''))).'" class="typo3-goBack">'.
00354 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'.
00355 htmlspecialchars($obj_string).
00356 '</a><br />';
00357 if ($rec['title']) $out.= '<strong>'.htmlspecialchars($rec['title']).': </strong>';
00358 if ($rec['description']) $out.= nl2br(htmlspecialchars(trim($rec['description']))).'<br />';
00359
00360
00361 $out.= '<br />'.$this->printTable($table, $obj_string, $objTree[$mode.'.']);
00362 $out.='<hr />';
00363
00364
00365 if (!$this->onlyProperty) {
00366 $links=array();
00367 $links[]='<a href="#" onclick="mixerField(\'Indent\');return false;">'.$LANG->getLL('tsprop_mixer_indent',1).'</a>';
00368 $links[]='<a href="#" onclick="mixerField(\'Outdent\');return false;">'.$LANG->getLL('tsprop_mixer_outdent',1).'</a>';
00369 $links[]='<a href="#" onclick="mixerField(\'Wrap\',unescape(\''.rawurlencode($obj_string).'\'));return false;">'.$LANG->getLL('tsprop_mixer_wrap',1).'</a>';
00370 $links[]='<a href="#" onclick="mixerField(\'Transfer\');return false;">'.$LANG->getLL('tsprop_mixer_transfer',1).'</a>';
00371 $out.='<textarea rows="5" name="mixer" wrap="off"'.$this->doc->formWidthText(48,'','off').' class="fixed-font enable-tab"></textarea>';
00372 $out.='<br /><strong>'.implode(' | ',$links).'</strong>';
00373 $out.='<hr />';
00374 }
00375 }
00376
00377
00378
00379 $tmpl = t3lib_div::makeInstance('ext_TSparser');
00380 $tmpl->tt_track = 0;
00381 $tmpl->fixedLgd=0;
00382 $tmpl->linkObjects=0;
00383 $tmpl->bType='';
00384 $tmpl->ext_expandAllNotes=1;
00385 $tmpl->ext_noPMicons=1;
00386 $tmpl->ext_noSpecialCharsOnLabels=1;
00387
00388 if (is_array($objTree[$mode.'.'])) {
00389 $out.='
00390
00391
00392 <!--
00393 TSconfig, object tree:
00394 -->
00395 <table border="0" cellpadding="0" cellspacing="0" id="typo3-objtree">
00396 <tr>
00397 <td nowrap="nowrap">'.$tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode.'.']),'','','','','1').'</td>
00398 </tr>
00399 </table>';
00400 }
00401
00402 return $out;
00403 }
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00423 function getObjTree() {
00424 $objTree=array();
00425
00426 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,obj_string,title', 'static_tsconfig_help', '');
00427 while($rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00428 $rec['obj_string'] = $this->revertFromSpecialChars($rec['obj_string']);
00429 $p = explode(';',$rec['obj_string']);
00430 while(list(,$v)=each($p)) {
00431 $p2 = t3lib_div::trimExplode(':',$v,1);
00432 $subp=t3lib_div::trimExplode('/',$p2[1],1);
00433 while(list(,$v2)=each($subp)) {
00434 $this->setObj($objTree,explode('.',$p2[0].'.'.$v2),array($rec,$v2));
00435 }
00436 }
00437 }
00438 return $objTree;
00439 }
00440
00452 function setObj(&$objTree,$strArr,$params) {
00453 $key = current($strArr);
00454 reset($strArr);
00455 if (count($strArr)>1) {
00456 array_shift($strArr);
00457 if (!isset($objTree[$key.'.'])) $objTree[$key.'.']=array();
00458 $this->setObj($objTree[$key.'.'],$strArr,$params);
00459 } else {
00460 $objTree[$key]=$params;
00461 $objTree[$key]['_LINK']=$this->doLink($params);
00462 }
00463 }
00464
00472 function revertFromSpecialChars($str) {
00473 $str = str_replace('>','>',$str);
00474 $str = str_replace('<','<',$str);
00475 return $str;
00476 }
00477
00485 function doLink($params) {
00486 $title = trim($params[0]['title'])?trim($params[0]['title']):'[GO]';
00487 $str = $this->linkToObj($title,$params[0]['uid'],$params[1]);
00488 return $str;
00489 }
00490
00498 function removePointerObjects($objArray) {
00499 reset($objArray);
00500 while(list($k)=each($objArray)) {
00501 if (substr(trim($k),0,2)=="->" && trim($k)!='->.') {
00502 $objArray['->.'][substr(trim($k),2)]=$objArray[$k];
00503 unset($objArray[$k]);
00504 }
00505 }
00506 return $objArray;
00507 }
00508
00517 function linkToObj($str,$uid,$objString='') {
00518 $aOnClick='jump(\''.rawurlencode($uid).'\',\''.rawurlencode($objString).'\');return false;';
00519 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.htmlspecialchars($str).'</a>';
00520 }
00521
00530 function printTable($table,$objString,$objTree) {
00531 if (is_array($table['rows'])) {
00532
00533
00534 $lines=array();
00535
00536
00537 $lines[]='
00538 <tr>
00539 <td><img src="clear.gif" width="175" height="1" alt="" /></td>
00540 <td><img src="clear.gif" width="100" height="1" alt="" /></td>
00541 <td><img src="clear.gif" width="400" height="1" alt="" /></td>
00542 <td><img src="clear.gif" width="70" height="1" alt="" /></td>
00543 </tr>';
00544 $lines[]='
00545 <tr class="bgColor5">
00546 <td><strong>Property:</strong></td>
00547 <td><strong>Data type:</strong></td>
00548 <td><strong>Description:</strong></td>
00549 <td><strong>Default:</strong></td>
00550 </tr>';
00551
00552
00553 foreach($table['rows'] as $row) {
00554
00555
00556 $lP=t3lib_div::trimExplode(chr(10),$row['property'],1);
00557 $lP2=array();
00558 while(list($k,$lStr)=each($lP)) {
00559 $lP2[$k] = $this->linkProperty($lStr,$lStr,$objString,$row['datatype']);
00560 }
00561 $linkedProperties=implode('<hr />',$lP2);
00562
00563
00564 $dataType = $row['datatype'];
00565
00566
00567 $reg=array();
00568 ereg('->[[:alnum:]_]*',$dataType,$reg);
00569 if ($reg[0] && is_array($objTree[$reg[0]])) {
00570 $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);
00571 }
00572
00573
00574 if (!strstr($dataType,'->stdWrap') && strstr(strip_tags($dataType),'stdWrap')) {
00575
00576 $dataType = str_replace('stdWrap','<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree['->stdWrap'][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">stdWrap</a>',$dataType);
00577 }
00578
00579
00580 $lines[]='
00581 <tr class="bgColor4">
00582 <td valign="top" class="bgColor4-20"><strong>'.$linkedProperties.'</strong></td>
00583 <td valign="top">'.nl2br($dataType.' ').'</td>
00584 <td valign="top">'.nl2br($row['description']).'</td>
00585 <td valign="top">'.nl2br($row['default']).'</td>
00586 </tr>';
00587 }
00588
00589 return '
00590
00591
00592
00593 <!--
00594 TSconfig, attribute selector:
00595 -->
00596 <table border="0" cellpadding="0" cellspacing="1" width="500" id="typo3-attributes">
00597 '.implode('',$lines).'
00598 </table>';
00599 }
00600 }
00601
00611 function linkProperty($str,$propertyName,$prefix,$datatype) {
00612 $out='';
00613
00614
00615 if (strstr($datatype,'boolean')) {
00616 $propertyVal='1';
00617 }
00618
00619
00620 if(!$this->onlyProperty) {
00621 $aOnClick = 'document.editform.mixer.value=unescape(\' '.rawurlencode($propertyName.'='.$propertyVal).'\')+\'\n\'+document.editform.mixer.value; return false;';
00622 $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00623 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('tsprop_addToList',1).'" align="top" alt="" />'.
00624 '</a>';
00625 $propertyName = $prefix.'.'.$propertyName;
00626 }
00627
00628
00629 $aOnClick = 'setValue(unescape(\''.rawurlencode($propertyName).'\'),unescape(\''.rawurlencode($propertyVal).'\')); return false;';
00630 $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
00631
00632
00633 return $out;
00634 }
00635 }
00636
00637
00638 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_tsconfig.php']) {
00639 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_tsconfig.php']);
00640 }
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654 $SOBE = t3lib_div::makeInstance('SC_wizard_tsconfig');
00655 $SOBE->init();
00656 $SOBE->main();
00657 $SOBE->printContent();
00658 ?>