/**
     * Creates the listing of records from a single table
     *
     * @param	string		Table name
     * @param	integer		Page id
     * @param	string		List of fields to show in the listing. Pseudo fields will be added including the record header.
     * @return	string		HTML table with the listing for the record.
     */
    function getTable($table, $rowlist)
    {
        global $TCA, $BACK_PATH, $LANG;
        // Loading all TCA details for this table:
        t3lib_div::loadTCA($table);
        // Init
        $addWhere = '';
        $titleCol = $TCA[$table]['ctrl']['label'];
        $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
        $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
        $selFieldList = $this->getSelFieldList($table, $rowlist);
        $dbCount = 0;
        if ($this->pointer->countTotal and $this->res) {
            $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($this->res);
        }
        $shEl = $this->showElements;
        $out = '';
        if ($dbCount) {
            // half line is drawn
            $theData = array();
            if (!$this->table && !$rowlist) {
                $theData[$titleCol] = '<img src="clear.gif" width="' . ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . '" height="1">';
                if (in_array('_CONTROL_', $this->fieldArray)) {
                    $theData['_CONTROL_'] = '';
                }
            }
            #			$out.=$this->addelement('', $theData);
            // Header line is drawn
            $theData = array();
            #			$theData[$titleCol] = '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</b> ('.$this->resCount.')';
            $theUpIcon = '&nbsp;';
            // todo csh
            #			$theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
            #			$out.=$this->addelement($theUpIcon, $theData, '', '', 'background-color:'.$this->headLineCol.'; border-bottom:1px solid #000');
            // Fixing a order table for sortby tables
            $this->currentTable = array();
            $currentIdList = array();
            $doSort = $TCA[$table]['ctrl']['sortby'] && !$this->sortField;
            $prevUid = 0;
            $prevPrevUid = 0;
            $accRows = array();
            // Accumulate rows here
            while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->res)) {
                $accRows[] = $row;
                $currentIdList[] = $row['uid'];
                if ($doSort) {
                    if ($prevUid) {
                        $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
                        $this->currentTable['next'][$prevUid] = '-' . $row['uid'];
                        $this->currentTable['prevUid'][$row['uid']] = $prevUid;
                    }
                    $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
                    $prevUid = $row['uid'];
                }
            }
            $GLOBALS['TYPO3_DB']->sql_free_result($this->res);
            // items
            $itemContentTRows = '';
            $this->duplicateStack = array();
            $this->eCounter = $this->pointer->firstItemNum;
            $cc = 0;
            $itemContentTRows .= $this->fwd_rwd_nav('rwd');
            foreach ($accRows as $row) {
                $this->alternateBgColors = false;
                $cc++;
                $row_bgColor = $this->alternateBgColors ? $cc % 2 ? ' class="item"' : ' class="item" bgColor="' . t3lib_div::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, +10, +10, +10) . '"' : ' class="item"';
                // Initialization
                $iconfile = t3lib_iconWorks::getIcon($table, $row);
                $alttext = t3lib_BEfunc::getRecordIconAltText($row, $table);
                $recTitle = t3lib_BEfunc::getRecordTitle($table, $row, 1);
                // The icon with link
                $theIcon = '<img src="' . $this->backPath . $iconfile . '" width="18" height="16" border="0" title="' . $alttext . '" />';
                $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $table, $row['uid']);
                $thumbImg = '';
                if ($this->thumbs) {
                    $thumbImg = '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail(tx_dam::path_makeAbsolute($row['file_path']) . $row['file_name']) . '</div>';
                }
                // 	Preparing and getting the data-array
                $theData = array();
                reset($this->fieldArray);
                while (list(, $fCol) = each($this->fieldArray)) {
                    if ($fCol == $titleCol) {
                        $theData[$fCol] = $this->linkWrapItems($table, $row['uid'], $recTitle, $row) . $thumbImg;
                    } elseif ($fCol == 'pid') {
                        $theData[$fCol] = $row[$fCol];
                    } elseif ($fCol == '_CONTROL_') {
                        $theData[$fCol] = $this->makeControl($table, $row);
                    } else {
                        $theData[$fCol] = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100);
                    }
                }
                $actionIcon = '';
                $itemContentTRows .= $this->addElement($theIcon, $theData, $actionIcon, $row_bgColor, '', true);
                // Thumbsnails?
                //				if ($this->thumbs && trim($row[$thumbsCol]))	{
                //					$itemContentTRows.=$this->addelement('', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)), '', $row_bgColor);
                //				}
                $this->eCounter++;
            }
            if ($this->eCounter > $this->pointer->firstItemNum) {
                $itemContentTRows .= $this->fwd_rwd_nav('fwd');
            }
            // field header line is drawn:
            $theData = array();
            foreach ($this->fieldArray as $fCol) {
                $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16);
                if ($fCol == '_CONTROL_') {
                    if (!$TCA[$table]['ctrl']['readOnly']) {
                        if ($permsEdit && $this->table && is_array($currentIdList) && in_array('editRec', $shEl)) {
                            $editIdList = implode(',', $currentIdList);
                            $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1';
                            $content = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' vspace="2" border="0" align="top" title="' . $GLOBALS['LANG']->getLL('editShownColumns') . '" />';
                            $theData[$fCol] .= $this->wrapEditLink($content, $params);
                        }
                    }
                } else {
                    $theData[$fCol] = '';
                    #					$theData[$fCol].='&nbsp;';
                    if ($this->table && is_array($currentIdList) && in_array('editRec', $shEl)) {
                        if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol]) {
                            $editIdList = implode(',', $currentIdList);
                            $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
                            $content = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' vspace="2" border="0" align="top" title="' . sprintf($GLOBALS['LANG']->getLL('editThisColumn'), preg_replace("/:\$/", '', trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol))))) . '" />';
                            $theData[$fCol] .= $this->wrapEditLink($content, $params);
                        }
                    } else {
                        #						$theData[$fCol].='&nbsp;';
                    }
                    $theData[$fCol] .= $this->addSortLink($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fCol, '&nbsp;<i>[|]</i>&nbsp;')), $fCol, $table);
                }
            }
            $out .= $this->addelement($theUpIcon, $theData, '', ' class="c-headLine"', 'border-bottom:1px solid #888');
            // The list of records is added after the header:
            $out .= $itemContentTRows;
            $out .= $this->addelement('', array(), '', '', 'border-top:1px solid #888');
            #TODO
            $LOISmode = false;
            // ... and it is all wrapped in a table:
            $out = '

			<!--
				DB listing of elements:	"' . htmlspecialchars($table) . '"
			-->
				<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($LOISmode ? ' typo3-dblist-overview' : '') . '">
					' . $out . '
				</table>';
        }
        // Return content:
        return $out;
    }
 /**
  * gets the icon for the shortcut
  *
  * @param	string		backend module name
  * @return	string		shortcut icon as img tag
  */
 protected function getShortcutIcon($row, $shortcut)
 {
     global $TCA;
     switch ($row['module_name']) {
         case 'xMOD_alt_doc.php':
             $table = $shortcut['table'];
             $recordid = $shortcut['recordid'];
             if ($shortcut['type'] == 'edit') {
                 // Creating the list of fields to include in the SQL query:
                 $selectFields = $this->fieldArray;
                 $selectFields[] = 'uid';
                 $selectFields[] = 'pid';
                 if ($table == 'pages') {
                     if (t3lib_extMgm::isLoaded('cms')) {
                         $selectFields[] = 'module';
                         $selectFields[] = 'extendToSubpages';
                     }
                     $selectFields[] = 'doktype';
                 }
                 if (is_array($TCA[$table]['ctrl']['enablecolumns'])) {
                     $selectFields = array_merge($selectFields, $TCA[$table]['ctrl']['enablecolumns']);
                 }
                 if ($TCA[$table]['ctrl']['type']) {
                     $selectFields[] = $TCA[$table]['ctrl']['type'];
                 }
                 if ($TCA[$table]['ctrl']['typeicon_column']) {
                     $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
                 }
                 if ($TCA[$table]['ctrl']['versioningWS']) {
                     $selectFields[] = 't3ver_state';
                 }
                 $selectFields = array_unique($selectFields);
                 // Unique list!
                 $permissionClause = $table == 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
                 $sqlQueryParts = array('SELECT' => implode(',', $selectFields), 'FROM' => $table, 'WHERE' => 'uid IN (' . $recordid . ') ' . $permissionClause . t3lib_BEfunc::deleteClause($table) . t3lib_BEfunc::versioningPlaceholderClause($table));
                 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
                 $icon = t3lib_iconWorks::getIcon($table, $row, $this->backPath);
             } elseif ($shortcut['type'] == 'new') {
                 $icon = t3lib_iconWorks::getIcon($table, '', $this->backPath);
             }
             $icon = t3lib_iconWorks::skinImg($this->backPath, $icon, '', 1);
             break;
         case 'xMOD_file_edit.php':
             $icon = 'gfx/edit_file.gif';
             break;
         case 'xMOD_wizard_rte.php':
             $icon = 'gfx/edit_rtewiz.gif';
             break;
         default:
             if ($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab']) {
                 $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab'];
                 // change icon of fileadmin references - otherwise it doesn't differ with Web->List
                 $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
                 if (t3lib_div::isAbsPath($icon)) {
                     $icon = '../' . substr($icon, strlen(PATH_site));
                 }
             } else {
                 $icon = 'gfx/dummy_module.gif';
             }
     }
     return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', true) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', true) . '" />';
 }
 /**
  * Returns the content tree (based on the data structure) for a certain page or a flexible content element. In case of a page it will contain all the references
  * to content elements (and some more information) and in case of a FCE, references to its sub-elements.
  *
  * @param	string		$table: Table which contains the (XML) data structure. Only records from table 'pages' or flexible content elements from 'tt_content' are handled
  * @param	array		$row: Record of the root element where the tree starts (Possibly overlaid with workspace content)
  * @param	array		$tt_content_elementRegister: Register of used tt_content elements, don't mess with it! (passed by reference since data is built up)
  * @param	string		$prevRecList: comma separated list of uids, used internally for recursive calls. Don't mess with it!
  * @return	array		The content tree
  * @access	protected
  */
 function getContentTree_element($table, $row, &$tt_content_elementRegister, $prevRecList = '')
 {
     global $TCA, $LANG;
     $tree = array();
     $tree['el'] = array('table' => $table, 'uid' => $row['uid'], 'pid' => $row['pid'], '_ORIG_uid' => $row['_ORIG_uid'], 'title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $row), 50), 'icon' => t3lib_iconWorks::getIcon($table, $row), 'sys_language_uid' => $row['sys_language_uid'], 'l18n_parent' => $row['l18n_parent'], 'CType' => $row['CType']);
     if ($this->includePreviewData) {
         $tree['previewData'] = array('fullRow' => $row);
     }
     // If element is a Flexible Content Element (or a page) then look at the content inside:
     if ($table == 'pages' || $table == $this->rootTable || $table == 'tt_content' && $row['CType'] == 'templavoila_pi1') {
         t3lib_div::loadTCA($table);
         $rawDataStructureArr = t3lib_BEfunc::getFlexFormDS($TCA[$table]['columns']['tx_templavoila_flex']['config'], $row, $table);
         $expandedDataStructureArr = $this->ds_getExpandedDataStructure($table, $row);
         switch ($table) {
             case 'pages':
                 $currentTemplateObject = $this->getContentTree_fetchPageTemplateObject($row);
                 break;
             case 'tt_content':
                 $currentTemplateObject = t3lib_beFunc::getRecordWSOL('tx_templavoila_tmplobj', $row['tx_templavoila_to']);
                 break;
             default:
                 $currentTemplateObject = FALSE;
         }
         if (is_array($currentTemplateObject)) {
             $templateMappingArr = unserialize($currentTemplateObject['templatemapping']);
         }
         $tree['ds_is_found'] = is_array($rawDataStructureArr);
         $tree['ds_meta'] = $rawDataStructureArr['meta'];
         $flexformContentArr = t3lib_div::xml2array($row['tx_templavoila_flex']);
         if (!is_array($flexformContentArr)) {
             $flexformContentArr = array();
         }
         // Respect the currently selected language, for both concepts - with langChildren enabled and disabled:
         $langChildren = intval($tree['ds_meta']['langChildren']);
         $langDisable = intval($tree['ds_meta']['langDisable']);
         $lKeys = $langDisable ? array('lDEF') : ($langChildren ? array('lDEF') : $this->allSystemWebsiteLanguages['all_lKeys']);
         $vKeys = $langDisable ? array('vDEF') : ($langChildren ? $this->allSystemWebsiteLanguages['all_vKeys'] : array('vDEF'));
         // Traverse each sheet in the FlexForm Structure:
         foreach ($expandedDataStructureArr as $sheetKey => $sheetData) {
             // Add some sheet meta information:
             $tree['sub'][$sheetKey] = array();
             $tree['contentFields'][$sheetKey] = array();
             $tree['meta'][$sheetKey] = array('title' => is_array($sheetData) && $sheetData['ROOT']['TCEforms']['sheetTitle'] ? $LANG->sL($sheetData['ROOT']['TCEforms']['sheetTitle']) : '', 'description' => is_array($sheetData) && $sheetData['ROOT']['TCEforms']['sheetDescription'] ? $LANG->sL($sheetData['ROOT']['TCEforms']['sheetDescription']) : '', 'short' => is_array($sheetData) && $sheetData['ROOT']['TCEforms']['sheetShortDescr'] ? $LANG->sL($sheetData['ROOT']['TCEforms']['sheetShortDescr']) : '');
             // Traverse the sheet's elements:
             if (is_array($sheetData) && is_array($sheetData['ROOT']['el'])) {
                 foreach ($sheetData['ROOT']['el'] as $fieldKey => $fieldData) {
                     // Compile preview data:
                     if ($this->includePreviewData) {
                         $tree['previewData']['sheets'][$sheetKey][$fieldKey] = array('TCEforms' => $fieldData['TCEforms'], 'type' => $fieldData['type'], 'section' => $fieldData['section'], 'data' => array(), 'subElements' => array(), 'isMapped' => is_array($templateMappingArr['MappingInfo']['ROOT']['el'][$fieldKey]));
                         foreach ($lKeys as $lKey) {
                             foreach ($vKeys as $vKey) {
                                 if (is_array($flexformContentArr['data'])) {
                                     $tree['previewData']['sheets'][$sheetKey][$fieldKey]['data'][$lKey][$vKey] = $flexformContentArr['data'][$sheetKey][$lKey][$fieldKey][$vKey];
                                 }
                             }
                             if ($fieldData['type'] == 'array') {
                                 $tree['previewData']['sheets'][$sheetKey][$fieldKey]['subElements'][$lKey] = $flexformContentArr['data'][$sheetKey][$lKey][$fieldKey]['el'];
                             }
                         }
                     }
                     // If the current field points to other content elements, process them:
                     if ($fieldData['TCEforms']['config']['type'] == 'group' && $fieldData['TCEforms']['config']['internal_type'] == 'db' && $fieldData['TCEforms']['config']['allowed'] == 'tt_content') {
                         foreach ($lKeys as $lKey) {
                             foreach ($vKeys as $vKey) {
                                 $listOfSubElementUids = $flexformContentArr['data'][$sheetKey][$lKey][$fieldKey][$vKey];
                                 $tree['sub'][$sheetKey][$lKey][$fieldKey][$vKey] = $this->getContentTree_processSubContent($listOfSubElementUids, $tt_content_elementRegister, $prevRecList);
                                 $tree['sub'][$sheetKey][$lKey][$fieldKey][$vKey]['meta']['title'] = $fieldData['TCEforms']['label'];
                             }
                         }
                     } elseif ($fieldData['type'] != 'array' && $fieldData['TCEforms']['config']) {
                         // If generally there are non-container fields, register them:
                         $tree['contentFields'][$sheetKey][] = $fieldKey;
                     }
                 }
             }
         }
     }
     // Add localization info for this element:
     $tree['localizationInfo'] = $this->getContentTree_getLocalizationInfoForElement($tree, $tt_content_elementRegister);
     return $tree;
 }
 /**
  * Callback function to blind user and group accounts. Used as <code>itemsProcFunc</code> in <code>$TCA</code>.
  *
  * @param	array		$conf	Configuration array. The following elements are set:<ul><li>items - initial set of items (empty in our case)</li><li>config - field config from <code>$TCA</code></li><li>TSconfig - this function name</li><li>table - table name</li><li>row - record row (???)</li><li>field - field name</li></ul>
  * @param	object		$tceforms	<code>t3lib_div::TCEforms</code> object
  * @return	void
  */
 function processUserAndGroups($conf, $tceforms)
 {
     // Get usernames and groupnames
     $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
     $groupArray = array_keys($be_group_Array);
     $be_user_Array = t3lib_BEfunc::getUserNames();
     $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array, $groupArray, 1);
     // users
     $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_users']['ctrl']['title']);
     foreach ($be_user_Array as $uid => $user) {
         $conf['items'][] = array($user['username'] . ' (' . $title . ')', 'be_users_' . $user['uid'], t3lib_iconWorks::getIcon('be_users', $user));
     }
     // Process groups only if necessary -- save time!
     if (strstr($conf['config']['mod_ws_allowed'], 'be_groups')) {
         // groups
         $be_group_Array = $be_group_Array_o = t3lib_BEfunc::getGroupNames();
         $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array_o, $groupArray, 1);
         $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_groups']['ctrl']['title']);
         foreach ($be_group_Array as $uid => $group) {
             $conf['items'][] = array($group['title'] . ' (' . $title . ')', 'be_groups_' . $group['uid'], t3lib_iconWorks::getIcon('be_groups', $user));
         }
     }
 }
 /**
  * For TYPO3 Element Browser: This lists all content elements from the given list of tables
  *
  * @param	string		Commalist of tables. Set to "*" if you want all tables.
  * @return	string		HTML output.
  */
 function TBE_expandPage($tables)
 {
     global $TCA, $BE_USER, $BACK_PATH;
     $out = '';
     if ($this->expandPage >= 0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) {
         // Set array with table names to list:
         if (!strcmp(trim($tables), '*')) {
             $tablesArr = array_keys($TCA);
         } else {
             $tablesArr = t3lib_div::trimExplode(',', $tables, 1);
         }
         reset($tablesArr);
         // Headline for selecting records:
         $out .= $this->barheader($GLOBALS['LANG']->getLL('selectRecords') . ':');
         // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
         $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
         $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages', $this->expandPage);
         $ATag = '';
         $ATag_e = '';
         $ATag2 = '';
         if (in_array('pages', $tablesArr)) {
             $ficon = t3lib_iconWorks::getIcon('pages', $mainPageRec);
             $ATag = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '" . $ficon . "','',1);\">";
             $ATag2 = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '" . $ficon . "','',0);\">";
             $ATag_alt = substr($ATag, 0, -4) . ",'',1);\">";
             $ATag_e = '</a>';
         }
         $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
         $pBicon = $ATag2 ? '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />' : '';
         $pText = htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'], $titleLen));
         $out .= $picon . $ATag2 . $pBicon . $ATag_e . $ATag . $pText . $ATag_e . '<br />';
         // Initialize the record listing:
         $id = $this->expandPage;
         $pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
         $pageinfo = t3lib_BEfunc::readPageAccess($id, $perms_clause);
         $table = '';
         // Generate the record list:
         $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
         $dblist->thisScript = $this->thisScript;
         $dblist->backPath = $GLOBALS['BACK_PATH'];
         $dblist->thumbs = 0;
         $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
         $dblist->noControlPanels = 1;
         $dblist->clickMenuEnabled = 0;
         $dblist->tableList = implode(',', $tablesArr);
         $dblist->start($id, t3lib_div::_GP('table'), $pointer, t3lib_div::_GP('search_field'), t3lib_div::_GP('search_levels'), t3lib_div::_GP('showLimit'));
         $dblist->setDispFields();
         $dblist->generateList();
         $dblist->writeBottom();
         //	Add the HTML for the record list to output variable:
         $out .= $dblist->HTMLcode;
         // Add support for fieldselectbox in singleTableMode
         if ($dblist->table) {
             $out .= $dblist->fieldSelectBox($dblist->table);
         }
         $out .= $dblist->getSearchBox();
     }
     // Return accumulated content:
     return $out;
 }
    /**
     * Displays a list of local content elements on the page which were NOT used in the hierarchical structure of the page.
     *
     * @param	$pObj:		Reference to the parent object ($this)
     * @return	string		HTML output
     * @access	protected
     */
    function sidebar_renderNonUsedElements()
    {
        global $LANG, $TYPO3_DB, $BE_USER;
        $output = '';
        $elementRows = array();
        $usedUids = array_keys($this->pObj->global_tt_content_elementRegister);
        $usedUids[] = 0;
        $pid = $this->pObj->id;
        // If workspaces should evaluated non-used elements it must consider the id: For "element" and "branch" versions it should accept the incoming id, for "page" type versions it must be remapped (because content elements are then related to the id of the offline version)
        $res = $TYPO3_DB->exec_SELECTquery(t3lib_BEfunc::getCommonSelectFields('tt_content', '', array('uid', 'header', 'bodytext', 'sys_language_uid')), 'tt_content', 'pid=' . intval($pid) . ' ' . 'AND uid NOT IN (' . implode(',', $usedUids) . ') ' . 'AND t3ver_state!=1' . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'uid');
        $this->deleteUids = array();
        // Used to collect all those tt_content uids with no references which can be deleted
        while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
            $elementPointerString = 'tt_content:' . $row['uid'];
            // Prepare the language icon:
            $languageLabel = htmlspecialchars($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['title']);
            $languageIcon = $this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon'] ? '<img src="' . $this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon'] . '" title="' . $languageLabel . '" alt="' . $languageLabel . '"  />' : ($languageLabel && $row['sys_language_uid'] ? '[' . $languageLabel . ']' : '');
            // Prepare buttons:
            $cutButton = $this->element_getSelectButtons($elementPointerString, 'ref');
            $recordIcon = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, t3lib_iconWorks::getIcon('tt_content', $row), '') . ' width="18" height="16" border="0" title="[tt_content:' . $row['uid'] . '" alt="" />';
            $recordButton = $this->pObj->doc->wrapClickMenuOnIcon($recordIcon, 'tt_content', $row['uid'], 1, '&callingScriptId=' . rawurlencode($this->pObj->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete');
            $elementRows[] = '
				<tr class="bgColor4">
					<td style="width:1%">' . $cutButton . '</td>
					<td style="width:1%;">' . $languageIcon . '</td>
					<td style="width:1%;">' . $this->renderReferenceCount($row['uid']) . '</td>
					<td>' . $recordButton . htmlspecialchars(' ' . t3lib_div::fixed_lgd_cs(trim(strip_tags($row['header'] . ($row['header'] && $row['bodytext'] ? ' - ' : '') . $row['bodytext'])), 100)) . '
					</td>
				</tr>
			';
        }
        if (count($elementRows)) {
            // Control for deleting all deleteable records:
            $deleteAll = '';
            if (count($this->deleteUids) && 0 === $BE_USER->workspace) {
                $params = '';
                foreach ($this->deleteUids as $deleteUid) {
                    $params .= '&cmd[tt_content][' . $deleteUid . '][delete]=1';
                }
                $label = $LANG->getLL('rendernonusedelements_deleteall');
                $deleteAll = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $this->doc->issueCommand($params, '') . '\');') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/garbage.gif', 'width="11" height="12"') . ' title="' . htmlspecialchars($label) . '" alt="" />' . htmlspecialchars($label) . '</a>';
            }
            // Create table and header cell:
            $output = '
				<table border="0" cellpadding="0" cellspacing="1" width="100%" class="lrPadding">
					<tr class="bgColor4-20">
						<td colspan="5">' . $LANG->getLL('inititemno_elementsNotBeingUsed', '1') . ':</td>
					</tr>
					' . implode('', $elementRows) . '
					<tr class="bgColor4">
						<td colspan="5">' . $deleteAll . '</td>
					</tr>
				</table>
			';
        }
        return $output;
    }
 /**
  * Returns a file or folder icon for a given (file)path as HTML img tag.
  *
  * @param	array		$infoArr info array: eg. $pathInfo = tx_dam::path_getInfo($path)
  * @param	boolean		$addAttrib Additional attributes for the image tag..
  * @param	string		$mode TYPO3_MODE to be used: 'FE', 'BE'. Constant TYPO3_MODE is default.
  * @return	string		Icon img tag
  * @see tx_dam::path_getInfo()
  */
 function icon_getFileTypeImgTag($infoArr, $addAttrib = '', $mode = TYPO3_MODE)
 {
     global $TYPO3_CONF_VARS, $TCA;
     static $iconCacheSize = array();
     require_once PATH_t3lib . 'class.t3lib_iconworks.php';
     if (isset($infoArr['dir_name'])) {
         $iconfile = tx_dam::icon_getFolder($infoArr);
     } elseif (isset($infoArr['file_name']) or isset($infoArr['file_type']) or isset($infoArr['media_type'])) {
         $iconfile = tx_dam::icon_getFileType($infoArr);
         if ($mode === 'BE') {
             $tca_temp_typeicons = $TCA['tx_dam']['ctrl']['typeicons'];
             $tca_temp_iconfile = $TCA['tx_dam']['ctrl']['iconfile'];
             unset($TCA['tx_dam']['ctrl']['typeicons']);
             $TCA['tx_dam']['ctrl']['iconfile'] = $iconfile;
             $iconfile = t3lib_iconWorks::getIcon('tx_dam', $infoArr, $shaded = false);
             $TCA['tx_dam']['ctrl']['iconfile'] = $tca_temp_iconfile;
             $TCA['tx_dam']['ctrl']['typeicons'] = $tca_temp_typeicons;
         }
     }
     if (!$iconCacheSize[$iconfile]) {
         // Get width/height:
         $iInfo = @getimagesize(t3lib_div::resolveBackPath(PATH_site . TYPO3_mainDir . $iconfile));
         $iconCacheSize[$iconfile] = $iInfo[3];
     }
     $icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $iconfile, $iconCacheSize[$iconfile]) . ' class="typo3-icon"  alt="" ' . trim($addAttrib) . ' />';
     return $icon;
 }
    /**
     * Produces a table with indexing information for each page.
     *
     * @return	string		HTML output
     */
    function drawTableOfIndexedPages()
    {
        global $BACK_PATH;
        // Drawing tree:
        $tree = t3lib_div::makeInstance('t3lib_pageTree');
        $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
        $tree->init('AND ' . $perms_clause);
        $HTML = '<img src="' . $BACK_PATH . t3lib_iconWorks::getIcon('pages', $this->pObj->pageinfo) . '" width="18" height="16" align="top" alt="" />';
        $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML);
        if ($this->pObj->MOD_SETTINGS['depth']) {
            $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
        }
        // Traverse page tree:
        $code = '';
        foreach ($tree->tree as $data) {
            $code .= $this->indexed_info($data['row'], $data['HTML'] . $this->showPageDetails(t3lib_div::fixed_lgd_cs($data['row']['title'], 20), $data['row']['uid']));
        }
        if ($code) {
            $code = '<br /><br />
					<table border="0" cellspacing="1" cellpadding="2" class="c-list">' . $this->printPhashRowHeader() . $code . '</table>';
            // Create section to output:
            $theOutput .= $this->pObj->doc->section('', $code, 0, 1);
        } else {
            $theOutput .= $this->pObj->doc->section('', '<br /><br />' . $this->pObj->doc->icons(1) . 'There were no indexed pages found in the tree.<br /><br />', 0, 1);
        }
        return $theOutput;
    }
 /**
  * Return the icon for a record - just a wrapper for two functions from t3lib_iconWorks
  *
  * @param array $row The record to get the icon for
  * @return string The path to the icon
  */
 protected function getIcon($row)
 {
     $icon = t3lib_iconWorks::getIcon($this->mmForeignTable ? $this->mmForeignTable : $this->table, $row);
     return t3lib_iconWorks::skinImg('', $icon, '', 1);
 }
    /**
     * [Describe function...]
     *
     * @return	[type]		...
     */
    function main()
    {
        global $SOBE, $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        global $tmpl, $tplRow, $theConstants;
        $POST = t3lib_div::_POST();
        // **************************
        // Checking for more than one template an if, set a menu...
        // **************************
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"];
        }
        // **************************
        // Main
        // **************************
        // BUGBUG: Should we check if the uset may at all read and write template-records???
        $bType = $this->pObj->MOD_SETTINGS["ts_browser_type"];
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        if ($existTemplate) {
            $theOutput .= '<h4 style="margin-bottom:5px;">' . $GLOBALS['LANG']->getLL('currentTemplate') . ' <img ' . t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow["title"], $bType == "setup" ? "config" : "constants") . '</strong>' . htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : '') . '</h4>';
            if ($manyTemplatesMenu) {
                $theOutput .= $this->pObj->doc->section("", $manyTemplatesMenu);
                $theOutput .= $this->pObj->doc->divider(5);
            }
            if ($POST["add_property"] || $POST["update_value"] || $POST["clear_object"]) {
                // add property
                $line = "";
                if (is_array($POST["data"])) {
                    $name = key($POST["data"]);
                    if ($POST['data'][$name]['name'] !== '') {
                        // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
                        unset($POST['update_value']);
                        $POST['add_property'] = 'Add';
                    }
                    if ($POST["add_property"]) {
                        $property = trim($POST['data'][$name]['name']);
                        if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
                            $badPropertyMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('noSpaces') . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated'), $GLOBALS['LANG']->getLL('badProperty'), t3lib_FlashMessage::ERROR);
                            t3lib_FlashMessageQueue::addMessage($badPropertyMessage);
                        } else {
                            $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
                            $propertyAddedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('propertyAdded'));
                            t3lib_FlashMessageQueue::addMessage($propertyAddedMessage);
                            $line .= LF . $pline;
                        }
                    } elseif ($POST['update_value']) {
                        $pline = $name . " = " . trim($POST['data'][$name]['value']);
                        $updatedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('valueUpdated'));
                        t3lib_FlashMessageQueue::addMessage($updatedMessage);
                        $line .= LF . $pline;
                    } elseif ($POST['clear_object']) {
                        if ($POST['data'][$name]['clearValue']) {
                            $pline = $name . ' >';
                            $objectClearedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('objectCleared'));
                            t3lib_FlashMessageQueue::addMessage($objectClearedMessage);
                            $line .= LF . $pline;
                        }
                    }
                }
                if ($line) {
                    $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
                    // Set the data to be saved
                    $recData = array();
                    $field = $bType == "setup" ? "config" : "constants";
                    $recData["sys_template"][$saveId][$field] = $tplRow[$field] . $line;
                    // Create new  tce-object
                    $tce = t3lib_div::makeInstance("t3lib_TCEmain");
                    $tce->stripslashes_values = 0;
                    // Initialize
                    $tce->start($recData, array());
                    // Saved the stuff
                    $tce->process_datamap();
                    // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                    $tce->clear_cacheCmd("all");
                    // re-read the template ...
                    $this->initialize_editor($this->pObj->id, $template_uid);
                }
            }
        }
        $tsbr = t3lib_div::_GET('tsbr');
        $update = 0;
        if (is_array($tsbr)) {
            // If any plus-signs were clicked, it's registred.
            $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_" . $bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_" . $bType]);
            $update = 1;
        }
        if ($POST["Submit"]) {
            // If any POST-vars are send, update the condition array
            $this->pObj->MOD_SETTINGS["tsbrowser_conditions"] = $POST["conditions"];
            $update = 1;
        }
        if ($update) {
            $GLOBALS["BE_USER"]->pushModuleData($this->pObj->MCONF["name"], $this->pObj->MOD_SETTINGS);
        }
        $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
        $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
        // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
        $tmpl->constantMode = $this->pObj->MOD_SETTINGS["ts_browser_const"];
        if ($this->pObj->sObj && $tmpl->constantMode) {
            $tmpl->constantMode = "untouched";
        }
        $tmpl->regexMode = $this->pObj->MOD_SETTINGS["ts_browser_regexsearch"];
        $tmpl->fixedLgd = $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"];
        $tmpl->linkObjects = TRUE;
        $tmpl->ext_regLinenumbers = TRUE;
        $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
        $tmpl->bType = $bType;
        $tmpl->resourceCheck = 1;
        $tmpl->uplPath = PATH_site . $tmpl->uplPath;
        $tmpl->removeFromGetFilePath = PATH_site;
        //debug($tmpl->uplPath);
        if ($this->pObj->MOD_SETTINGS["ts_browser_type"] == "const") {
            $tmpl->ext_constants_BRP = intval(t3lib_div::_GP("breakPointLN"));
        } else {
            $tmpl->ext_config_BRP = intval(t3lib_div::_GP("breakPointLN"));
        }
        $tmpl->generateConfig();
        if ($bType == "setup") {
            $theSetup = $tmpl->setup;
        } else {
            $theSetup = $tmpl->setup_constants;
        }
        // EDIT A VALUE:
        if ($this->pObj->sObj) {
            list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : "");
            if ($existTemplate) {
                // Value
                $out = '';
                $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
                $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
                // Property
                if (t3lib_extMgm::isLoaded("tsconfig_help")) {
                    $url = $BACK_PATH . "wizard_tsconfig.php?mode=tsref&onlyProperty=1";
                    $params = array();
                    $params["formName"] = "editForm";
                    $params["itemName"] = "data[" . htmlspecialchars($this->pObj->sObj) . "][name]";
                    $params["itemValue"] = "data[" . htmlspecialchars($this->pObj->sObj) . "][propertyValue]";
                    $TSicon = '<a href="#" onClick="vHWin=window.open(\'' . $url . t3lib_div::implodeArrayForUrl("", array("P" => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;"><img src="' . $BACK_PATH . 'gfx/wizard_tsconfig_s.gif" width="22" height="16" border="0" class="absmiddle" hspace=2 title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef') . '"></a>';
                } else {
                    $TSicon = "";
                }
                $out = '';
                $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
                $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
                // clear
                $out = '';
                $out = htmlspecialchars($this->pObj->sObj) . " <strong>" . $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper') . "</strong> &nbsp;&nbsp;";
                $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
                $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
                $theOutput .= $this->pObj->doc->spacer(10);
            } else {
                $noTemplateMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('noCurrentTemplate'), $GLOBALS['LANG']->getLL('edit'), t3lib_FlashMessage::ERROR);
                t3lib_FlashMessageQueue::addMessage($noTemplateMessage);
            }
            // Links:
            $out = '';
            if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) {
                if (count($theSetup)) {
                    $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj) . '">';
                    $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
                }
            } else {
                $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0">';
                $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
            }
            if ($out) {
                $theOutput .= $this->pObj->doc->divider(5);
                $theOutput .= $this->pObj->doc->section("", $out);
            }
            // back
            $out = $GLOBALS['LANG']->getLL('back');
            $out = '<a href="index.php?id=' . $this->pObj->id . '"><strong>' . $out . '</strong></a>';
            $theOutput .= $this->pObj->doc->divider(5);
            $theOutput .= $this->pObj->doc->section("", $out);
        } else {
            $tmpl->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_" . $bType];
            if (t3lib_div::_POST('search') && t3lib_div::_POST('search_field')) {
                // If any POST-vars are send, update the condition array
                $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', t3lib_div::_POST('search_field'), array());
            }
            $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
            $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
            $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
            $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]);
            //search
            $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') . '</label>';
            $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
            $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />';
            $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
            $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
            $theKey = $this->pObj->MOD_SETTINGS["ts_browser_toplevel_" . $bType];
            if (!$theKey || !str_replace("-", "", $theKey)) {
                $theKey = "";
            }
            list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
            $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
            $tree = $tmpl->substituteCMarkers($tree);
            // Parser Errors:
            $pEkey = $bType == "setup" ? "config" : "constants";
            if (count($tmpl->parserErrors[$pEkey])) {
                $errMsg = array();
                foreach ($tmpl->parserErrors[$pEkey] as $inf) {
                    $errMsg[] = $inf[1] . ": &nbsp; &nbsp;" . $inf[0];
                }
                $theOutput .= $this->pObj->doc->spacer(10);
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', implode($errMsg, '<br />'), $GLOBALS['LANG']->getLL('errorsWarnings'), t3lib_FlashMessage::ERROR);
                $theOutput .= $flashMessage->render();
            }
            if (isset($this->pObj->MOD_SETTINGS["ts_browser_TLKeys_" . $bType][$theKey])) {
                $remove = '<td width="1%" nowrap><a href="index.php?id=' . $this->pObj->id . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0"><strong>' . $GLOBALS['LANG']->getLL('removeKey') . '</strong></a></td>';
            } else {
                $remove = '';
            }
            $label = $theKey ? $theKey : ($bType == 'setup' ? $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') : $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper'));
            $theOutput .= $this->pObj->doc->spacer(15);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $theOutput .= '<table border="0" cellpadding="1" cellspacing="0" id="typo3-objectBrowser" width="100%">
					<tr>
						<td><img src=clear.gif width=4 height=1></td>
						<td class="bgColor2">
							<table border=0 cellpadding=0 cellspacing=0 class="bgColor5" width="100%"><tr class="t3-row-header"><td nowrap width="99%"><strong>' . $label . '</strong></td>' . $remove . '</tr></table>
						</td>
					</tr>
					<tr>
						<td><img src=clear.gif width=4 height=1></td>
						<td class="bgColor2">
							<table border=0 cellpadding=0 cellspacing=0 class="bgColor4" width="100%"><tr><td nowrap>' . $tree . '</td></tr></table></td>
					</tr>
				</table>
			';
            // second row options
            $menu = '<div class="tsob-menu-row2">';
            $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
            $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
            $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
            $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
            $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"], '', '', 'id="checkTs_browser_fixedLgd"');
            $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
            if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
                $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
                $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
            }
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
            // Conditions:
            if (is_array($tmpl->sections)) {
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
                $out = '';
                foreach ($tmpl->sections as $key => $val) {
                    $out .= '<tr><td nowrap class="tsob-conditions"><input type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? " checked" : "") . ' />';
                    $out .= '<label for="check' . $key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>';
                }
                $theOutput .= '
								<table border="0" cellpadding="0" cellspacing="0" class="bgColor4">' . $out . '
						<td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" /></td>
								</table>

				';
            }
            // Ending section:
            $theOutput .= $this->pObj->doc->sectionEnd();
        }
        return $theOutput;
    }
 /**
  * Wrapping the title in a link, if applicable.
  *
  * @param	string		Title, ready for output.
  * @param	array		The record
  * @param	boolean		If set, pages clicked will return immediately, otherwise reload page.
  * @return	string		Wrapping title string.
  */
 function wrapTitle($title, $v, $ext_pArrPages)
 {
     if ($ext_pArrPages) {
         $ficon = t3lib_iconWorks::getIcon('pages', $v);
         $onClick = "return insertElement('pages', '" . $v['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($v['title']) . ", '', '', '" . $ficon . "','',1);";
     } else {
         $onClick = htmlspecialchars('return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid'] . '\');');
     }
     return '<a href="#" onclick="' . $onClick . '">' . $title . '</a>';
 }
 /**
  * Adds records from a foreign table (for selector boxes)
  *
  * @param	array		The array of items (label,value,icon)
  * @param	array		The 'columns' array for the field (from TCA)
  * @param	array		TSconfig for the table/row
  * @param	string		The fieldname
  * @param	boolean		If set, then we are fetching the 'neg_' foreign tables.
  * @return	array		The $items array modified.
  * @see addSelectOptionsToItemArray(), t3lib_BEfunc::exec_foreign_table_where_query()
  */
 function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = 0)
 {
     global $TCA;
     // Init:
     $pF = $pFFlag ? 'neg_' : '';
     $f_table = $fieldValue['config'][$pF . 'foreign_table'];
     $uidPre = $pFFlag ? '-' : '';
     // Get query:
     $res = t3lib_BEfunc::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF);
     // Perform lookup
     if ($GLOBALS['TYPO3_DB']->sql_error()) {
         echo $GLOBALS['TYPO3_DB']->sql_error() . "\n\nThis may indicate a table defined in tables.php is not existing in the database!";
         return array();
     }
     // Get label prefix.
     $lPrefix = $this->sL($fieldValue['config'][$pF . 'foreign_table_prefix']);
     // Get icon field + path if any:
     $iField = $TCA[$f_table]['ctrl']['selicon_field'];
     $iPath = trim($TCA[$f_table]['ctrl']['selicon_field_path']);
     // Traverse the selected rows to add them:
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         t3lib_BEfunc::workspaceOL($f_table, $row);
         if (is_array($row)) {
             // Prepare the icon if available:
             if ($iField && $iPath && $row[$iField]) {
                 $iParts = t3lib_div::trimExplode(',', $row[$iField], 1);
                 $icon = '../' . $iPath . '/' . trim($iParts[0]);
             } elseif (t3lib_div::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) {
                 $icon = '../' . TYPO3_mainDir . t3lib_iconWorks::skinImg($this->backPath, t3lib_iconWorks::getIcon($f_table, $row), '', 1);
             } else {
                 $icon = '';
             }
             // Add the item:
             $items[] = array($lPrefix . htmlspecialchars(t3lib_BEfunc::getRecordTitle($f_table, $row)), $uidPre . $row['uid'], $icon);
         }
     }
     return $items;
 }
    /**
     * Displays the edit page screen if the currently selected page is of the doktype "Sysfolder"
     *
     * @param	array		$pageRecord: The current page record
     * @return	mixed		HTML output from this submodule or FALSE if this submodule doesn't feel responsible
     * @access	public
     */
    function renderDoktype_254($pageRecord)
    {
        global $LANG, $BE_USER, $TYPO3_CONF_VARS;
        // Prepare the record icon including a content sensitive menu link wrapped around it:
        $pageTitle = htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle('pages', $pageRecord), 50));
        $recordIcon = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, t3lib_iconWorks::getIcon('pages', $pageRecord), '') . ' style="text-align: center; vertical-align: middle;" width="18" height="16" border="0" title="' . $pageTitle . '" alt="" />';
        $editButton = $this->pObj->link_edit('<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/edit2.gif', '') . ' title="' . htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage')) . '" alt="" style="text-align: center; vertical-align: middle; border:0;" />', 'pages', $pageRecord['uid']);
        if ($this->userHasAccessToListModule()) {
            $listModuleURL = $this->doc->backPath . 'db_list.php?id=' . intval($this->pObj->id);
            $onClick = "top.nextLoadModuleUrl='" . $listModuleURL . "';top.fsMod.recentIds['web']=" . intval($this->pObj->id) . ";top.goToModule('web_list',1);";
            $listModuleLink = '<br /><br />
				<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'mod/web/list/list.gif', '') . ' style="text-align:center; vertical-align: middle; border:0;" />
				<strong><a href="#" onClick="' . $onClick . '">' . $LANG->getLL('editpage_sysfolder_switchtolistview', '', 1) . '</a></strong>
			';
        } else {
            $listModuleLink = $LANG->getLL('editpage_sysfolder_listview_noaccess', '', 1);
        }
        $content = $this->doc->icons(1) . $LANG->getLL('editpage_sysfolder_intro', '', 1) . $listModuleLink;
        return $content;
    }
 private function getDummyIconPath()
 {
     $icon = t3lib_iconWorks::getIcon('tx_news_domain_model_tag');
     return t3lib_iconWorks::skinImg('', $icon, '', 1);
 }