This commit was manufactured by cvs2svn to create tag
[Packages/TYPO3.CMS.git] / typo3 / wizard_tsconfig.php
index 83e0d5e..03dae3c 100755 (executable)
@@ -1,22 +1,22 @@
 <?php
 /***************************************************************
 *  Copyright notice
-*  
-*  (c) 1999-2003 Kasper Skårhøj (kasper@typo3.com)
+*
+*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
 *  All rights reserved
 *
-*  This script is part of the TYPO3 project. The TYPO3 project is 
+*  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
-* 
+*
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license 
+*  A copy is found in the textfile GPL.txt and important notices to the license
 *  from the author is found in LICENSE.txt distributed with these scripts.
 *
-* 
+*
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
-/** 
+/**
  * Wizard for inserting TSconfig in form fields. (page,user or TS)
- * 
- * @author     Kasper Skårhøj <kasper@typo3.com>
- * @package TYPO3
- * @subpackage core
+ *
+ * $Id$
+ * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
+ * XHTML compliant
+ *
+ * @author     Kasper Skaarhoj <kasper@typo3.com>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   94: class ext_TSparser extends t3lib_tsparser_ext
+ *  102:     function makeHtmlspecialchars($P)
+ *
+ *
+ *  123: class SC_wizard_tsconfig
+ *  145:     function init()
+ *  252:     function main()
+ *  279:     function printContent()
+ *  290:     function browseTSprop($mode,$show)
+ *
+ *              SECTION: Module functions
+ *  376:     function getObjTree()
+ *  406:     function setObj(&$objTree,$strArr,$params)
+ *  426:     function revertFromSpecialChars($str)
+ *  439:     function doLink($params)
+ *  452:     function removePointerObjects($objArray)
+ *  471:     function linkToObj($str,$uid,$objString='')
+ *  484:     function printTable($table,$objString,$objTree)
+ *  565:     function linkProperty($str,$propertyVal,$prefix,$datatype)
+ *
+ * TOTAL FUNCTIONS: 13
+ * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
 
-$BACK_PATH="";
-require ("init.php");
-require ("template.php");
-include ("sysext/lang/locallang_wizards.php");
-require_once (PATH_t3lib."class.t3lib_parsehtml.php");
-require_once (PATH_t3lib."class.t3lib_tstemplate.php");
-require_once (PATH_t3lib."class.t3lib_tsparser_ext.php");
+
+$BACK_PATH='';
+require ('init.php');
+require ('template.php');
+include ('sysext/lang/locallang_wizards.php');
+require_once (PATH_t3lib.'class.t3lib_parsehtml.php');
+require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
+require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
 
 
 
-       
-// ***************************
-// Script Classes
-// ***************************
+
+
+
+
+
+
+
+
+
+/**
+ * TypoScript parser extension class.
+ *
+ * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
 class ext_TSparser extends t3lib_tsparser_ext {
+
+       /**
+        * Pass through of incoming value for link.
+        *
+        * @param       array           P array
+        * @return      string          The "_LINK" key value, straight away.
+        */
        function makeHtmlspecialchars($P)       {
-               return $P["_LINK"];
+               return $P['_LINK'];
        }
 }
+
+
+
+
+
+
+
+
+
+
+/**
+ * Script Class for rendering the TSconfig/TypoScript property browser.
+ *
+ * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
 class SC_wizard_tsconfig {
-       var $content;
-       var $P;
-       var $mode;
-       var $show;
-       var $doc;       
-       
+
+               // Internal, dynamic:
+       var $doc;                                       // Document template object
+       var $content;                           // Content accumulation for the module.
+
+               // Internal, static: GPvars
+       var $P;                                         // Wizard parameters, coming from TCEforms linking to the wizard.
+       var $mode;                                      // "page", "tsref" or "beuser"
+       var $show;                                      // Pointing to an entry in static_tsconfig_help to show.
+       var $objString;                         // Object path - for display.
+       var $onlyProperty;                      // If set, the "mixed-field" is not shown and you can select only one property at a time.
+
+
+
+
+
+       /**
+        * Initialization of the class
+        *
+        * @return      void
+        */
        function init() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
