* Finally fixed typo3/show_item.php and typo3/wizard_colorpicker.php scripts for...
authorKasper Skårhøj <kasper@typo3.org>
Wed, 19 May 2004 15:23:57 +0000 (15:23 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Wed, 19 May 2004 15:23:57 +0000 (15:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@313 709f56b5-9817-0410-a4d7-c38de5d9e867

16 files changed:
ChangeLog
TODO.txt
t3lib/class.t3lib_div.php
t3lib/class.t3lib_stdgraphic.php
t3lib/class.t3lib_superadmin.php
t3lib/class.t3lib_tceforms.php
t3lib/gfx/wizard_colorpickerex.jpg [new file with mode: 0644]
typo3/browse_links.php
typo3/mod/tools/em/index.php
typo3/show_item.php
typo3/stylesheet.css
typo3/sysext/README.txt
typo3/sysext/lang/locallang_core.php
typo3/sysext/lang/locallang_wizards.php
typo3/wizard_add.php
typo3/wizard_colorpicker.php

index 2f116e1..02e5296 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-05-19  Kasper Skårhøj,,,  <kasper@typo3.com>
+
+       * Finally fixed typo3/show_item.php and typo3/wizard_colorpicker.php scripts for TYPO3 3.6.0 compliance. Now only extensions and some t3lib/ are missing clean-up.
+
 2004-05-18  Kasper Skårhøj,,,  <kasper@typo3.com>
        * Added t3lib_cs::specCharsToASCII() for converting special chars (like umlauts) to their double-byte alternatives in ASCII (like au, oe etc...). Function is NOT finished at all, only added so I could use it for the conversion of filenames in simulateStaticDocuments.
        * TypoScript charset compatibility extended: tslib_cObj::caseshift(), tslib_cObj::substring(), tslib_cObj::crop() uses functions in t3lib_cs now. Also stdWrap.strftime will automatically convert localized string from locale charset (guessed by t3lib_cs) to renderCharset.
index 0f9aaf9..eff8942 100755 (executable)
--- a/TODO.txt
+++ b/TODO.txt
@@ -327,7 +327,7 @@ XQCR: t3lib/class.t3lib_clipboard.php
 -QC-: t3lib/class.t3lib_cs.php
 XQCR: t3lib/class.t3lib_diff.php
 XQCR: t3lib/class.t3lib_div.php
-               t3lib/class.t3lib_dmailer.php   [Pekue?]
+               t3lib/class.t3lib_dmailer.php   [Jan-Erik?]
                t3lib/class.t3lib_exec.php              [Rene]
                t3lib/class.t3lib_extfilefunc.php
 -QCR: t3lib/class.t3lib_extmgm.php
@@ -335,7 +335,7 @@ XQCR: t3lib/class.t3lib_div.php
 XQCR: t3lib/class.t3lib_foldertree.php
 -QCR: t3lib/class.t3lib_formmail.php
                t3lib/class.t3lib_fullsearch.php
-               t3lib/class.t3lib_htmlmail.php  [Pekue?]
+               t3lib/class.t3lib_htmlmail.php  [Jan-Erik?]
 XQCR: t3lib/class.t3lib_iconworks.php
                t3lib/class.t3lib_install.php
 -QCR: t3lib/class.t3lib_loaddbgroup.php
@@ -457,14 +457,14 @@ XQCR: listframe_loader.php
 XQCR: login_frameset.php
 -QC-: logout.php               TODO: Check "redirect" GPvar for XSS hole!?
 XQCR: move_el.php
-               show_item.php                           [Peter Kuehn]
+XQCR: show_item.php
 XQCR: show_rechis.php
 -QCR: tce_db.php
 -QCR: tce_file.php
 XQCR: template.php
 XQCR: view_help.php
 XQCR: wizard_add.php
-               wizard_colorpicker.php          [Matthias]
+XQCR: wizard_colorpicker.php
 XQCR: wizard_edit.php
 XQCR: wizard_forms.php
 XQCR: wizard_list.php
@@ -479,6 +479,11 @@ XQCR: mod/web/func/index.php
 XQCR: mod/web/perm/index.php
 
 
+typo3/sysext/___________________________________________:
+               install/        [ingmar]
+OK             cms/
+OK             lang/
+
 typo3/ext/_____________________________________:
 OK             aboutmodules/
                belog/          (2 / 500)
@@ -487,7 +492,7 @@ OK          aboutmodules/
 OK             conf_userts/
 OK             context_help/
                css_styled_content/             (1/200)         [H]
-               direct_mail/            (3/2500)                [Peter Kuehn] + class.t3lib_htmlmail.php
+               direct_mail/            (3/2500)                [Jan-Erik] + class.t3lib_htmlmail.php
 OK             direct_mail_subscription/
 XQCR:  extra_page_cm_options/
                extrep_wizard/          (2/4500)                [H]
index c9112f1..af4f06e 100755 (executable)
@@ -2291,13 +2291,13 @@ class t3lib_div {
        function view_array($array_in)  {
                if (is_array($array_in))        {
                        $result='<table border="1" cellpadding="1" cellspacing="0" bgcolor="white">';
-                       if (!count($array_in))  {$result.= '<tr><td><font face="Verdana,Arial" size="1"><b>'.HTMLSpecialChars("EMPTY!").'</b></font></td></tr>';}
+                       if (!count($array_in))  {$result.= '<tr><td><font face="Verdana,Arial" size="1"><b>'.htmlspecialchars("EMPTY!").'</b></font></td></tr>';}
                        while (list($key,$val)=each($array_in)) {
-                               $result.= '<tr><td><font face="Verdana,Arial" size="1">'.HTMLSpecialChars((string)$key).'</font></td><td>';
+                               $result.= '<tr><td><font face="Verdana,Arial" size="1">'.htmlspecialchars((string)$key).'</font></td><td>';
                                if (is_array($array_in[$key]))  {
                                        $result.=t3lib_div::view_array($array_in[$key]);
                                } else
-                                       $result.= '<font face="Verdana,Arial" size="1" color="red">'.nl2br(HTMLSpecialChars((string)$val)).'<br /></font>';
+                                       $result.= '<font face="Verdana,Arial" size="1" color="red">'.nl2br(htmlspecialchars((string)$val)).'<br /></font>';
                                $result.= '</td></tr>';
                        }
                        $result.= '</table>';
@@ -2334,7 +2334,7 @@ class t3lib_div {
         */
        function debug($var="",$brOrHeader=0)   {
                if ($brOrHeader && !t3lib_div::testInt($brOrHeader)) {
-                       echo '<table border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px;margin-top:3px;margin-bottom:3px;"><tr><td bgcolor="#bbbbbb"><font face="Verdana,Arial" size="1">&nbsp;<b>'.(string)HTMLSpecialChars($brOrHeader).'</b></font></td></tr><td>';
+                       echo '<table border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px; margin-top:3px; margin-bottom:3px;"><tr><td style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;">'.htmlspecialchars((string)$brOrHeader).'</td></tr><td>';
                } elseif ($brOrHeader<0) {
                        for($a=0;$a<abs(intval($brOrHeader));$a++){echo '<br />';}
                }
@@ -2346,7 +2346,7 @@ class t3lib_div {
                        print_r($var);
                        echo '</pre>|</b>';
                } elseif ((string)$var!='') {
-                       echo '<b>|'.HTMLSpecialChars((string)$var).'|</b>';
+                       echo '<b>|'.htmlspecialchars((string)$var).'|</b>';
                } else {
                        echo '<b>| debug |</b>';
                }
index 536d740..096f160 100644 (file)
@@ -1847,7 +1847,7 @@ class t3lib_stdGraphic    {
                                } else {
                                        $returnArr = $this->imageMagickIdentify($imageFile);
                                }
-                               if($returnArr) {
+                               if ($returnArr) {
                                        $this->cacheImageDimensions($returnArr);
                                        return $returnArr;
                                }
index 9eaa1d7..cefb594 100755 (executable)
@@ -220,19 +220,21 @@ class t3lib_superadmin {
                        break;
                        case 'page':
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<style type="text/css">
-       .redclass {color: red;}
-       P {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
-       BODY {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
-       H1 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; color: #000066;}
-       H2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 17px; color: #000066;}
-       H3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #000066;}
-       H4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: maroon;}
-       TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
-</style>
+<!DOCTYPE html
+     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
+       <style type="text/css">
+               .redclass {color: red;}
+               P {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
+               BODY {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
+               H1 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; color: #000066;}
+               H2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 17px; color: #000066;}
+               H3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #000066;}
+               H4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: maroon;}
+               TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
+       </style>
        <title>TYPO3 Super Admin</title>
 </head>
 <body>
@@ -277,11 +279,11 @@ class t3lib_superadmin {
                                $lines[]=$this->setMenuItem('info','INFO');
                                $lines[]=$this->setMenuItem('update','UPDATE');
                                $lines[]='';
-                               $lines[]='<a href="'.$this->scriptName.'?type=page" target="TSApage">Default</a>';
-                               $lines[]='<a href="'.$this->scriptName.'?type=page&show=all" target="TSApage">All details</a>';
-                               $lines[]='<a href="'.$this->scriptName.'?type=page&show=admin" target="TSApage">Admin logins</a>';
-                               $lines[]='<a href="'.$this->scriptName.'?type=phpinfo" target="TSApage">phpinfo()</a>';
-                               $lines[]='<a href="'.$this->scriptName.'?type=page&show=localext" target="TSApage">Local extensions</a>';
+                               $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page').'" target="TSApage">Default</a>';
+                               $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=all').'" target="TSApage">All details</a>';
+                               $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=admin').'" target="TSApage">Admin logins</a>';
+                               $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=phpinfo').'" target="TSApage">phpinfo()</a>';
+                               $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=localext').'" target="TSApage">Local extensions</a>';
                                $lines[]='';
                                $content = implode('<br />',$lines);
                                $content.= '<hr />';
index 91e60f1..9eb629c 100755 (executable)
@@ -2280,6 +2280,7 @@ class t3lib_TCEforms      {
                                                        if (!$wConf['notNewRecords'] || t3lib_div::testInt($row['uid']))        {
                                                                $params = array();
                                                                $params['params'] = $wConf['params'];
+                                                               $params['exampleImg'] = $wConf['exampleImg'];
                                                                $params['table'] = $table;
                                                                $params['uid'] = $row['uid'];
                                                                $params['pid'] = $row['pid'];
diff --git a/t3lib/gfx/wizard_colorpickerex.jpg b/t3lib/gfx/wizard_colorpickerex.jpg
new file mode 100644 (file)
index 0000000..a4dedcd
Binary files /dev/null and b/t3lib/gfx/wizard_colorpickerex.jpg differ
index 6a34dd2..47f853b 100755 (executable)
@@ -820,11 +820,11 @@ class SC_browse_links {
                                window.opener.'.$v;
                        }
 
-                       $P2=array();
-                       $P2['itemName']=$this->P['itemName'];
-                       $P2['formName']=$this->P['formName'];
-                       $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
-                       $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
+                       $P2 = array();
+                       $P2['itemName'] = $this->P['itemName'];
+                       $P2['formName'] = $this->P['formName'];
+                       $P2['fieldChangeFunc'] = $this->P['fieldChangeFunc'];
+                       $addPassOnParams.= t3lib_div::implodeArrayForUrl('P',$P2);
 
                        $JScode.='
                                function link_typo3Page(id,anchor)      {       //
index 6537959..f268f6f 100755 (executable)
@@ -1205,7 +1205,7 @@ EXTENSION KEYS:
                $content = '
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
-                                       <td nowrap="nowrap">Extension:&nbsp;<strong>'.$this->extensionTitleIconHeader($extKey,$list[$extKey],'absmiddle').'</strong> ('.$extKey.')</td>
+                                       <td nowrap="nowrap">Extension:&nbsp;<strong>'.$this->extensionTitleIconHeader($extKey,$list[$extKey]).'</strong> ('.$extKey.')</td>
                                        <td align="right" nowrap="nowrap">'.
                                                t3lib_BEfunc::getFuncMenu(0,'SET[singleDetails]',$this->MOD_SETTINGS['singleDetails'],$this->MOD_MENU['singleDetails'],'','&CMD[showExt]='.$extKey).' &nbsp; &nbsp; '.
                                                '<a href="index.php" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' class="absmiddle" alt="" /> Go back</a></td>
index f79c876..d2cead9 100755 (executable)
@@ -28,6 +28,7 @@
  * Shows information about a database or file item
  *
  * $Id$
+ * Revised for TYPO3 3.7 May/2004 by Kasper Skaarhoj
  *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  */
  *
  *
  *
- *   79: class transferData extends t3lib_transferData
- *   95:     function regItem($table, $id, $field, $content)
+ *   81: class transferData extends t3lib_transferData
+ *   98:     function regItem($table, $id, $field, $content)
  *
  *
- *  133: class SC_show_item
- *  151:     function init()
- *  220:     function main()
- *  348:     function printContent()
+ *  132: class SC_show_item
+ *  157:     function init()
+ *  224:     function main()
+ *  252:     function renderDBInfo()
+ *  300:     function renderFileInfo($returnLinkTag)
+ *  414:     function printContent()
  *
- * TOTAL FUNCTIONS: 4
+ * TOTAL FUNCTIONS: 6
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
 
-$BACK_PATH='';
-require ($BACK_PATH.'init.php');
-require ($BACK_PATH.'template.php');
-require_once (PATH_t3lib.'class.t3lib_page.php');
-require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
-require_once (PATH_t3lib.'class.t3lib_transferdata.php');
+$BACK_PATH = '';
+require($BACK_PATH.'init.php');
+require($BACK_PATH.'template.php');
+require_once(PATH_t3lib.'class.t3lib_page.php');
+require_once(PATH_t3lib.'class.t3lib_loaddbgroup.php');
+require_once(PATH_t3lib.'class.t3lib_transferdata.php');
 
 
 
@@ -77,6 +80,7 @@ require_once (PATH_t3lib.'class.t3lib_transferdata.php');
  * @subpackage core
  */
 class transferData extends t3lib_transferData  {
+
        var $formname = 'loadform';
        var $loading = 1;
 
@@ -86,11 +90,11 @@ class transferData extends t3lib_transferData       {
        /**
         * Register item function.
         *
-        * @param       [type]          $table: ...
-        * @param       [type]          $id: ...
-        * @param       [type]          $field: ...
-        * @param       [type]          $content: ...
-        * @return      [type]          ...
+        * @param       string          Table name
+        * @param       integer         Record uid
+        * @param       string          Field name
+        * @param       string          Content string.
+        * @return      void
         */
        function regItem($table, $id, $field, $content) {
                t3lib_div::loadTCA($table);
@@ -120,234 +124,296 @@ class transferData extends t3lib_transferData   {
 
 
 /**
- * Script Class
- *
- * GPvars:
- * $table      :               Record table (or filename)
- * $uid        :               Record uid  (or '' when filename)
+ * Script Class for showing information about an item.
  *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
 class SC_show_item {
-       var $include_once=array();
-       var $content;
-
-       var $perms_clause;
-       var $access;
-       var $pageinfo;
-       var $type;
-       var $file;
-       var $relPath;
-       var $row;
-       var $table;
-       var $uid;
-       var $doc;
+
+               // GET vars:
+       var $table;                     // Record table (or filename)
+       var $uid;                       // Record uid  (or '' when filename)
+
+               // Internal, static:
+       var $perms_clause;      // Page select clause
+       var $access;            // If true, access to element is granted
+       var $type;                      // Which type of element: "file" or "db"
+       var $doc;                       // Document Template Object
+
+               // Internal, dynamic:
+       var $content;           // Content Accumulation
+       var $file;                      // For type "file": Filename
+       var $pageinfo;          // For type "db": Set to page record of the parent page of the item set (if type="db")
+       var $row;                       // For type "db": The database record row.
+
 
        /**
-        * @return      [type]          ...
+        * Initialization of the class
+        * Will determine if table/uid GET vars are database record or a file and if the user has access to view information about the item.
+        *
+        * @return      void
         */
        function init() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
+               global $BE_USER,$LANG,$BACK_PATH,$TCA;
+
+                       // Setting input variables.
+               $this->table = t3lib_div::_GET('table');
+               $this->uid = t3lib_div::_GET('uid');
 
+                       // Initialize:
                $this->perms_clause = $BE_USER->getPagePermsClause(1);
-               $this->table = t3lib_div::_GP('table');
-               $this->uid = t3lib_div::_GP("uid");
+               $this->access = 0;      // Set to true if there is access to the record / file.
+               $this->type = '';       // Sets the type, "db" or "file". If blank, nothing can be shown.
 
-               $this->access=0;
-               $this->type="";
-               if (isset($TCA[$this->table]) && $BE_USER->check("tables_select",$this->table)) {
+                       // Checking if the $table value is really a table and if the user has access to it.
+               if (isset($TCA[$this->table]))  {
                        t3lib_div::loadTCA($this->table);
-                       $this->type="db";
-                       $this->uid=intval($this->uid);
-                       if ($this->uid) {
-                               if ((string)$this->table=="pages")      {
+                       $this->type = 'db';
+                       $this->uid = intval($this->uid);
+
+                               // Check permissions and uid value:
+                       if ($this->uid && $BE_USER->check('tables_select',$this->table))        {
+                               if ((string)$this->table=='pages')      {
                                        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->uid,$this->perms_clause);
                                        $this->access = is_array($this->pageinfo) ? 1 : 0;
-                                       $this->row=$this->pageinfo;
+                                       $this->row = $this->pageinfo;
                                } else {
-                                       $this->row=t3lib_BEfunc::getRecord ($this->table,$this->uid);
+                                       $this->row = t3lib_BEfunc::getRecord($this->table,$this->uid);
                                        if ($this->row) {
-                                               $this->pageinfo = t3lib_BEfunc::readPageAccess($this->row["pid"],$this->perms_clause);
+                                               $this->pageinfo = t3lib_BEfunc::readPageAccess($this->row['pid'],$this->perms_clause);
                                                $this->access = is_array($this->pageinfo) ? 1 : 0;
                                        }
                                }
 
-
-                               $treatData = t3lib_div::makeInstance("t3lib_transferData");
+                               $treatData = t3lib_div::makeInstance('t3lib_transferData');
                                $treatData->renderRecord($this->table, $this->uid, 0, $this->row);
                                $cRow = $treatData->theRecord;
                        }
                } else  {
                        // if the filereference $this->file is relative, we correct the path
-                       if (substr($this->table,0,3)=="../")    {
-                               $this->file = PATH_site.ereg_replace("^\.\./","",$this->table);
-                               $this->relPath=1;
+                       if (substr($this->table,0,3)=='../')    {
+                               $this->file = PATH_site.ereg_replace('^\.\./','',$this->table);
                        } else {
                                $this->file = $this->table;
-                               $this->relPath=0;
                        }
-                       if (@is_file($this->file))      {
-                               $this->type="file";
-                               $this->access=1;
+                       if (@is_file($this->file) && t3lib_div::isAllowedAbsPath($this->file))  {
+                               $this->type = 'file';
+                               $this->access = 1;
 
-                               $this->include_once[]=PATH_t3lib."class.t3lib_stdgraphic.php";
+                               require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
                        }
                }
 
-
-               $this->doc = t3lib_div::makeInstance("smallDoc");
+                       // Initialize document template object:
+               $this->doc = t3lib_div::makeInstance('smallDoc');
                $this->doc->backPath = $BACK_PATH;
-               $this->doc->tableLayout = Array (
-                       "defRow" => Array (
-                               "0" => Array('<TD valign="top">','</td>'),
-                               "defCol" => Array('<TD><img src="'.$this->backPath.'clear.gif" width=15 height=1></td><td valign="top">','</td>')
-                       )
-               );
+               $this->doc->docType = 'xhtml_trans';
 
-
-               $this->content.=$this->doc->startPage($LANG->sL("LLL:EXT:lang/locallang_core.php:show_item.php.viewItem"));
-               $this->content.=$this->doc->header($LANG->sL("LLL:EXT:lang/locallang_core.php:show_item.php.viewItem"));
+                       // Starting the page by creating page header stuff:
+               $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.viewItem'));
+               $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.viewItem'));
                $this->content.=$this->doc->spacer(5);
        }
 
        /**
-        * [Describe function...]
+        * Main function. Will generate the information to display for the item set internally.
         *
-        * @return      [type]          ...
+        * @return      void
         */
        function main() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
+               global $LANG;
 
                if ($this->access)      {
-                       $returnLinkTag = t3lib_div::_GP("returnUrl") ? '<a href="'.t3lib_div::_GP("returnUrl").'" class="typo3-goBack">' : '<a href="#" onClick="window.close();">';
-
-                       if ($this->type=="db")  {
-                               $code=$this->doc->getHeader($this->table,$this->row,$this->pageinfo["_thePath"],1).'<br />';
-                               $this->content.=$this->doc->section('',$code);
-
-                               $codeArr=Array();
-                               $i=0;
-
-                               $fieldList=explode(",",$TCA[$this->table]["interface"]["showRecordFieldList"]);
-                               while(list(,$name)=each($fieldList))    {
-                                       $name=trim($name);
-                                       if ($TCA[$this->table]["columns"][$name])       {
-                                               if (!$TCA[$this->table]["columns"][$name]["exclude"] || $GLOBALS["BE_USER"]->check("non_exclude_fields",$this->table.":".$name))        {
-                                                       $i++;
-                                                       $codeArr[$i][]=$LANG->sL(t3lib_BEfunc::getItemLabel($this->table,$name));
-                                                       $codeArr[$i][]=htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table,$name,$this->row[$name]));
-                                               }
-                                       }
-                               }
-                               $this->content.=$this->doc->section('',$this->doc->table($codeArr));
-                               $this->content.=$this->doc->divider(2);
+                       $returnLinkTag = t3lib_div::_GP('returnUrl') ? '<a href="'.t3lib_div::_GP('returnUrl').'" class="typo3-goBack">' : '<a href="#" onclick="window.close();">';
+
+                               // Branch out based on type:
+                       switch($this->type)     {
+                               case 'db':
+                                       $this->renderDBInfo();
+                               break;
+                               case 'file':
+                                       $this->renderFileInfo($returnLinkTag);
+                               break;
+                       }
 
-                               $code="";
-                               $code.='Path: '.t3lib_div::fixed_lgd_cs($this->pageinfo["_thePath"],-48).'<br />';
-                               $code.='Table: '.$LANG->sL($TCA[$this->table]["ctrl"]["title"]).' ('.$this->table.') - UID: '.$this->uid.'<br />';
-                               $this->content.=$this->doc->section('',$code);
+                               // If return Url is set, output link to go back:
+                       if (t3lib_div::_GP('returnUrl'))        {
+                               $this->content.= $this->doc->section('','<br />'.$returnLinkTag.'<strong>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack',1).'</strong></a>');
                        }
-                       if ($this->type=="file")        {
-                               $imgInfo="";
-
-                               $imgObj = t3lib_div::makeInstance("t3lib_stdGraphic");
-                               $imgObj->init();
-                               $imgObj->mayScaleUp=0;
-                               $imgObj->tempPath=PATH_site.$imgObj->tempPath;
-
-                               $imgInfo = $imgObj->getImageDimensions($this->file);
-
-                               $fI = t3lib_div::split_fileref($this->file);
-                               $ext = $fI["fileext"];
-               //              debug($fI);
-                               if ($imgInfo)   {
-                                       $code="";
-                                       if ($this->relPath || t3lib_div::isFirstPartOfStr($this->file,PATH_site))       {
-                                               $code.='<a href="../'.substr($this->file,strlen(PATH_site)).'" target="_blank"><b>'.$LANG->sL("LLL:EXT:lang/locallang_core.php:show_item.php.file").':</b> '.$fI["file"].'</a>';
-                                       } else {
-                                               $code.='<b>'.$LANG->sL("LLL:EXT:lang/locallang_core.php:show_item.php.file").':</b> '.$fI["file"];
-                                       }
-                                       $code.=' &nbsp;&nbsp;<b>'.$LANG->sL("LLL:EXT:lang/locallang_core.php:show_item.php.filesize").':</b> '.t3lib_div::formatSize(@filesize($this->file));
-                                       $code.='<br />';
-                                       $code.='<b>'.$LANG->sL("LLL:EXT:lang/locallang_core.php:show_item.php.dimensions").':</b> '.$imgInfo[0].'x'.$imgInfo[1].' pixels';
-                                       $this->content.=$this->doc->section('',$code);
+               }
+       }
 
-                                       $this->content.=$this->doc->divider(2);
+       /**
+        * Main function. Will generate the information to display for the item set internally.
+        *
+        * @return      void
+        */
+       function renderDBInfo() {
+               global $LANG,$TCA;
+
+                       // Print header, path etc:
+               $code = $this->doc->getHeader($this->table,$this->row,$this->pageinfo['_thePath'],1).'<br />';
+               $this->content.= $this->doc->section('',$code);
+
+                       // Initialize variables:
+               $tableRows = Array();
+               $i = 0;
+
+                       // Traverse the list of fields to display for the record:
+               $fieldList = t3lib_div::trimExplode(',',$TCA[$this->table]['interface']['showRecordFieldList'],1);
+               foreach($fieldList as $name)    {
+                       $name = trim($name);
+                       if ($TCA[$this->table]['columns'][$name])       {
+                               if (!$TCA[$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$this->table.':'.$name))        {
+                                       $i++;
+                                       $tableRows[] = '
+                                               <tr>
+                                                       <td class="bgColor5">'.$LANG->sL(t3lib_BEfunc::getItemLabel($this->table,$name),1).'</td>
+                                                       <td class="bgColor4">'.htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table,$name,$this->row[$name])).'</td>
+                                               </tr>';
+                               }
+                       }
+               }
 
-                                       $imgInfo = $imgObj->imageMagickConvert($this->file,"web","346","200m","","","",1);
-                                       $imgInfo[3] = "../".substr($imgInfo[3],strlen(PATH_site));
-                                       $code= '<br /><div align="center">'.$returnLinkTag.$imgObj->imgTag($imgInfo).'</a></div>';
-                                       $this->content.=$this->doc->section('',$code);
-                               } else {
-                                       $code="";
-                                       $icon = t3lib_BEfunc::getFileIcon($ext);
-                                       $url = 'gfx/fileicons/'.$icon;
-                                       $code.='<a href="../'.substr($this->file,strlen(PATH_site)).'" target="_blank"><img src="'.$url.'" width=18 height=16 align="top" border=0> <b>File:</b> '.$fI["file"].'</a> &nbsp;&nbsp;<b>Size:</b> '.t3lib_div::formatSize(@filesize($this->file)).'<br />';
-                                       $this->content.=$this->doc->section('',$code);
-
-                                       $lowerFilename = strtolower($this->file);
-                                       if (TYPO3_OS!="WIN" && !$GLOBALS["TYPO3_CONF_VARS"]["BE"]["disable_exec_function"])     {
-                                               if ($ext=="zip")        {
-                                                       $this->content.=$this->doc->divider(10);
-                                                       $code="";
-                                                       exec("unzip -l ".$this->file, $t);
-                                                       if (is_array($t))       {
-                                                               reset($t);
-                                                               next($t);
-                                                               next($t);
-                                                               next($t);
-                                                               while(list(,$val)=each($t))     {
-                                                                       $parts = explode(" ",trim($val),7);
-                                                                       $code.=$parts[6]."<br />";
-                                                               }
-                                                               $code='<span class="nobr">'.$code.'</span>';
-                                                       }
-                                                       $this->content.=$this->doc->section('',$code);
-                                               } elseif($ext=="tar" || $ext=="tgz" || substr($lowerFilename,-6)=="tar.gz" || substr($lowerFilename,-5)=="tar.z")       {
-                                                       $this->content.=$this->doc->divider(10);
-                                                       $code="";
-                                                       if ($ext=="tar")        {
-                                                               $compr="";
-                                                       } else {
-                                                               $compr="z";
-                                                       }
-                                                       exec("tar t".$compr."f ".$this->file, $t);
-                                                       if (is_array($t))       {
-                                                               reset($t);
-                                                               while(list(,$val)=each($t))     {
-                                                                       $code.=$val."<br />";
-                                                               }
-                                                               $code='<span class="nobr">'.$code.'</span>';
-                                                       }
-                                                       $this->content.=$this->doc->section('',$code);
+                       // Create table from the information:
+               $tableCode = '
+                                       <table border="0" cellpadding="1" cellspacing="1" id="typo3-showitem">
+                                               '.implode('',$tableRows).'
+                                       </table>';
+               $this->content.=$this->doc->section('',$tableCode);
+               $this->content.=$this->doc->divider(2);
+
+                       // Add path and table information in the bottom:
+               $code = '';
+               $code.= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path').': '.t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'],-48).'<br />';
+               $code.= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.table').': '.$LANG->sL($TCA[$this->table]['ctrl']['title']).' ('.$this->table.') - UID: '.$this->uid.'<br />';
+               $this->content.= $this->doc->section('', $code);
+       }
+
+       /**
+        * Main function. Will generate the information to display for the item set internally.
+        *
+        * @param       string          <a> tag closing/returning.
+        * @return      void
+        */
+       function renderFileInfo($returnLinkTag) {
+               global $LANG;
+
+                       // Initialize object to work on the image:
+               $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
+               $imgObj->init();
+               $imgObj->mayScaleUp = 0;
+               $imgObj->tempPath = PATH_site.$imgObj->tempPath;
+
+                       // Read Image Dimensions (returns false if file was not an image type, otherwise dimensions in an array)
+               $imgInfo = '';
+               $imgInfo = $imgObj->getImageDimensions($this->file);
+
+                       // File information
+               $fI = t3lib_div::split_fileref($this->file);
+               $ext = $fI['fileext'];
+
+               $code = '';
+
+                       // Setting header:
+               $icon = t3lib_BEfunc::getFileIcon($ext);
+               $url = 'gfx/fileicons/'.$icon;
+               $fileName = '<img src="'.$url.'" width="18" height="16" align="top" alt="" /><b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.file',1).':</b> '.$fI['file'];
+               if (t3lib_div::isFirstPartOfStr($this->file,PATH_site)) {
+                       $code.= '<a href="../'.substr($this->file,strlen(PATH_site)).'" target="_blank">'.$fileName.'</a>';
+               } else {
+                       $code.= $fileName;
+               }
+               $code.=' &nbsp;&nbsp;<b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.filesize').':</b> '.t3lib_div::formatSize(@filesize($this->file)).'<br />
+                       ';
+               if (is_array($imgInfo)) {
+                       $code.= '<b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.dimensions').':</b> '.$imgInfo[0].'x'.$imgInfo[1].' pixels';
+               }
+               $this->content.=$this->doc->section('',$code);
+               $this->content.=$this->doc->divider(2);
+
+                       // If the file was an image...:
+               if (is_array($imgInfo)) {
+                       $imgInfo = $imgObj->imageMagickConvert($this->file,'web','346','200m','','','',1);
+                       $imgInfo[3] = '../'.substr($imgInfo[3],strlen(PATH_site));
+                       $code = '<br />
+                               <div align="center">'.$returnLinkTag.$imgObj->imgTag($imgInfo).'</a></div>';
+                       $this->content.= $this->doc->section('', $code);
+               } else {
+                       $this->content.= $this->doc->spacer(10);
+                       $lowerFilename = strtolower($this->file);
+
+                               // Archive files:
+                       if (TYPO3_OS!='WIN' && !$GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function'])     {
+                               if ($ext=='zip')        {
+                                       $code = '';
+                                       exec('unzip -l '.$this->file, $t);
+                                       if (is_array($t))       {
+                                               reset($t);
+                                               next($t);
+                                               next($t);
+                                               next($t);
+                                               while(list(,$val)=each($t))     {
+                                                       $parts = explode(' ',trim($val),7);
+                                                       $code.= '
+                                                               '.$parts[6].'<br />';
                                                }
+                                               $code = '
+                                                       <span class="nobr">'.$code.'
+                                                       </span>
+                                                       <br /><br />';
+                                       }
+                                       $this->content.= $this->doc->section('', $code);
+                               } elseif($ext=='tar' || $ext=='tgz' || substr($lowerFilename,-6)=='tar.gz' || substr($lowerFilename,-5)=='tar.z')       {
+                                       $code = '';
+                                       if ($ext=='tar')        {
+                                               $compr = '';
+                                       } else {
+                                               $compr = 'z';
                                        }
-                                       if ($ext=="ttf")        {
-                                               $thumbScript="thumbs.php";
-                                               $params = "&file=".rawurlencode($this->file);
-                                               $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
-                                               $thumb='<br /><img src="'.$url.'" hspace=40 border=0 title="'.trim($this->file).'">';
-                                               $this->content.=$this->doc->section('',$thumb);
+                                       exec('tar t'.$compr.'f '.$this->file, $t);
+                                       if (is_array($t))       {
+                                               foreach($t as $val)     {
+                                                       $code.='
+                                                               '.$val.'<br />';
+                                               }
+
+                                               $code.='
+                                                                -------<br/>
+                                                                '.count($t).' files';
+
+                                               $code = '
+                                                       <span class="nobr">'.$code.'
+                                                       </span>
+                                                       <br /><br />';
                                        }
+                                       $this->content.= $this->doc->section('',$code);
                                }
+                       } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) {
+                               $this->content.= $this->doc->section('','Sorry, TYPO3_CONF_VARS[BE][disable_exec_function] was set, so cannot display content of archive file.');
                        }
 
-                       if (t3lib_div::_GP("returnUrl"))        {
-                               $this->content.=$this->doc->section('','<br />'.$returnLinkTag.'<strong>&lt; '.$LANG->sL("LLL:EXT:lang/locallang_core.php:labels.goBack").'</strong></a>');
+                               // Font files:
+                       if ($ext=='ttf')        {
+                               $thumbScript = 'thumbs.php';
+                               $params = '&file='.rawurlencode($this->file);
+                               $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
+                               $thumb = '<br />
+                                       <div align="center">'.$returnLinkTag.'<img src="'.htmlspecialchars($url).'" border="0" title="'.htmlspecialchars(trim($this->file)).'" alt="" /></a></div>';
+                               $this->content.= $this->doc->section('',$thumb);
                        }
                }
        }
 
        /**
-        * [Describe function...]
+        * End page and print content
         *
-        * @return      [type]          ...
+        * @return      void
         */
        function printContent() {
-               $this->content.=$this->doc->spacer(8);
-               $this->content.=$this->doc->endPage();
+               $this->content.= $this->doc->endPage();
                echo $this->content;
        }
 }
@@ -371,10 +437,6 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/show_
 // Make instance:
 $SOBE = t3lib_div::makeInstance('SC_show_item');
 $SOBE->init();
-
-// Include files?
-foreach($SOBE->include_once as $INC_FILE)      include_once($INC_FILE);
-
 $SOBE->main();
 $SOBE->printContent();
 ?>
\ No newline at end of file
index 2bbc92d..0f578c8 100755 (executable)
@@ -295,6 +295,7 @@ TABLE#typo3-formwizard TR#typo3-formWizardHeader TD { font-weight: bold; text-al
 TABLE#typo3-formwizard TR TD { padding: 0px 2px 0px 2px; }
 BODY#typo3-wizard-rte-php, BODY#typo3-wizard-rte-php TABLE#typo3-rtewizard { height: 98%; }
 BODY#typo3-wizard-rte-php TABLE#typo3-rtewizard TR TD#c-formContent { height: 100%; vertical-align: top; }
+BODY#typo3-wizard-colorpicker-php P.c-head {font-weight: bold; margin-top: 4px;}
 
 /* History / Undo */
 TABLE#typo3-history TR TD, TABLE#typo3-history-item TR TD { vertical-align: top; }
index 5617211..52c746e 100755 (executable)
@@ -8,5 +8,3 @@ Currently the system extensions are:
 
 "cms" - the TYPO3 frontend which most projects uses.
 "lang" - the system language labels for TYPO3. This is only an extension in order to utilize the typo3.org translation interface - thats the only reason. This is DEFINITELY needed by the core of TYPO3 - otherwise you would see no texts anywhere... :-)
-
-There are no plans of adding more extensions as "System" extensions.
\ No newline at end of file
index 91ac4d8..037680c 100755 (executable)
@@ -14,6 +14,7 @@ $LOCAL_LANG = Array (
                'labels.lockedRecord_content' => 'The user \'%s\' began to edit content on this page %s ago.',
                'labels.showRecords' => 'Show records',
                'labels.path' => 'Path',
+               'labels.table' => 'Table',
                'labels.upOneLevel' => 'Up one level',
                'labels.enterSearchString' => 'Search String:',
                'labels.enterSearchLevels' => 'This page|1 level down|2 levels down|3 levels down|4 levels down',
index d9953b5..d9f12c1 100755 (executable)
@@ -64,6 +64,14 @@ $LOCAL_LANG = Array (
                'forms_eform_html_enabled' => 'HTML mode enabled',
                'forms_eform_formtype_mail' => 'Send button label',
                'forms_special_eform' => 'Special configuration for mail forms',
+               'colorpicker_title' => 'Color Picker',
+               'colorpicker_setClose' => 'Save and Close',
+               'colorpicker_colorValue' => 'Selected Color:',
+               'colorpicker_fromImage' => 'Capture color from image (click on image):',
+               'colorpicker_fromMatrix' => 'Select color from matrix (websafe colors):',
+               'colorpicker_fromList' => 'Select HTML color name:',
+               'colorpicker_black' => 'BLACK',
+               'colorpicker_white' => 'WHITE',
        ),
        'dk' => Array (
                'rte_undoLastChange' => 'Fortryd/Gendan seneste ændring (%s siden)',
index 1791242..a84eda0 100755 (executable)
@@ -47,7 +47,7 @@
  */
 
 
-$BACK_PATH='';
+$BACK_PATH = '';
 require ('init.php');
 require ('template.php');
 include ('sysext/lang/locallang_wizards.php');
index 349f9a4..86f63a3 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2004 Kasper Skårhøj (kasper@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 /**
- * Color picker wizard
+ * Colorpicker wizard
+ *
+ * $Id $
+ * Revised for TYPO3 3.7 May/2004 by Kasper Skaarhoj
+ *
+ * @author     Mathias Schreiber <schreiber@wmdb.de>
+ * @author     Peter Kühn <peter@kuehn.com>
+ * @author     Kasper Skaarhoj <typo3@typo3.com>
+ */
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
- * @package TYPO3
- * @subpackage core
+ *
+ *   70: class SC_wizard_colorpicker
+ *   98:     function init()
+ *  177:     function main()
+ *  230:     function printContent()
+ *  241:     function frameSet()
+ *
+ *              SECTION: Rendering of various color selectors
+ *  300:     function colorMatrix()
+ *  350:     function colorList()
+ *  381:     function colorImage()
+ *  416:     function getIndex($im,$x,$y)
+ *
+ * TOTAL FUNCTIONS: 8
+ * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
 
+$BACK_PATH = '';
+require('init.php');
+require('template.php');
+require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
+require('sysext/lang/locallang_wizards.php');
 
-$BACK_PATH="";
-require ("init.php");
-require ("template.php");
+/**
+ * Script Class for colorpicker wizard
+ *
+ * @author     Mathias Schreiber <schreiber@wmdb.de>
+ * @author     Peter Kühn <peter@kuehn.com>
+ * @author     Kasper Skaarhoj <typo3@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
+class SC_wizard_colorpicker {
 
+               // GET vars:
+       var $P;                         // Wizard parameters, coming from TCEforms linking to the wizard.
+       var $colorValue;        // Value of the current color picked.
+       var $fieldChangeFunc;   // Serialized functions for changing the field... Necessary to call when the value is transferred to the TCEform since the form might need to do internal processing. Otherwise the value is simply not be saved.
+       var $fieldName;         // Form name (from opener script)
+       var $formName;          // Field name (from opener script)
+       var $md5ID;                     // ID of element in opener script for which to set color.
+       var $showPicker;        // Internal: If false, a frameset is rendered, if true the content of the picker script.
 
+               // Static:
+       var $HTMLcolorList = "aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,yellow,white";
 
-// ***************************
-// Script Classes
-// ***************************
-class SC_wizard_colorpicker {
-       var $content;
-       var $P;
-       var $doc;
+               // Internal:
+       var $pickerImage = '';
+       var $imageError = '';           // Error message if image not found.
+       var $doc;                                       // Template Object
+       var $content;                           // Accumulated content.
 
-       function init() {
-               global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
 
-               $this->P = t3lib_div::_GP('P');
 
-               unset($this->P["fieldChangeFunc"]["alert"]);
-               reset($this->P["fieldChangeFunc"]);
-               $update="";
-               while(list($k,$v)=each($this->P["fieldChangeFunc"]))    {
-                       $update.= "
-                       window.opener.".$v;
+
+       /**
+        * Initialises the Class
+        *
+        * @return      void
+        */
+       function init() {
+               global $BACK_PATH, $LANG;
+
+                       // Setting GET vars (used in frameset script):
+               $this->P = t3lib_div::_GP('P',1);
+
+                       // Setting GET vars (used in colorpicker script):
+               $this->colorValue = t3lib_div::_GP('colorValue');
+               $this->fieldChangeFunc = t3lib_div::_GP('fieldChangeFunc');
+               $this->fieldName = t3lib_div::_GP('fieldName');
+               $this->formName = t3lib_div::_GP('formName');
+               $this->md5ID = t3lib_div::_GP('md5ID');
+               $this->exampleImg = t3lib_div::_GP('exampleImg');
+
+
+                       // Resolving image (checking existence etc.)
+               $this->imageError = '';
+               if ($this->exampleImg)  {
+                       $this->pickerImage = t3lib_div::getFileAbsFileName($this->exampleImg,1,1);
+                       if (!$this->pickerImage || !@is_file($this->pickerImage))       {
+                               $this->imageError = 'ERROR: The image, "'.$this->exampleImg.'", could not be found!';
+                       }
                }
 
+                       // Setting field-change functions:
+               $fieldChangeFuncArr = unserialize($this->fieldChangeFunc);
+               $update = '';
+               if (is_array($fieldChangeFuncArr))      {
+                       unset($fieldChangeFuncArr['alert']);
+                       foreach($fieldChangeFuncArr as $v)      {
+                               $update.= '
+                               parent.opener.'.$v;
+                       }
+               }
 
-               $this->doc = t3lib_div::makeInstance("template");
+                       // Initialize document object:
+               $this->doc = t3lib_div::makeInstance('smallDoc');
                $this->doc->backPath = $BACK_PATH;
-               $this->doc->JScode='
-               <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->docType = 'xhtml_trans';
+               $this->doc->JScode = $this->doc->wrapScriptTags('
+                       function checkReference()       {       //
+                               if (parent.opener && parent.opener.document && parent.opener.document.'.$this->formName.' && parent.opener.document.'.$this->formName.'["'.$this->fieldName.'"])        {
+                                       return parent.opener.document.'.$this->formName.'["'.$this->fieldName.'"];
                                } else {
                                        close();
                                }
                        }
+                       function changeBGcolor(color) { // Changes the color in the table sample back in the TCEform.
+                           if (parent.opener.document.layers)  {
+                               parent.opener.document.layers["'.$this->md5ID.'"].bgColor = color;
+                           } else if (parent.opener.document.all)      {
+                               parent.opener.document.all["'.$this->md5ID.'"].style.background = color;
+                               } else if (parent.opener.document.getElementById && parent.opener.document.getElementById("'.$this->md5ID.'"))  {
+                                       parent.opener.document.getElementById("'.$this->md5ID.'").bgColor = color;
+                               }
+                       }
+                       function setValue(input)        {       //
+                               var field = checkReference();
+                               if (field)      {
+                                       field.value = input;
+                                       '.$update.'
+                                       changeBGcolor(input);
+                               }
+                       }
+                       function getValue()     {       //
+                               var field = checkReference();
+                               return field.value;
+                       }
+               ');
+
+                       // Start page:
+               $this->content.=$this->doc->startPage($LANG->getLL('colorpicker_title'));
+       }
 
        /**
-        * [Describe function...]
+        * Main Method, rendering either colorpicker or frameset depending on ->showPicker
         *
-        * @param       [type]          $color: ...
-        * @return      [type]          ...
+        * @return      void
         */
-                       function changeBGcolor(color) {
-                           if (window.opener.document.layers)
-                               window.opener.document.layers["'.$this->P["md5ID"].'"].bgColor = color;
-                           else if (window.opener.document.all)
-                               window.opener.document.all["'.$this->P["md5ID"].'"].style.background = color;
+       function main() {
+               global $LANG;
+
+               if(!t3lib_div::_GP('showPicker')) {     // Show frameset by default:
+                       $this->frameSet();
+               } else {
+
+                               // Putting together the items into a form:
+                       $content = '
+                               <form name="colorform" method="post" action="wizard_colorpicker.php">
+                                       '.$this->colorMatrix().'
+                                       '.$this->colorList().'
+                                       '.$this->colorImage().'
+
+                                               <!-- Value box: -->
+                                       <p class="c-head">'.$LANG->getLL('colorpicker_colorValue',1).'</p>
+                                       <table border="0" cellpadding="0" cellspacing="3">
+                                               <tr>
+                                                       <td><input type="text" '.$this->doc->formWidth(7).' maxlength="10" name="colorValue" value="'.htmlspecialchars($this->colorValue).'" /></td>
+                                                       <td style="background-color:'.htmlspecialchars($this->colorValue).'; border: 1px solid black;">&nbsp;<span style="color: black;">'.$LANG->getLL('colorpicker_black',1).'</span>&nbsp;<span style="color: white;">'.$LANG->getLL('colorpicker_white',1).'</span>&nbsp;</td>
+                                                       <td><input type="submit" name="save_close" value="'.$LANG->getLL('colorpicker_setClose',1).'" /></td>
+                                               </tr>
+                                       </table>
+
+                                               <!-- Hidden fields with values that has to be kept constant -->
+                                       <input type="hidden" name="showPicker" value="1" />
+                                       <input type="hidden" name="fieldChangeFunc" value="'.htmlspecialchars($this->fieldChangeFunc).'" />
+                                       <input type="hidden" name="fieldName" value="'.htmlspecialchars($this->fieldName).'" />
+                                       <input type="hidden" name="formName" value="'.htmlspecialchars($this->formName).'" />
+                                       <input type="hidden" name="md5ID" value="'.htmlspecialchars($this->md5ID).'" />
+                                       <input type="hidden" name="exampleImg" value="'.htmlspecialchars($this->exampleImg).'" />
+                               </form>';
+
+                               // If the save/close button is clicked, then close:
+                       if(t3lib_div::_GP('save_close')) {
+                               $content.=$this->doc->wrapScriptTags('
+                                       setValue(\''.$this->colorValue.'\');
+                                       parent.close();
+                               ');
                        }
 
+                               // Output:
+                       $this->content.=$this->doc->section($LANG->getLL('colorpicker_title'), $content, 0,1);
+                       $this->content.=$this->doc->endPage();
+               }
+       }
+
        /**
-        * [Describe function...]
+        * Returnes the sourcecode to the browser
         *
-        * @param       [type]          $input: ...
-        * @return      [type]          ...
+        * @return      void
         */
-                       function setValue(input)        {
-                               var field = checkReference();
-                               if (field)      {
-                                       field.value = input;
-                                       '.$update.'
-                                       changeBGcolor(input);
+       function printContent() {
+               echo $this->content;
+       }
+
+       /**
+        * Returnes a frameset so our JavaScript Reference isn't lost
+        * Took some brains to figure this one out ;-)
+        * If Peter wouldn't have been I would've gone insane...
+        *
+        * @return      void
+        */
+       function frameSet() {
+               global $LANG;
+
+                       // Set doktype:
+               $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_frames';
+               $GLOBALS['TBE_TEMPLATE']->JScode = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
+                               if (!window.opener)     {
+                                       alert("ERROR: Sorry, no link to main window... Closing");
+                                       close();
                                }
-                       }
+               ');
+
+               $this->content = $GLOBALS['TBE_TEMPLATE']->startPage($LANG->getLL('colorpicker_title'));
+
+                       // URL for the inner main frame:
+               $url = 'wizard_colorpicker.php?showPicker=1'.
+                               '&colorValue='.rawurlencode($this->P['currentValue']).
+                               '&fieldName='.rawurlencode($this->P['itemName']).
+                               '&formName='.rawurlencode($this->P['formName']).
+                               '&exampleImg='.rawurlencode($this->P['exampleImg']).
+                               '&md5ID='.rawurlencode($this->P['md5ID']).
+                               '&fieldChangeFunc='.rawurlencode(serialize($this->P['fieldChangeFunc']));
+
+               $this->content.='
+                       <frameset rows="*,1" framespacing="0" frameborder="0" border="0">
+                               <frame name="content" src="'.htmlspecialchars($url).'" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
+                               <frame name="menu" src="dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
+                       </frameset>
+               ';
+
+               $this->content.='
+</html>';
+       }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+       /************************************
+        *
+        * Rendering of various color selectors
+        *
+        ************************************/
 
        /**
-        * [Describe function...]
+        * Creates a color matrix table
         *
-        * @return      [type]          ...
+        * @return      void
         */
-                       function getValue()     {
-                               var field = checkReference();
-                               return field.value;
+       function colorMatrix()  {
+               global $LANG;
+
+               $steps = 51;
+
+                       // Get colors:
+               $color = array();
+
+               for($rr=0;$rr<256;$rr+=$steps)  {
+                       for($gg=0;$gg<256;$gg+=$steps)  {
+                               for($bb=0;$bb<256;$bb+=$steps)  {
+                                       $color[] = '#'.
+                                               substr('0'.dechex($rr),-2).
+                                               substr('0'.dechex($gg),-2).
+                                               substr('0'.dechex($bb),-2);
+                               }
                        }
-               </script>
-               ';
+               }
 
+                       // Traverse colors:
+               $columns = 24;
 
-               $this->content.=$this->doc->startPage("Color Picker");
+               $rows = 0;
+               $tRows = array();
+               while(isset($color[$columns*$rows]))    {
+                       $tCells = array();
+                       for($i=0;$i<$columns;$i++)      {
+                               $tCells[] = '
+                                       <td bgcolor="'.$color[$columns*$rows+$i].'" onclick="document.colorform.colorValue.value = \''.$color[$columns*$rows+$i].'\'; document.colorform.submit();" title="'.$color[$columns*$rows+$i].'">&nbsp;&nbsp;</td>';
+                       }
+                       $tRows[] = '
+                               <tr>'.implode('',$tCells).'
+                               </tr>';
+                       $rows++;
+               }
+
+               $table = '
+                       <p class="c-head">'.$LANG->getLL('colorpicker_fromMatrix',1).'</p>
+                       <table border="0" cellpadding="1" cellspacing="1" style="width:100%; border: 1px solid black; cursor:crosshair;">'.implode('',$tRows).'
+                       </table>';
+
+               return $table;
        }
 
        /**
-        * [Describe function...]
+        * Creates a selector box with all HTML color names.
         *
-        * @return      [type]          ...
+        * @return      void
         */
-       function main() {
-               global $SOBE;
+       function colorList()    {
+               global $LANG;
+
+                       // Initialize variables:
+               $colors = explode(',',$this->HTMLcolorList);
+               $currentValue = strtolower($this->colorValue);
+               $opt = array();
+               $opt[] = '<option value=""></option>';
+
+                       // Traverse colors, making option tags for selector box.
+               foreach($colors as $colorName)  {
+                       $opt[] = '<option style="background-color: '.$colorName.';" value="'.htmlspecialchars($colorName).'"'.($currentValue==$colorName ? ' selected="selected"' : '').'>'.htmlspecialchars($colorName).'</option>';
+               }
 
-               $this->content.='Color picker
-               <form action="">
-               <input type="text" name="test" onChange="setValue(this.value);">
-               </form>
+                       // Compile selector box and return result:
+               $output = '
+                       <p class="c-head">'.$LANG->getLL('colorpicker_fromList',1).'</p>
+                       <select onchange="document.colorform.colorValue.value = this.options[this.selectedIndex].value; document.colorform.submit(); return false;">
+                               '.implode('
+                               ',$opt).'
+                       </select><br/>';
 
-               <script language="javascript" type="text/javascript">
-                       document.forms[0].test.value = getValue();
-               </script>
+               return $output;
+       }
 
-               ';
-               $this->content.=$this->doc->endPage();
+       /**
+        * Creates a color image selector
+        *
+        * @return      void
+        */
+       function colorImage()   {
+               global $LANG;
+
+                       // Handling color-picker image if any:
+               if (!$this->imageError) {
+                       if ($this->pickerImage) {
+                               if(t3lib_div::_POST('coords_x')) {
+                                       $this->colorValue = '#'.$this->getIndex(t3lib_stdgraphic::imageCreateFromGif($this->pickerImage),t3lib_div::_POST('coords_x'),t3lib_div::_POST('coords_y'));
+                               }
+                               $pickerFormImage = '
+                               <p class="c-head">'.$LANG->getLL('colorpicker_fromImage',1).'</p>
+                               <input type="image" src="../'.substr($this->pickerImage,strlen(PATH_site)).'" name="coords" style="cursor:crosshair;" /><br />';
+                       } else {
+                               $pickerFormImage = '';
+                       }
+               } else {
+                       $pickerFormImage = '
+                       <p class="c-head">'.htmlspecialchars($this->imageError).'</p>';
+               }
+
+               return $pickerFormImage;
        }
 
        /**
-        * [Describe function...]
+        * Gets the HTML (Hex) Color Code for the selected pixel of an image
+        * This method handles the correct imageResource no matter what format
         *
-        * @return      [type]          ...
+        * @param       pointer         Valid ImageResource returned by t3lib_stdgraphic::imageCreateFromGif
+        * @param       integer         X-Coordinate of the pixel that should be checked
+        * @param       integer         Y-Coordinate of the pixel that should be checked
+        * @return      string          HEX RGB value for color
+        * @see colorImage()
         */
-       function printContent() {
-               echo $this->content;
+       function getIndex($im,$x,$y) {
+               $rgb = ImageColorAt($im, $x, $y);
+               $colorrgb = imagecolorsforindex($im,$rgb);
+               $index['r'] = dechex($colorrgb['red']);
+               $index['g'] = dechex($colorrgb['green']);
+               $index['b'] = dechex($colorrgb['blue']);
+               foreach ($index as $value) {
+                       if(strlen($value) == 1) {
+                               $hexvalue[] = strtoupper('0'.$value);
+                       } else {
+                               $hexvalue[] = strtoupper($value);
+                       }
+               }
+               $hex = implode('',$hexvalue);
+               return $hex;
        }
 }
 
 // Include extension?
-if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizard_colorpicker.php"])   {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizard_colorpicker.php"]);
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_colorpicker.php'])   {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_colorpicker.php']);
 }
 
 
@@ -167,7 +448,7 @@ if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/wizar
 
 
 // Make instance:
-$SOBE = t3lib_div::makeInstance("SC_wizard_colorpicker");
+$SOBE = t3lib_div::makeInstance('SC_wizard_colorpicker');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();