+               global $LANG,$BACK_PATH;
 
-               t3lib_extMgm::isLoaded("tsconfig_help",1);
+                       // Check if the tsconfig_help extension is loaded - which is mandatory for this wizard to work.
+               t3lib_extMgm::isLoaded('tsconfig_help',1);
 
-               $this->P = t3lib_div::GPvar("P",1);
+                       // Init GPvars:
+               $this->P = t3lib_div::_GP('P');
+               $this->mode = t3lib_div::_GP('mode');
+               $this->show = t3lib_div::_GP('show');
+               $this->objString = t3lib_div::_GP('objString');
+               $this->onlyProperty = t3lib_div::_GP('onlyProperty');
 
-               if (!is_array($this->P["fieldChangeFunc"]))     $this->P["fieldChangeFunc"]=array();
-               unset($this->P["fieldChangeFunc"]["alert"]);
-               reset($this->P["fieldChangeFunc"]);
-               $update="";
-               while(list($k,$v)=each($this->P["fieldChangeFunc"]))    {
-                       $update.= "
-                       window.opener.".$v;
+                       // Preparing some JavaScript code:
+               if (!is_array($this->P['fieldChangeFunc']))     $this->P['fieldChangeFunc']=array();
+               unset($this->P['fieldChangeFunc']['alert']);
+               reset($this->P['fieldChangeFunc']);
+               $update='';
+               while(list($k,$v)=each($this->P['fieldChangeFunc']))    {
+                       $update.= '
+                       window.opener.'.$v;
                }
-               
-               
-               $this->doc = t3lib_div::makeInstance("mediumDoc");
+
+                       // Init the document table object:
+               $this->doc = t3lib_div::makeInstance('mediumDoc');
+               $this->doc->docType = 'xhtml_trans';
                $this->doc->backPath = $BACK_PATH;
                $this->doc->form='<form action="" name="editform">';
-               $this->doc->JScode='
-               <style>
+
+                       // Adding Styles (should go into stylesheet?)
+               $this->doc->inDocStylesArray[] = '
                        A:link {text-decoration: bold; color: '.$this->doc->hoverColor.';}
                        A:visited {text-decoration: bold; color: '.$this->doc->hoverColor.';}
                        A:active {text-decoration: bold; color: '.$this->doc->hoverColor.';}
                        A:hover {color: '.$this->doc->bgColor2.'}
-               </style>
-               <script language="javascript" type="text/javascript">
-                       function checkReference()       {
-                               if (window.opener && window.opener.document && window.opener.document.'.$this->P["formName"].' && window.opener.document.'.$this->P["formName"].'["'.$this->P["itemName"].'"] ) {
-                                       return window.opener.document.'.$this->P["formName"].'["'.$this->P["itemName"].'"];
+               ';
+
+               $this->doc->JScode.=$this->doc->wrapScriptTags('
+                       function checkReference()       {       //
+                               if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
+                                       return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
                                } else {
                                        close();
                                }
                        }
-                       function setValue(input)        {
+                       function setValue(input)        {       //
                                var field = checkReference();
                                if (field)      {
                                        field.value=input+"\n"+field.value;
@@ -105,11 +196,11 @@ class SC_wizard_tsconfig {
                                }
                                close();
                        }
-                       function getValue()     {
+                       function getValue()     {       //
                                var field = checkReference();
                                if (field)      return field.value;
                        }
-                       function mixerField(cmd,objString)      {
+                       function mixerField(cmd,objString)      {       //
                                var temp;
                                switch(cmd)     {
                                        case "Indent":
@@ -128,7 +219,7 @@ class SC_wizard_tsconfig {
                                        break;
                                }
                        }
-                       function str_replace(match,replace,string)      {
+                       function str_replace(match,replace,string)      {       //
                                var input = ""+string;
                                var matchStr = ""+match;
                                if (!matchStr)  {return string;}
@@ -143,221 +234,365 @@ class SC_wizard_tsconfig {
                                output+=""+input.substr(pointer);
                                return output;
                        }
-                       function jump(show,objString)   {
-                               document.location = "'.t3lib_div::linkThisScript(array("show"=>"","objString"=>"")).'&show="+show+"&objString="+objString;
+                       function jump(show,objString)   {       //
+                               document.location = "'.t3lib_div::linkThisScript(array('show'=>'','objString'=>'')).'&show="+show+"&objString="+objString;
                        }
-               </script>
-               ';
-               
-               
-               $this->content.=$this->doc->startPage($LANG->getLL("tsprop"));
-               $this->mode = t3lib_div::GPvar("mode");
-               $this->show = t3lib_div::GPvar("show");
+               ');
+
+
+                       // Start the page:
+               $this->content.=$this->doc->startPage($LANG->getLL('tsprop'));
        }
+
+       /**
+        * Main function, rendering the content of the TypoScript property browser, including links to online resources
+        *
+        * @return      void
+        */
        function main() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
+               global $LANG;
+
+                       // Adding module content:
+               $this->content.=$this->doc->section($LANG->getLL('tsprop'),$this->browseTSprop($this->mode,$this->show),0,1);
 
-               $this->content.=$this->doc->section($LANG->getLL("tsprop"),$this->browseTSprop($this->mode,$this->show),0,1);
-               if ($this->mode=="tsref")       {
-                       $this->content.=$this->doc->section($LANG->getLL("tsprop_TSref"),'
-                       <a href="'.$BACK_PATH.t3lib_extMgm::extRelPath("tsconfig_help").'man/TSref.html">'.$LANG->getLL("tsprop_localHTML").'</a><BR>
-                       <a href="http://www.typo3.com/doclink.php?doc=tsref" target="_blank">'.$LANG->getLL("tsprop_pdf").'</a>
+                       // Adding link to TSref:
+               if ($this->mode=='tsref')       {
+                       $this->content.=$this->doc->section($LANG->getLL('tsprop_TSref'),'
+                       <a href="'.htmlspecialchars('http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4').'" target="_blank">'.$LANG->getLL('tsprop_TSref',1).'</a>
                        ',0,1);
                }
-               if ($this->mode=="page" || $this->mode=="beuser")       {
-                       $this->content.=$this->doc->section($LANG->getLL("tsprop_adminguide"),'
-                       <a href="'.$BACK_PATH.t3lib_extMgm::extRelPath("tsconfig_help").'man/adminguide.html">'.$LANG->getLL("tsprop_localHTML").'</a><BR>
-                       <a href="http://www.typo3.com/doclink.php?doc=adminguide" target="_blank">'.$LANG->getLL("tsprop_pdf").'</a>
+                       // Adding link to admin guides etc:
+               if ($this->mode=='page' || $this->mode=='beuser')       {
+                       $this->content.=$this->doc->section($LANG->getLL('tsprop_tsconfig'),'
+                       <a href="'.htmlspecialchars('http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=263&cHash=1f1b106a30').'" target="_blank">'.$LANG->getLL('tsprop_tsconfig',1).'</a>
                        ',0,1);
                }
+                       // Ending page:
+               $this->content.=$this->doc->endPage();
        }
-       function printContent() {
-               global $SOBE;
 
-               $this->content.=$this->doc->endPage();
+       /**
+        * Outputting the accumulated content to screen
+        *
+        * @return      void
+        */
+       function printContent() {
                echo $this->content;
        }
-       
-       // ***************************
-       // OTHER FUNCTIONS:     
-       // ***************************
-       function revertFromSpecialChars($str)   {
-               $str = str_replace("&gt;",">",$str);
-               $str = str_replace("&lt;","<",$str);
-               return $str;
+
+       /**
+        * Create the content of the module:
+        *
+        * @param       string          Object string
+        * @param       integer         Pointing to an entry in static_tsconfig_help to show.
+        * @return      string          HTML
+        */
+       function browseTSprop($mode,$show)      {
+               global $LANG;
+
+                       // Get object tree:
+               $objTree = $this->getObjTree();
+
+                       // Show single element, if show is set.
+               $out='';
+               if ($show)      {
+                               // Get the entry data:
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_tsconfig_help', 'uid='.intval($show));
+                       $rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
+                       $table = unserialize($rec['appdata']);
+                       $obj_string = strtr($this->objString,'()','[]');        // Title:
+
+                               // Title and description:
+                       $out.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>''))).'" class="typo3-goBack">'.
+                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'.
+                                       htmlspecialchars($obj_string).
+                                       '</a><br />';
+                       if ($rec['title'])      $out.= '<strong>'.htmlspecialchars($rec['title']).': </strong>';
+                       if ($rec['description'])        $out.= nl2br(htmlspecialchars(trim($rec['description']))).'<br />';
+
+                               // Printing the content:
+                       $out.= '<br />'.$this->printTable($table, $obj_string, $objTree[$mode.'.']);
+                       $out.='<hr />';
+
+                               // Printing the "mixer-field":
+                       if (!$this->onlyProperty)       {
+                               $links=array();
+                               $links[]='<a href="#" onclick="mixerField(\'Indent\');return false;">'.$LANG->getLL('tsprop_mixer_indent',1).'</a>';
+                               $links[]='<a href="#" onclick="mixerField(\'Outdent\');return false;">'.$LANG->getLL('tsprop_mixer_outdent',1).'</a>';
+                               $links[]='<a href="#" onclick="mixerField(\'Wrap\',unescape(\''.rawurlencode($obj_string).'\'));return false;">'.$LANG->getLL('tsprop_mixer_wrap',1).'</a>';
+                               $links[]='<a href="#" onclick="mixerField(\'Transfer\');return false;">'.$LANG->getLL('tsprop_mixer_transfer',1).'</a>';
+                               $out.='<textarea rows="5" name="mixer" wrap="off"'.$this->doc->formWidthText(48,'','off').'></textarea>';
+                               $out.='<br /><strong>'.implode('&nbsp; | &nbsp;',$links).'</strong>';
+                               $out.='<hr />';
+                       }
+               }
+
+
+                       // SECTION: Showing property tree:
+               $tmpl = t3lib_div::makeInstance('ext_TSparser');
+               $tmpl->tt_track = 0;    // Do not log time-performance information
+               $tmpl->fixedLgd=0;
+               $tmpl->linkObjects=0;
+               $tmpl->bType='';
+               $tmpl->ext_expandAllNotes=1;
+               $tmpl->ext_noPMicons=1;
+               $tmpl->ext_noSpecialCharsOnLabels=1;
+
+               if (is_array($objTree[$mode.'.']))      {
+                       $out.='
+
+
+                       <!--
+                               TSconfig, object tree:
+                       -->
+                               <table border="0" cellpadding="0" cellspacing="0" id="typo3-objtree">
+                                       <tr>
+                                               <td nowrap="nowrap">'.$tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode.'.']),'','').'</td>
+                                       </tr>
+                               </table>';
+               }
+
+               return $out;
        }
-       function getObjTree($whichman="")       {
-               $hash = md5("WIZARD_TSCONFIG-objTree");
-       
-               $query="SELECT uid,obj_string,title FROM static_tsconfig_help".($whichman?" WHERE guide='".addslashes($whichman)."'":"");
-               $res = mysql(TYPO3_db,$query);
+
+
+
+
+
+
+
+       /***************************
+        *
+        * Module functions
+        *
+        ***************************/
+
+       /**
+        * Create object tree from static_tsconfig_help table
+        *
+        * @return      array           Object tree.
+        * @access private
+        */
+       function getObjTree()   {
+               $hash = md5('WIZARD_TSCONFIG-objTree');
                $objTree=array();
-               while($rec=mysql_fetch_assoc($res))     {
-                       $rec["obj_string"] = $this->revertFromSpecialChars($rec["obj_string"]);
-                       $p = explode(";",$rec["obj_string"]);
+
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,obj_string,title', 'static_tsconfig_help', '');
+               while($rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
+                       $rec['obj_string'] = $this->revertFromSpecialChars($rec['obj_string']);
+                       $p = explode(';',$rec['obj_string']);
                        while(list(,$v)=each($p))       {
-                               $p2 = t3lib_div::trimExplode(":",$v,1);
-                               $subp=t3lib_div::trimExplode("/",$p2[1],1);
+                               $p2 = t3lib_div::trimExplode(':',$v,1);
+                               $subp=t3lib_div::trimExplode('/',$p2[1],1);
                                while(list(,$v2)=each($subp))   {
-                                       $this->setObj($objTree,explode(".",$p2[0].".".$v2),array($rec,$v2));
+                                       $this->setObj($objTree,explode('.',$p2[0].'.'.$v2),array($rec,$v2));
                                }
                        }
                }
                return $objTree;
        }
+
+       /**
+        * Sets the information from a static_tsconfig_help record in the object array.
+        * Makes recursive calls.
+        *
+        * @param       array           Object tree array, passed by value!
+        * @param       array           Array of elements from object path (?)
+        * @param       array           Array with record and something else (?)
+        * @return      void
+        * @access private
+        * @see getObjTree()
+        */
        function setObj(&$objTree,$strArr,$params)      {
                $key = current($strArr);
                reset($strArr);
                if (count($strArr)>1)   {
                        array_shift($strArr);
-                       if (!isset($objTree[$key."."])) $objTree[$key."."]=array();
-                       $this->setObj($objTree[$key."."],$strArr,$params);
+                       if (!isset($objTree[$key.'.'])) $objTree[$key.'.']=array();
+                       $this->setObj($objTree[$key.'.'],$strArr,$params);
                } else {
                        $objTree[$key]=$params;
-                       $objTree[$key]["_LINK"]=$this->doLink($params);
+                       $objTree[$key]['_LINK']=$this->doLink($params);
                }
        }
-       function doLink($params)        {
-               $title = htmlspecialchars(trim($params[0]["title"])?trim($params[0]["title"]):"[GO]");
-               $str = $this->linkToObj($title,$params[0]["uid"],$params[1]);
+
+       /**
+        * Converts &gt; and &lt; to > and <
+        *
+        * @param       string          Input string
+        * @return      string          Output string
+        * @access private
+        */
+       function revertFromSpecialChars($str)   {
+               $str = str_replace('&gt;','>',$str);
+               $str = str_replace('&lt;','<',$str);
                return $str;
        }
-       function browseTSprop($mode,$show)      {
-                       $whichman="adminguide";
-                       
-                       $objTree = $this->getObjTree("");
-                       $out="";
-                       if ($show)      {
-                               $query="SELECT * FROM static_tsconfig_help WHERE uid='".intval($show)."'";
-                               $res = mysql(TYPO3_db,$query);
-                               $rec=mysql_fetch_assoc($res);
-                               $table = unserialize($rec["appdata"]);
-                               $obj_string = strtr(t3lib_div::GPvar("objString"),"()","[]");
-                               
-                               $out.='<a href="'.t3lib_div::linkThisScript(array("show"=>"")).'" class="typo3-goBack"><img src="gfx/goback.gif" width="14" height="14" hspace=2 border="0" align=top>';
-                               $out.= '<font size=2 color="black"><strong>'.$obj_string.'</strong></font></a><BR>';
-                               if ($rec["title"])      $out.= '<strong>'.$rec["title"].': </strong>';
-                               if ($rec["description"])        $out.= nl2br(trim($rec["description"])).'<BR>';
-                               
-                               $out.= '<BR>'.$this->printTable($table, $obj_string, $objTree[$mode."."]);
-                               $out.="<HR>";
-               
-                               if (!t3lib_div::GPvar("onlyProperty"))  {
-                                       $links=array();
-                                       $links[]='<a href="#" onClick="mixerField(\'Indent\');return false;">Indent +2</a>';
-                                       $links[]='<a href="#" onClick="mixerField(\'Outdent\');return false;">Outdent -2</a>';
-                                       $links[]='<a href="#" onClick="mixerField(\'Wrap\',unescape(\''.rawurlencode($obj_string).'\'));return false;">Wrap</a>';
-                                       $links[]='<a href="#" onClick="mixerField(\'Transfer\');return false;">Transfer & Close</a>';
-                                       $out.='<textarea rows="5" name="mixer" wrap="off"'.$this->doc->formWidthText(48,"","off").'></textarea>';
-                                       $out.='<BR><strong>'.implode("&nbsp; | &nbsp;",$links).'</strong>';
-                                       $out.="<HR>";
-                               }
-                       } 
-               
-                       $tmpl = t3lib_div::makeInstance("ext_TSparser");
-                       $tmpl->tt_track = 0;    // Do not log time-performance information
-                       $tmpl->fixedLgd=0;
-                       $tmpl->linkObjects=0;
-                       $tmpl->bType="";
-                       $tmpl->ext_expandAllNotes=1;
-                       $tmpl->ext_noPMicons=1;
-                       $tmpl->ext_noSpecialCharsOnLabels=1;
-               
-                       if (is_array($objTree[$mode."."]))      {
-                               $out.='<table border=0 cellpadding=0 cellspacing=0><tr><td nowrap>'.$tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode."."]),"","").'</td></tr></table>';
-                       }
-               return $out;
+
+       /**
+        * Creates a link based on input params array:
+        *
+        * @param       array           Parameters
+        * @return      string          The link.
+        * @access private
+        */
+       function doLink($params)        {
+               $title = trim($params[0]['title'])?trim($params[0]['title']):'[GO]';
+               $str = $this->linkToObj($title,$params[0]['uid'],$params[1]);
+               return $str;
        }
+
+       /**
+        * Remove pointer strings from an array
+        *
+        * @param       array           Input array
+        * @return      array           Modified input array
+        * @access private
+        */
        function removePointerObjects($objArray)        {
                reset($objArray);
                while(list($k)=each($objArray)) {
-                       if (substr(trim($k),0,2)=="->" && trim($k)!="->.")      {
-                               $objArray["->."][substr(trim($k),2)]=$objArray[$k];
+                       if (substr(trim($k),0,2)=="->" && trim($k)!='->.')      {
+                               $objArray['->.'][substr(trim($k),2)]=$objArray[$k];
                                unset($objArray[$k]);
                        }
                }
-       //      debug($objArray);
                return $objArray;
        }
-       function linkToObj($str,$uid,$objString="")     {
-               return '<a href="#" onClick="jump(\''.rawurlencode($uid).'\',\''.rawurlencode($objString).'\');return false;">'.$str.'</a>';
+
+       /**
+        * Linking string to object by UID
+        *
+        * @param       string          String to link
+        * @param       integer         UID of a static_tsconfig_help record.
+        * @param       string          Title string for that record!
+        * @return      string          Linked string
+        */
+       function linkToObj($str,$uid,$objString='')     {
+               $aOnClick='jump(\''.rawurlencode($uid).'\',\''.rawurlencode($objString).'\');return false;';
+               return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.htmlspecialchars($str).'</a>';
        }
+
+       /**
+        * Creates a table of properties:
+        *
+        * @param       array           Array with properties for the current object path
+        * @param       string          Object path
+        * @param       array           Object tree
+        * @return      string          HTML content.
+        */
        function printTable($table,$objString,$objTree) {
-               if (is_array($table["rows"]))   {
+               if (is_array($table['rows']))   {
+
+                               // Initialize:
                        $lines=array();
-       
-                               $lines[]='<tr>
-                                               <td><img src=clear.gif width=175 height=1></td>
-                                               <td><img src=clear.gif width=100 height=1></td>
-                                               <td><img src=clear.gif width=400 height=1></td>
-                                               <td><img src=clear.gif width=70 height=1></td>
-                                       </tr>';
-                               $lines[]='<tr bgcolor="'.$this->doc->bgColor5.'">
-                                               <td><strong>Property:</strong></td>
-                                               <td><strong>Data type:</strong></td>
-                                               <td><strong>Description:</strong></td>
-                                               <td><strong>Default:</strong></td>
-                                       </tr>';
-       
-                                       
-                       reset($table["rows"]);
-                       while(list(,$row)=each($table["rows"])) {
+
+                               // Adding header:
+                       $lines[]='
+                               <tr>
+                                       <td><img src="clear.gif" width="175" height="1" alt="" /></td>
+                                       <td><img src="clear.gif" width="100" height="1" alt="" /></td>
+                                       <td><img src="clear.gif" width="400" height="1" alt="" /></td>
+                                       <td><img src="clear.gif" width="70" height="1" alt="" /></td>
+                               </tr>';
+                       $lines[]='
+                               <tr class="bgColor5">
+                                       <td><strong>Property:</strong></td>
+                                       <td><strong>Data type:</strong></td>
+                                       <td><strong>Description:</strong></td>
+                                       <td><strong>Default:</strong></td>
+                               </tr>';
+
+                               // Traverse the content of "rows":
+                       foreach($table['rows'] as $row) {
+
                                        // Linking:
-                               $lP=t3lib_div::trimExplode(chr(10),$row["property"],1);
+                               $lP=t3lib_div::trimExplode(chr(10),$row['property'],1);
                                $lP2=array();
                                while(list($k,$lStr)=each($lP)) {
-                                       $lP2[$k] = $this->linkProperty($lStr,$lStr,$objString,$row["datatype"]);
+                                       $lP2[$k] = $this->linkProperty($lStr,$lStr,$objString,$row['datatype']);
                                }
-                               $linkedProperties=implode("<HR>",$lP2);
-                               
+                               $linkedProperties=implode('<hr />',$lP2);
+
                                        // Data type:
-#                              $dataType = $this->revertFromSpecialChars($row["datatype"]);                    // 260902: Removed because it make HTML-tags back to HTML tags - while they should stay non-tags (eg imgs)
-                               $dataType = $row["datatype"];
-                                       
+                               $dataType = $row['datatype'];
+
                                        // Generally "->[something]"
                                $reg=array();
-                               ereg("->[[:alnum:]_]*",$dataType,$reg);
+                               ereg('->[[:alnum:]_]*',$dataType,$reg);
                                if ($reg[0] && is_array($objTree[$reg[0]]))     {
-       //                              debug($objTree[$reg[0]]);
-                                       $dataType = str_replace($reg[0],'<a href="'.t3lib_div::linkThisScript(array("show"=>$objTree[$reg[0]][0]["uid"],"objString"=>$objString.".".$lP[0])).'">'.$reg[0].'</a>',$dataType);
+                                       $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);
                                }
+
                                        // stdWrap
-                               if (!strstr($dataType,"->stdWrap") && strstr(strip_tags($dataType),"stdWrap"))  {
+                               if (!strstr($dataType,'->stdWrap') && strstr(strip_tags($dataType),'stdWrap'))  {
                                                // 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?
-                                       $dataType = str_replace("stdWrap",'<a href="'.t3lib_div::linkThisScript(array("show"=>$objTree["->stdWrap"][0]["uid"],"objString"=>$objString.".".$lP[0])).'">stdWrap</a>',$dataType);
+                                       $dataType = str_replace('stdWrap','<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree['->stdWrap'][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">stdWrap</a>',$dataType);
                                }
-       
-                       
-                               $lines[]='<tr bgColor="'.$GLOBALS["TBE_TEMPLATE"]->bgColor4.'">
-                                       <td valign=top bgColor="'.t3lib_div::modifyHtmlColor($GLOBALS["TBE_TEMPLATE"]->bgColor4,-20,-20,-20).'"><strong>'.$linkedProperties.'</strong></td>
-                                       <td valign=top>'.nl2br($dataType."&nbsp;").'</td>
-                                       <td valign=top>'.nl2br($row["description"]).'</td>
-                                       <td valign=top>'.nl2br($row["default"]).'</td>
+
+
+                               $lines[]='
+                                       <tr class="bgColor4">
+                                               <td valign="top" class="bgColor4-20"><strong>'.$linkedProperties.'</strong></td>
+                                               <td valign="top">'.nl2br($dataType.'&nbsp;').'</td>
+                                               <td valign="top">'.nl2br($row['description']).'</td>
+                                               <td valign="top">'.nl2br($row['default']).'</td>
                                        </tr>';
                        }
-                       return '<table border=0 cellpadding=0 cellspacing=1 width=500>'.implode("",$lines).'</table>';
+                               // Return it all:
+                       return '
+
+
+
+                       <!--
+                               TSconfig, attribute selector:
+                       -->
+                               <table border="0" cellpadding="0" cellspacing="1" width="500" id="typo3-attributes">
+                                       '.implode('',$lines).'
+                               </table>';
                }
        }
+
+       /**
+        * Creates a link on a property.
+        *
+        * @param       string          String to link
+        * @param       string          Property value.
+        * @param       string          Object path prefix to value
+        * @param       string          Data type
+        * @return      string          Linked $str
+        */
        function linkProperty($str,$propertyVal,$prefix,$datatype)      {
-               $out="";
-               if (strstr($datatype,"boolean"))        {
-                       $propertyVal.="=1";     // add preset "=1" to boolean values.
+               $out='';
+
+                       // Setting preset value:
+               if (strstr($datatype,'boolean'))        {
+                       $propertyVal.='=1';     // add preset "=1" to boolean values.
                } else {
-                       $propertyVal.="=";      // add preset "="
+                       $propertyVal.='=';      // add preset "="
                }
-       
-               if(!t3lib_div::GPvar("onlyProperty"))   {
-                       $out.= '<a href="#" onClick="document.editform.mixer.value=unescape(\'  '.rawurlencode($propertyVal).'\')+\'\n\'+document.editform.mixer.value; return false;"><img src="gfx/plusbullet2.gif" width="18" height="16" border="0" title="Add to list..." align=top></a>';
-                       $propertyVal = $prefix.".".$propertyVal;
+
+                       // Adding mixer features; The plus icon:
+               if(!$this->onlyProperty)        {
+                       $aOnClick = 'document.editform.mixer.value=unescape(\'  '.rawurlencode($propertyVal).'\')+\'\n\'+document.editform.mixer.value; return false;';
+                       $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
+                                       '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('tsprop_addToList',1).'" align="top" alt="" />'.
+                                       '</a>';
+                       $propertyVal = $prefix.'.'.$propertyVal;
                }
-               $out.= '<a href="#" onClick="setValue(unescape(\''.rawurlencode($propertyVal).'\')); return false;">'.$str.'</a>';
+
+                       // Wrap string:
+               $aOnClick = 'setValue(unescape(\''.rawurlencode($propertyVal).'\')); return false;';
+               $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
+
+                       // Return link:
                return $out;
        }
 }
 
 // Include extension?
-if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizard_tsconfig.php"])      {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizard_tsconfig.php"]);
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_tsconfig.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_tsconfig.php']);
 }
 
 
@@ -372,7 +607,7 @@ if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizar
 
 
 // Make instance:
-$SOBE = t3lib_div::makeInstance("SC_wizard_tsconfig");
+$SOBE = t3lib_div::makeInstance('SC_wizard_tsconfig');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();