/**
  * Render javascript in header
  *
  * @return string the rendered page info icon
  * @see template::getPageInfo() Note: can't call this method as it's protected!
  */
 public function render()
 {
     $doc = $this->getDocInstance();
     $id = t3lib_div::_GP('id');
     $pageRecord = t3lib_BEfunc::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Add icon with clickmenu, etc:
     if ($pageRecord['uid']) {
         // If there IS a real page
         $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages');
         $iconImg = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext)));
         // Make Icon:
         $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
     } else {
         // On root-level of page tree
         // Make Icon
         $iconImg = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />';
         if ($BE_USER->user['admin']) {
             $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0);
         } else {
             $theIcon = $iconImg;
         }
     }
     // Setting icon with clickmenu + uid
     $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>';
     return $pageInfo;
 }
 /**
  * Render the sprite icon
  *
  * @param string $table table name
  * @param integer $uid uid of record
  * @param string $title title
  * @return string sprite icon
  */
 public function render($table, $uid, $title)
 {
     $icon = '';
     $row = t3lib_BEfunc::getRecord($table, $uid);
     if (is_array($row)) {
         $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($title)));
     }
     return $icon;
 }
 /**
  * Create selector for workspaces and change workspace if command is given to do that.
  *
  * @return	string		HTML
  */
 function workspaceSelector()
 {
     global $TYPO3_DB, $BE_USER, $LANG;
     // Changing workspace and if so, reloading entire backend:
     if (strlen($this->changeWorkspace)) {
         $BE_USER->setWorkspace($this->changeWorkspace);
         return $this->doc->wrapScriptTags('top.location.href="' . t3lib_BEfunc::getBackendScript() . '";');
     }
     // Changing workspace and if so, reloading entire backend:
     if (strlen($this->changeWorkspacePreview)) {
         $BE_USER->setWorkspacePreview($this->changeWorkspacePreview);
     }
     // Create options array:
     $options = array();
     if ($BE_USER->checkWorkspace(array('uid' => 0))) {
         $options[0] = '[' . $LANG->getLL('shortcut_onlineWS') . ']';
     }
     if ($BE_USER->checkWorkspace(array('uid' => -1))) {
         $options[-1] = '[' . $LANG->getLL('shortcut_offlineWS') . ']';
     }
     // Add custom workspaces (selecting all, filtering by BE_USER check):
     $workspaces = $TYPO3_DB->exec_SELECTgetRows('uid,title,adminusers,members,reviewers', 'sys_workspace', 'pid=0' . t3lib_BEfunc::deleteClause('sys_workspace'), '', 'title');
     if (count($workspaces)) {
         foreach ($workspaces as $rec) {
             if ($BE_USER->checkWorkspace($rec)) {
                 $options[$rec['uid']] = $rec['uid'] . ': ' . $rec['title'];
             }
         }
     }
     // Build selector box:
     if (count($options)) {
         foreach ($options as $value => $label) {
             $selected = (int) $BE_USER->workspace === $value ? ' selected="selected"' : '';
             $options[$value] = '<option value="' . htmlspecialchars($value) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>';
         }
     } else {
         $options[] = '<option value="-99">' . $LANG->getLL('shortcut_noWSfound', 1) . '</option>';
     }
     $selector = '';
     // Preview:
     if ($BE_USER->workspace !== 0) {
         $selector .= '<label for="workspacePreview">Frontend Preview:</label> <input type="checkbox" name="workspacePreview" id="workspacePreview" onclick="changeWorkspacePreview(' . ($BE_USER->user['workspace_preview'] ? 0 : 1) . ')"; ' . ($BE_USER->user['workspace_preview'] ? 'checked="checked"' : '') . '/>&nbsp;';
     }
     $selector .= '<a href="mod/user/ws/index.php" target="content">' . t3lib_iconWorks::getSpriteIconForRecord('sys_workspace', array()) . '</a>';
     if (count($options) > 1) {
         $selector .= '<select name="_workspaceSelector" onchange="changeWorkspace(this.options[this.selectedIndex].value);">' . implode('', $options) . '</select>';
     }
     return $selector;
 }
Beispiel #4
0
    /**
     * Creating the module output.
     *
     * @return	void
     * @todo	provide position mapping if no position is given already. Like the columns selector but for our cascading element style ...
     */
    function main()
    {
        global $LANG, $BACK_PATH;
        if ($this->id && $this->access) {
            // Creating content
            $this->content = $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
            $elRow = t3lib_BEfunc::getRecordWSOL('pages', $this->id);
            $header = t3lib_iconWorks::getSpriteIconForRecord('pages', $elRow);
            $header .= t3lib_BEfunc::getRecordTitle('pages', $elRow, 1);
            $this->content .= $this->doc->section('', $header, 0, 1);
            $this->content .= $this->doc->spacer(10);
            // Wizard
            $wizardCode = '';
            $tableRows = array();
            $wizardItems = $this->getWizardItems();
            // Wrapper for wizards
            $this->elementWrapper['sectionHeader'] = array('<h3 class="bgColor5">', '</h3>');
            $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>');
            $this->elementWrapper['wizard'] = array('<tr>', '</tr>');
            $this->elementWrapper['wizardPart'] = array('<td>', '</td>');
            // copy wrapper for tabs
            $this->elementWrapperForTabs = $this->elementWrapper;
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['templavoila']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['templavoila']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = t3lib_div::getUserObj($classData);
                    if (!$hookObject instanceof cms_newContentElementWizardsHook) {
                        throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
                // restore wrapper for tabs if they are overwritten in hook
                $this->elementWrapper = $this->elementWrapperForTabs;
            }
            // add document inline javascript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function goToalt_doc()	{	//
					' . $this->onClickEvent . '
				}

				Event.observe(window, \'load\', function() {
					if(top.refreshMenu) {
						top.refreshMenu();
					} else {
						top.TYPO3ModuleMenu.refreshMenu();
					}

					if(top.shortcutFrame) {
						top.shortcutFrame.refreshShortcuts();
					}
				});
			');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a title/description and icon:
            $counter = 0;
            foreach ($wizardItems as $k => $wInfo) {
                if ($wInfo['header']) {
                    $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]);
                    $key = count($menuItems) - 1;
                } else {
                    $content = '';
                    // href URI for icon/title:
                    $newRecordLink = 'index.php?' . $this->linkParams() . '&createNewRecord=' . rawurlencode($this->parentRecord) . $wInfo['params'];
                    // Icon:
                    $iInfo = @getimagesize($wInfo['icon']);
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="' . htmlspecialchars($newRecordLink) . '">
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1];
                    // Title + description:
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="' . htmlspecialchars($newRecordLink) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1];
                    // Finally, put it together in a container:
                    $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1];
                }
            }
            // add closing section-tag
            foreach ($menuItems as $key => $val) {
                $menuItems[$key]['content'] .= $this->elementWrapper['section'][1];
            }
            // Add the wizard table to the content, wrapped in tabs:
            if ($this->config['renderMode'] == 'tabs') {
                $this->doc->inDocStylesArray[] = '
					.typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #000; width: 680px; }
					.typo3-dyntabmenu-divs table { margin: 15px; }
					.typo3-dyntabmenu-divs table td { padding: 3px; }
				';
                $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100);
            } else {
                $code = $LANG->getLL('sel1', 1) . '<br /><br />';
                foreach ($menuItems as $section) {
                    $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content'];
                }
            }
            $this->content .= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1);
        } else {
            // In case of no access:
            $this->content = $this->doc->header($LANG->getLL('newContentElement'));
        }
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $docHeaderButtons = $this->getDocHeaderButtons();
        $docContent = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content);
        $content = $this->doc->startPage($LANG->getLL('newContentElement'));
        $content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $docContent);
        $content .= $this->doc->endPage();
        // Replace content with templated content
        $this->content = $content;
    }
 /**
  * Creating the module output.
  *
  * @return	void
  */
 function main()
 {
     global $LANG, $BACK_PATH, $BE_USER;
     if ($this->page_id) {
         // Get record for element:
         $elRow = t3lib_BEfunc::getRecordWSOL($this->table, $this->moveUid);
         // Headerline: Icon, record title:
         $hline = t3lib_iconWorks::getSpriteIconForRecord($this->table, $elRow, array('id' => "c-recIcon", 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow, $this->table))));
         $hline .= t3lib_BEfunc::getRecordTitle($this->table, $elRow, TRUE);
         // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
         $onClick = 'window.location.href=\'' . t3lib_div::linkThisScript(array('makeCopy' => !$this->makeCopy)) . '\';';
         $hline .= '<br /><input type="hidden" name="makeCopy" value="0" /><input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy">' . $LANG->getLL('makeCopy', 1) . '</label>';
         // Add the header-content to the module content:
         $this->content .= $this->doc->section($LANG->getLL('moveElement') . ':', $hline, 0, 1);
         $this->content .= $this->doc->spacer(20);
         // Reset variable to pick up the module content in:
         $code = '';
         // IF the table is "pages":
         if ((string) $this->table == 'pages') {
             // Get page record (if accessible):
             $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = t3lib_div::makeInstance('ext_posMap_pages');
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 if ($pageinfo['pid']) {
                     $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree:
                 $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
             }
         }
         // IF the table is "tt_content":
         if ((string) $this->table == 'tt_content') {
             // First, get the record:
             $tt_content_rec = t3lib_BEfunc::getRecord('tt_content', $this->moveUid);
             // ?
             if (!$this->input_moveUid) {
                 $this->page_id = $tt_content_rec['pid'];
             }
             // Checking if the parent page is readable:
             $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = t3lib_div::makeInstance('ext_posMap_tt_content');
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 $posMap->cur_sys_language = $this->sys_language;
                 // Headerline for the parent page: Icon, record title:
                 $hline = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageinfo, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($pageinfo, 'pages'))));
                 $hline .= t3lib_BEfunc::getRecordTitle('pages', $pageinfo, TRUE);
                 // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->page_id, 'mod.SHARED');
                 // SHARED page-TSconfig settings.
                 $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                 $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList)));
                 // Removing duplicates, if any
                 // Adding parent page-header and the content element columns from position-map:
                 $code = $hline . '<br />';
                 $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI);
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 $code .= '<br />';
                 $code .= '<br />';
                 if ($pageinfo['pid']) {
                     $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree (for pages):
                 $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
             }
         }
         // Add the $code content as a new section to the module:
         $this->content .= $this->doc->section($LANG->getLL('selectPositionOfElement') . ':', $code, 0, 1);
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($LANG->getLL('movingElement'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Beispiel #6
0
    /**
     * Export part of module
     *
     * @param	array		Content of POST VAR tx_impexp[]..
     * @return	void		Setting content in $this->content
     */
    function exportData($inData)
    {
        global $TCA, $LANG;
        // BUILDING EXPORT DATA:
        // Processing of InData array values:
        $inData['pagetree']['maxNumber'] = t3lib_div::intInRange($inData['pagetree']['maxNumber'], 1, 10000, 100);
        $inData['listCfg']['maxNumber'] = t3lib_div::intInRange($inData['listCfg']['maxNumber'], 1, 10000, 100);
        $inData['maxFileSize'] = t3lib_div::intInRange($inData['maxFileSize'], 1, 10000, 1000);
        $inData['filename'] = trim(preg_replace('/[^[:alnum:]._-]*/', '', preg_replace('/\\.(t3d|xml)$/', '', $inData['filename'])));
        if (strlen($inData['filename'])) {
            $inData['filename'] .= $inData['filetype'] == 'xml' ? '.xml' : '.t3d';
        }
        // Set exclude fields in export object:
        if (!is_array($inData['exclude'])) {
            $inData['exclude'] = array();
        }
        // Saving/Loading/Deleting presets:
        $this->processPresets($inData);
        // Create export object and configure it:
        $this->export = t3lib_div::makeInstance('tx_impexp');
        $this->export->init(0, 'export');
        $this->export->setCharset($LANG->charSet);
        $this->export->maxFileSize = $inData['maxFileSize'] * 1024;
        $this->export->excludeMap = (array) $inData['exclude'];
        $this->export->softrefCfg = (array) $inData['softrefCfg'];
        $this->export->extensionDependencies = (array) $inData['extension_dep'];
        $this->export->showStaticRelations = $inData['showStaticRelations'];
        $this->export->includeExtFileResources = !$inData['excludeHTMLfileResources'];
        // Static tables:
        if (is_array($inData['external_static']['tables'])) {
            $this->export->relStaticTables = $inData['external_static']['tables'];
        }
        // Configure which tables external relations are included for:
        if (is_array($inData['external_ref']['tables'])) {
            $this->export->relOnlyTables = $inData['external_ref']['tables'];
        }
        $this->export->setHeaderBasics();
        // Meta data setting:
        $this->export->setMetaData($inData['meta']['title'], $inData['meta']['description'], $inData['meta']['notes'], $GLOBALS['BE_USER']->user['username'], $GLOBALS['BE_USER']->user['realName'], $GLOBALS['BE_USER']->user['email']);
        if ($inData['meta']['thumbnail']) {
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = t3lib_div::getFilesInDir($tempDir, 'png,gif,jpg', 1);
                $theThumb = $thumbnails[$inData['meta']['thumbnail']];
                if ($theThumb) {
                    $this->export->addThumbnail($theThumb);
                }
            }
        }
        // Configure which records to export
        if (is_array($inData['record'])) {
            foreach ($inData['record'] as $ref) {
                $rParts = explode(':', $ref);
                $this->export->export_addRecord($rParts[0], t3lib_BEfunc::getRecord($rParts[0], $rParts[1]));
            }
        }
        // Configure which tables to export
        if (is_array($inData['list'])) {
            foreach ($inData['list'] as $ref) {
                $rParts = explode(':', $ref);
                if ($GLOBALS['BE_USER']->check('tables_select', $rParts[0])) {
                    $res = $this->exec_listQueryPid($rParts[0], $rParts[1], t3lib_div::intInRange($inData['listCfg']['maxNumber'], 1));
                    while ($subTrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                        $this->export->export_addRecord($rParts[0], $subTrow);
                    }
                }
            }
        }
        // Pagetree
        if (isset($inData['pagetree']['id'])) {
            if ($inData['pagetree']['levels'] == -1) {
                // Based on click-expandable tree
                $pagetree = t3lib_div::makeInstance('localPageTree');
                $tree = $pagetree->ext_tree($inData['pagetree']['id'], $this->filterPageIds($this->export->excludeMap));
                $this->treeHTML = $pagetree->printTree($tree);
                $idH = $pagetree->buffer_idH;
            } elseif ($inData['pagetree']['levels'] == -2) {
                // Only tables on page
                $this->addRecordsForPid($inData['pagetree']['id'], $inData['pagetree']['tables'], $inData['pagetree']['maxNumber']);
            } else {
                // Based on depth
                // Drawing tree:
                // If the ID is zero, export root
                if (!$inData['pagetree']['id'] && $GLOBALS['BE_USER']->isAdmin()) {
                    $sPage = array('uid' => 0, 'title' => 'ROOT');
                } else {
                    $sPage = t3lib_BEfunc::getRecordWSOL('pages', $inData['pagetree']['id'], '*', ' AND ' . $this->perms_clause);
                }
                if (is_array($sPage)) {
                    $pid = $inData['pagetree']['id'];
                    $tree = t3lib_div::makeInstance('t3lib_pageTree');
                    $tree->init('AND ' . $this->perms_clause . $this->filterPageIds($this->export->excludeMap));
                    $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $sPage);
                    $tree->tree[] = array('row' => $sPage, 'HTML' => $HTML);
                    $tree->buffer_idH = array();
                    if ($inData['pagetree']['levels'] > 0) {
                        $tree->getTree($pid, $inData['pagetree']['levels'], '');
                    }
                    $idH = array();
                    $idH[$pid]['uid'] = $pid;
                    if (count($tree->buffer_idH)) {
                        $idH[$pid]['subrow'] = $tree->buffer_idH;
                    }
                    $pagetree = t3lib_div::makeInstance('localPageTree');
                    $this->treeHTML = $pagetree->printTree($tree->tree);
                }
            }
            // In any case we should have a multi-level array, $idH, with the page structure here (and the HTML-code loaded into memory for nice display...)
            if (is_array($idH)) {
                $flatList = $this->export->setPageTree($idH);
                // Sets the pagetree and gets a 1-dim array in return with the pages (in correct submission order BTW...)
                foreach ($flatList as $k => $value) {
                    $this->export->export_addRecord('pages', t3lib_BEfunc::getRecord('pages', $k));
                    $this->addRecordsForPid($k, $inData['pagetree']['tables'], $inData['pagetree']['maxNumber']);
                }
            }
        }
        // After adding ALL records we set relations:
        for ($a = 0; $a < 10; $a++) {
            $addR = $this->export->export_addDBRelations($a);
            if (!count($addR)) {
                break;
            }
        }
        // Finally files are added:
        $this->export->export_addFilesFromRelations();
        // MUST be after the DBrelations are set so that files from ALL added records are included!
        // If the download button is clicked, return file
        if ($inData['download_export'] || $inData['save_export']) {
            switch ((string) $inData['filetype']) {
                case 'xml':
                    $out = $this->export->compileMemoryToFileContent('xml');
                    $fExt = '.xml';
                    break;
                case 't3d':
                    $this->export->dontCompress = 1;
                default:
                    $out = $this->export->compileMemoryToFileContent();
                    $fExt = ($this->export->doOutputCompress() ? '-z' : '') . '.t3d';
                    break;
            }
            // Filename:
            $dlFile = $inData['filename'] ? $inData['filename'] : 'T3D_' . substr(preg_replace('/[^[:alnum:]_]/', '-', $inData['download_export_name']), 0, 20) . '_' . date('d-m-H-i-s') . $fExt;
            // Export for download:
            if ($inData['download_export']) {
                $mimeType = 'application/octet-stream';
                Header('Content-Type: ' . $mimeType);
                Header('Content-Length: ' . strlen($out));
                Header('Content-Disposition: attachment; filename=' . basename($dlFile));
                echo $out;
                exit;
            }
            // Export by saving:
            if ($inData['save_export']) {
                $savePath = $this->userSaveFolder();
                $fullName = $savePath . $dlFile;
                if (t3lib_div::isAllowedAbsPath($savePath) && @is_dir(dirname($fullName)) && t3lib_div::isAllowedAbsPath($fullName)) {
                    t3lib_div::writeFile($fullName, $out);
                    $this->content .= $this->doc->section($LANG->getLL('exportdata_savedFile'), sprintf($LANG->getLL('exportdata_savedInSBytes', 1), substr($savePath . $dlFile, strlen(PATH_site)), t3lib_div::formatSize(strlen($out))), 0, 1);
                } else {
                    $this->content .= $this->doc->section($LANG->getLL('exportdata_problemsSavingFile'), sprintf($LANG->getLL('exportdata_badPathS', 1), $fullName), 0, 1, 2);
                }
            }
        }
        // OUTPUT to BROWSER:
        // Now, if we didn't make download file, show configuration form based on export:
        $menuItems = array();
        // Export configuration
        $row = array();
        $this->makeConfigurationForm($inData, $row);
        $menuItems[] = array('label' => $LANG->getLL('tableselec_configuration'), 'content' => '
				<table border="0" cellpadding="1" cellspacing="1">
					' . implode('
					', $row) . '
				</table>
			');
        // File options
        $row = array();
        $this->makeSaveForm($inData, $row);
        $menuItems[] = array('label' => $LANG->getLL('exportdata_filePreset'), 'content' => '
				<table border="0" cellpadding="1" cellspacing="1">
					' . implode('
					', $row) . '
				</table>
			');
        // File options
        $row = array();
        $this->makeAdvancedOptionsForm($inData, $row);
        $menuItems[] = array('label' => $LANG->getLL('exportdata_advancedOptions'), 'content' => '
				<table border="0" cellpadding="1" cellspacing="1">
					' . implode('
					', $row) . '
				</table>
			');
        // Generate overview:
        $overViewContent = $this->export->displayContentOverview();
        // Print errors that might be:
        $errors = $this->export->printErrorLog();
        $menuItems[] = array('label' => $LANG->getLL('exportdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0);
        // Add hidden fields and create tabs:
        $content = $this->doc->getDynTabMenu($menuItems, 'tx_impexp_export', -1);
        $content .= '<input type="hidden" name="tx_impexp[action]" value="export" />';
        $this->content .= $this->doc->section('', $content, 0, 1);
        // Output Overview:
        $this->content .= $this->doc->section($LANG->getLL('execlistqu_structureToBeExported'), $overViewContent, 0, 1);
    }
 /**
  * Setting page icon with clickmenu + uid for docheader
  *
  * @param 	array	Current page
  * @return	string	Page info
  */
 protected function getPageInfo($pageRecord)
 {
     global $BE_USER;
     // Add icon with clickmenu, etc:
     if ($pageRecord['uid']) {
         // If there IS a real page
         $alttext = t3lib_BEfunc::getRecordIconAltText($pageRecord, 'pages');
         $iconImg = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord, array('title' => $alttext));
         // Make Icon:
         $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
         $uid = $pageRecord['uid'];
         $title = t3lib_BEfunc::getRecordTitle('pages', $pageRecord);
     } else {
         // On root-level of page tree
         // Make Icon
         $iconImg = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root', array('title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']));
         if ($BE_USER->user['admin']) {
             $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', 0);
         } else {
             $theIcon = $iconImg;
         }
         $uid = '0';
         $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
     }
     // Setting icon with clickmenu + uid
     $pageInfo = $theIcon . '<strong>' . htmlspecialchars($title) . '&nbsp;[' . $uid . ']</strong>';
     return $pageInfo;
 }
Beispiel #8
0
 /**
  * Renders localized elements of a record
  *
  * @param	array		$contentTreeArr: Part of the contentTreeArr for the element
  * @param	array		$entries: Entries accumulated in this array (passed by reference)
  * @param	integer		$indentLevel: Indentation level
  * @return	string		HTML
  * @access protected
  * @see 	render_framework_singleSheet()
  */
 function render_outline_localizations($contentTreeArr, &$entries, $indentLevel)
 {
     global $LANG, $BE_USER;
     if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) {
         // Traverse the available languages of the page (not default and [All])
         foreach ($this->translatedLanguagesArr as $sys_language_uid => $sLInfo) {
             if ($sys_language_uid > 0 && $BE_USER->checkLanguageAccess($sys_language_uid)) {
                 switch ((string) $contentTreeArr['localizationInfo'][$sys_language_uid]['mode']) {
                     case 'exists':
                         // Get localized record:
                         $olrow = t3lib_BEfunc::getRecordWSOL('tt_content', $contentTreeArr['localizationInfo'][$sys_language_uid]['localization_uid']);
                         // Put together the records icon including content sensitive menu link wrapped around it:
                         $recordIcon_l10n = $this->getRecordStatHookValue('tt_content', $olrow['uid']) . t3lib_iconWorks::getSpriteIconForRecord('tt_content', $olrow);
                         if (!$this->translatorMode) {
                             $recordIcon_l10n = $this->doc->wrapClickMenuOnIcon($recordIcon_l10n, 'tt_content', $olrow['uid'], 1, '&amp;callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter');
                         }
                         list($flagLink_begin, $flagLink_end) = explode('|*|', $this->link_edit('|*|', 'tt_content', $olrow['uid'], TRUE));
                         // Create entry for this element:
                         $entries[] = array('indentLevel' => $indentLevel, 'icon' => $recordIcon_l10n, 'title' => t3lib_BEfunc::getRecordTitle('tt_content', $olrow), 'table' => 'tt_content', 'uid' => $olrow['uid'], 'flag' => $flagLink_begin . tx_templavoila_icons::getFlagIconForLanguage($sLInfo['flagIcon'], array('title' => $sLInfo['title'], 'alt' => $sLInfo['title'])) . $flagLink_end, 'isNewVersion' => $olrow['_ORIG_uid'] ? TRUE : FALSE);
                         break;
                 }
             }
         }
     }
 }
Beispiel #9
0
	/**
	 * Renders the display of Template Objects.
	 *
	 * @return	void
	 */
	function renderTO()	{
		if (intval($this->displayUid)>0)	{
			$row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$this->displayUid);

			if (is_array($row))	{

				$tRows=array();
				$tRows[]='
					<tr class="bgColor5">
						<td colspan="2"><strong>' . $GLOBALS['LANG']->getLL('renderTO_toDetails') . ':</strong>'.
							$this->cshItem('xMOD_tx_templavoila','mapping_to',$this->doc->backPath,'').
							'</td>
					</tr>';

					// Get title and icon:
				$icon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_tmplobj', $row);

				$title = t3lib_BEfunc::getRecordTitle('tx_templavoila_tmplobj', $row);
				$title = t3lib_BEFunc::getRecordTitlePrep($GLOBALS['LANG']->sL($title));
				$tRows[]='
					<tr class="bgColor4">
						<td>'.$GLOBALS['LANG']->getLL('templateObject').':</td>
						<td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_tmplobj', $row['uid'], 1) . $title . '</td>
					</tr>';

					// Session data
				$sessionKey = $this->MCONF['name'] . '_validatorInfo:' . $row['uid'];
				$sesDat = array('displayFile' => $row['fileref']);
				$GLOBALS['BE_USER']->setAndSaveSessionData($sessionKey, $sesDat);

					// Find the file:
				$theFile = t3lib_div::getFileAbsFileName($row['fileref'],1);
				if ($theFile && @is_file($theFile))	{
					$relFilePath = substr($theFile,strlen(PATH_site));
					$onCl = 'return top.openUrlInWindow(\''.t3lib_div::getIndpEnv('TYPO3_SITE_URL').$relFilePath.'\',\'FileView\');';
					$tRows[]='
						<tr class="bgColor4">
							<td rowspan="2">'.$GLOBALS['LANG']->getLL('templateFile').':</td>
							<td><a href="#" onclick="'.htmlspecialchars($onCl).'">'.htmlspecialchars($relFilePath).'</a></td>
						</tr>
						<tr class="bgColor4">
							<td>
								<a href="#" onclick ="openValidator(\'' .  $sessionKey . '\');return false;">
									' . t3lib_iconWorks::getSpriteIcon('extensions-templavoila-htmlvalidate') . '
									' . $GLOBALS['LANG']->getLL('validateTpl') . '
								</a>
							</td>
						</tr>';

						// Finding Data Structure Record:
					$DSOfile='';
					$dsValue = $row['datastructure'];
					if ($row['parent'])	{
						$parentRec = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj',$row['parent'],'datastructure');
						$dsValue=$parentRec['datastructure'];
					}

					if (tx_templavoila_div::canBeInterpretedAsInteger($dsValue))	{
						$DS_row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_datastructure',$dsValue);
					} else {
						$DSOfile = t3lib_div::getFileAbsFileName($dsValue);
					}
					if (is_array($DS_row) || @is_file($DSOfile))	{

							// Get main DS array:
						if (is_array($DS_row))	{
								// Get title and icon:
							$icon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_datastructure',$DS_row);
							$title = t3lib_BEfunc::getRecordTitle('tx_templavoila_datastructure', $DS_row);
							$title = t3lib_BEFunc::getRecordTitlePrep($GLOBALS['LANG']->sL($title));

							$tRows[]='
								<tr class="bgColor4">
									<td>' . $GLOBALS['LANG']->getLL('renderTO_dsRecord') . ':</td>
									<td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_datastructure', $DS_row['uid'] , 1) . $title . '</td>
								</tr>';

								// Link to updating DS/TO:
							$onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid'] . '&uid=' . $DS_row['uid'] . '&returnUrl=' . $this->returnUrl;
							$onClMsg = '
								if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('renderTO_updateWarningConfirm')) . ')) {
									document.location=\''.$onCl.'\';
								}
								return false;
								';
							$tRows[]='
								<tr class="bgColor4">
									<td>&nbsp;</td>
									<td><input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('renderTO_editDSTO') . '" onclick="'.htmlspecialchars($onClMsg).'"/>'.
										$this->cshItem('xMOD_tx_templavoila','mapping_to_modifyDSTO',$this->doc->backPath,'').
										'</td>
								</tr>';

								// Read Data Structure:
							$dataStruct = $this->getDataStructFromDSO($DS_row['dataprot']);
						} else {
								// Show filepath of external XML file:
							$relFilePath = substr($DSOfile,strlen(PATH_site));
							$onCl = 'return top.openUrlInWindow(\''.t3lib_div::getIndpEnv('TYPO3_SITE_URL').$relFilePath.'\',\'FileView\');';
							$tRows[]='
								<tr class="bgColor4">
									<td>' . $GLOBALS['LANG']->getLL('renderTO_dsFile') . ':</td>
									<td><a href="#" onclick="'.htmlspecialchars($onCl).'">'.htmlspecialchars($relFilePath).'</a></td>
								</tr>';
							$onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid'] . '&uid=' . rawurlencode($DSOfile) . '&returnUrl=' . $this->returnUrl;
							$onClMsg = '
								if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('renderTO_updateWarningConfirm')) . ')) {
									document.location=\''.$onCl.'\';
								}
								return false;
								';
							$tRows[]='
								<tr class="bgColor4">
									<td>&nbsp;</td>
									<td><input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('renderTO_editDSTO') . '" onclick="'.htmlspecialchars($onClMsg).'"/>'.
										$this->cshItem('xMOD_tx_templavoila','mapping_to_modifyDSTO',$this->doc->backPath,'').
										'</td>
								</tr>';

								// Read Data Structure:
							$dataStruct = $this->getDataStructFromDSO('',$DSOfile);
						}

							// Write header of page:
						$content.= '

							<!--
								Template Object Header:
							-->
							<h3>' . $GLOBALS['LANG']->getLL('renderTO_toInfo') . ':</h3>
							<table border="0" cellpadding="2" cellspacing="1" id="c-toHeader">
								'.implode('',$tRows).'
							</table>
						';


							// If there is a valid data structure, draw table:
						if (is_array($dataStruct))	{

							// Working on Header and Body of HTML source:

								// -- Processing the header editing --
							list($editContent,$currentHeaderMappingInfo) = $this->renderTO_editProcessing($dataStruct,$row,$theFile, 1);

									// Determine if DS is a template record and if it is a page template:
								$showBodyTag = !is_array($DS_row) || $DS_row['scope']==1 ? TRUE : FALSE;

							$parts = array();
							$parts[] = array(
								'label' => $GLOBALS['LANG']->getLL('tabTODetails'),
								'content' => $content
							);

								// -- Processing the head editing
							$headerContent.='
								<!--
									HTML header parts selection:
								-->
							<h3>'.$GLOBALS['LANG']->getLL('mappingHeadParts').': '.$this->cshItem('xMOD_tx_templavoila','mapping_to_headerParts',$this->doc->backPath,'').'</h3>
								'.$this->renderHeaderSelection($theFile,$currentHeaderMappingInfo,$showBodyTag,$editContent);

							$parts[] = array(
								'label' => $GLOBALS['LANG']->getLL('tabHeadParts'),
								'content' => $headerContent
							);

								// -- Processing the body editing --
							list($editContent,$currentMappingInfo) = $this->renderTO_editProcessing($dataStruct,$row,$theFile, 0);

							$bodyContent.='
								<!--
									Data Structure mapping table:
								-->
							<h3>'.$GLOBALS['LANG']->getLL('mappingBodyParts').':</h3>
								'.$this->renderTemplateMapper($theFile,$this->displayPath,$dataStruct,$currentMappingInfo,$editContent);

							$parts[] = array(
								'label' => $GLOBALS['LANG']->getLL('tabBodyParts'),
								'content' => $bodyContent
							);

						} else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoDSfound'), $dsValue);
					} else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoDSfound'), $dsValue);
				} else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorFileNotFound'), $row['fileref']);
			} else $content.= $GLOBALS['LANG']->getLL('error') . ': ' . sprintf($GLOBALS['LANG']->getLL('errorNoTOfound'), $this->displayUid);

			$parts[0]['content'] = $content;
		} else {
			$this->content.=$this->doc->section($GLOBALS['LANG']->getLL('templateObject').' '.$GLOBALS['LANG']->getLL('error'), $GLOBALS['LANG']->getLL('errorNoUidFound'),0,1,3);
		}

			// show tab menu
		if (is_array($parts)) {
			$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('mappingTitle'), ''.
				$this->doc->getDynTabMenu($parts,'TEMPLAVOILA:templateModule:'.$this->id, 0,0,300)
				,0,1);
		}
	}
    /**
     * Creates a menu of the tables that can be listed by this function
     * Only tables which has records on the page will be included.
     * Notice: The function also fills in the internal variable $this->activeTables with icon/titles.
     *
     * @param	integer		Page id from which we are listing records (the function will look up if there are records on the page)
     * @return	string		HTML output.
     */
    function getTableMenu($id)
    {
        global $TCA;
        // Initialize:
        $this->activeTables = array();
        $theTables = explode(',', 'tt_content,fe_users,tt_address,tt_links,tt_board,tt_guest,tt_calender,tt_products,tt_news');
        // NOTICE: This serves double function: Both being tables names (all) and for most others also being extension keys for the extensions they are related to!
        // External tables:
        if (is_array($this->externalTables)) {
            $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
        }
        // Traverse tables to check:
        foreach ($theTables as $tName) {
            // Check access and whether the proper extensions are loaded:
            if ($GLOBALS['BE_USER']->check('tables_select', $tName) && (t3lib_extMgm::isLoaded($tName) || t3lib_div::inList('fe_users,tt_content', $tName) || isset($this->externalTables[$tName]))) {
                // Make query to count records from page:
                $c = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $tName, 'pid=' . intval($id) . t3lib_BEfunc::deleteClause($tName) . t3lib_BEfunc::versioningPlaceholderClause($tName));
                // If records were found (or if "tt_content" is the table...):
                if ($c || t3lib_div::inList('tt_content', $tName)) {
                    // Add row to menu:
                    $out .= '
					<td><a href="#' . $tName . '"></a>' . t3lib_iconWorks::getSpriteIconForRecord($tName, array(), array('title' => $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'], 1))) . '</td>';
                    // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
                    $this->activeTables[$tName] = t3lib_iconWorks::getSpriteIconForRecord($tName, array(), array('title' => $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'], 1) . ': ' . $c . ' ' . $GLOBALS['LANG']->getLL('records', 1))) . '&nbsp;' . $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'], 1);
                }
            }
        }
        // Wrap cells in table tags:
        $out = '



			<!--
				Menu of tables on the page (table menu)
			-->
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
				<tr>' . $out . '
				</tr>
			</table>';
        // Return the content:
        return $out;
    }
Beispiel #11
0
    function renderList($pArray, $lines = array(), $c = 0)
    {
        if (is_array($pArray)) {
            reset($pArray);
            static $i;
            foreach ($pArray as $k => $v) {
                if (t3lib_div::testInt($k)) {
                    if (isset($pArray[$k . "_"])) {
                        $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
							<td nowrap><img src="clear.gif" width="1" height="1" hspace=' . $c * 10 . ' align="top">' . '<a href="' . t3lib_div::linkThisScript(array('id' => $k)) . '">' . t3lib_iconWorks::getSpriteIconForRecord('pages', t3lib_BEfunc::getRecordWSOL('pages', $k), array("title" => 'ID: ' . $k)) . t3lib_div::fixed_lgd_cs($pArray[$k], 30) . '</a></td>
							<td align="center">' . $pArray[$k . '_']['count'] . '</td>
							<td align="center" class="bgColor5">' . ($pArray[$k . '_']['root_max_val'] > 0 ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : "&nbsp;") . '</td>
							<td align="center">' . ($pArray[$k . '_']['root_min_val'] == 0 ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : "&nbsp;") . '</td>
							</tr>';
                    } else {
                        $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
							<td nowrap ><img src="clear.gif" width="1" height="1" hspace=' . $c * 10 . ' align=top>' . t3lib_iconWorks::getSpriteIconForRecord('pages', t3lib_BEfunc::getRecordWSOL('pages', $k)) . t3lib_div::fixed_lgd_cs($pArray[$k], 30) . '</td>
							<td align="center"></td>
							<td align="center" class="bgColor5"></td>
							<td align="center"></td>
							</tr>';
                    }
                    $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1);
                }
            }
        }
        return $lines;
    }
 /**
  * Get icon for the row.
  * If $this->iconPath and $this->iconName is set, try to get icon based on those values.
  *
  * @param	array		Item row.
  * @return	string		Image tag.
  */
 function getIcon($row)
 {
     if ($this->iconPath && $this->iconName) {
         $icon = '<img' . t3lib_iconWorks::skinImg('', $this->iconPath . $this->iconName, 'width="18" height="16"') . ' alt=""' . ($this->showDefaultTitleAttribute ? ' title="UID: ' . $row['uid'] . '"' : '') . ' />';
     } else {
         $icon = t3lib_iconWorks::getSpriteIconForRecord($this->table, $row, array('title' => $this->showDefaultTitleAttribute ? 'UID: ' . $row['uid'] : $this->getTitleAttrib($row), 'class' => 'c-recIcon'));
     }
     return $this->wrapIcon($icon, $row);
 }
 /**
  * Create record header (includes teh record icon, record title etc.)
  *
  * @param	array		Record row.
  * @return	string		HTML
  */
 function getRecordHeader($row)
 {
     $line = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($row, 'tt_content'))));
     $line .= t3lib_BEfunc::getRecordTitle('tt_content', $row, TRUE);
     return $this->wrapRecordTitle($line, $row);
 }
    /**
     * 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 NOT IN (1,3) OR (t3ver_wsid > 0 AND t3ver_wsid = ' . intval($GLOBALS['BE_USER']->workspace) . ') )' . 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']);
            if ($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon']) {
                $languageIcon = tx_templavoila_icons::getFlagIconForLanguage($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon'], array('title' => $languageLabel, 'alt' => $languageLabel));
            } else {
                $languageIcon = $languageLabel && $row['sys_language_uid'] ? '[' . $languageLabel . ']' : '';
            }
            // Prepare buttons:
            $cutButton = $this->element_getSelectButtons($elementPointerString, 'ref');
            $recordIcon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row);
            $recordButton = $this->pObj->doc->wrapClickMenuOnIcon($recordIcon, 'tt_content', $row['uid'], 1, '&callingScriptId=' . rawurlencode($this->pObj->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete');
            if ($GLOBALS['BE_USER']->workspace) {
                $wsRow = t3lib_BEfunc::getRecordWSOL('tt_content', $row['uid']);
                $isDeletedInWorkspace = $wsRow['t3ver_state'] == 2;
            } else {
                $isDeletedInWorkspace = FALSE;
            }
            if (!$isDeletedInWorkspace) {
                $elementRows[] = '
					<tr id="' . $elementPointerString . '" class="tpm-nonused-element">
						<td class="tpm-nonused-controls">' . $cutButton . $languageIcon . '</td>
						<td class="tpm-nonused-ref">' . $this->renderReferenceCount($row['uid']) . '</td>
						<td class="tpm-nonused-preview">' . $recordButton . htmlspecialchars(t3lib_BEfunc::getRecordTitle('tt_content', $row)) . '</td>
					</tr>
				';
            }
        }
        if (count($elementRows)) {
            // Control for deleting all deleteable records:
            $deleteAll = '';
            if (count($this->deleteUids)) {
                $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, -1) . '\');') . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => htmlspecialchars($label))) . htmlspecialchars($label) . '</a>';
            }
            // Create table and header cell:
            $output = '
				<table class="tpm-nonused-elements lrPadding" border="0" cellpadding="0" cellspacing="1" width="100%">
					<tr class="bgColor4-20">
						<td colspan="3">' . $LANG->getLL('inititemno_elementsNotBeingUsed', '1') . ':</td>
					</tr>
					' . implode('', $elementRows) . '
					<tr class="bgColor4">
						<td colspan="3" class="tpm-nonused-deleteall">' . $deleteAll . '</td>
					</tr>
				</table>
			';
        }
        return $output;
    }
    /**
     * [Describe function...]
     *
     * @param	[type]		$arr: ...
     * @param	[type]		$depthData: ...
     * @param	[type]		$keyArray: ...
     * @param	[type]		$first: ...
     * @return	[type]		...
     */
    function ext_getTemplateHierarchyArr($arr, $depthData, $keyArray, $first = 0)
    {
        $keyArr = array();
        foreach ($arr as $key => $value) {
            $key = preg_replace('/\\.$/', '', $key);
            if (substr($key, -1) != '.') {
                $keyArr[$key] = 1;
            }
        }
        $a = 0;
        $c = count($keyArr);
        static $i;
        foreach ($keyArr as $key => $value) {
            $HTML = '';
            $a++;
            $deeper = is_array($arr[$key . '.']);
            $row = $arr[$key];
            $PM = 'join';
            $LN = $a == $c ? 'blank' : 'line';
            $BTM = $a == $c ? 'top' : '';
            $PM = 'join';
            $HTML .= $depthData;
            $alttext = '[' . $row['templateID'] . ']';
            $alttext .= $row['pid'] ? ' - ' . t3lib_BEfunc::getRecordPath($row['pid'], $GLOBALS['SOBE']->perms_clause, 20) : '';
            $icon = substr($row['templateID'], 0, 3) == 'sys' ? t3lib_iconWorks::getSpriteIconForRecord('sys_template', $row, array('title' => $alttext)) : t3lib_iconWorks::getSpriteIcon('mimetypes-x-content-template-static', array('title' => $alttext));
            if (in_array($row['templateID'], $this->clearList_const) || in_array($row['templateID'], $this->clearList_setup)) {
                $A_B = '<a href="index.php?id=' . $GLOBALS['SOBE']->id . '&template=' . $row['templateID'] . '">';
                $A_E = '</a>';
                if (t3lib_div::_GP('template') == $row['templateID']) {
                    $A_B = '<strong>' . $A_B;
                    $A_E .= '</strong>';
                }
            } else {
                $A_B = '';
                $A_E = '';
            }
            $HTML .= ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" />') . $icon . $A_B . t3lib_div::fixed_lgd_cs($row['title'], $GLOBALS['BE_USER']->uc['titleLen']) . $A_E . '&nbsp;&nbsp;';
            $RL = $this->ext_getRootlineNumber($row['pid']);
            $keyArray[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
							<td nowrap>' . $HTML . '</td>
							<td align="center">' . ($row['root'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;</td>
							<td align="center">' . ($row['clConf'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;' . '</td>
							<td align="center">' . ($row['clConst'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;' . '</td>
							<td align="center">' . ($row['pid'] ? $row['pid'] : '') . '</td>
							<td align="center">' . (strcmp($RL, '') ? $RL : '') . '</td>
							<td>' . ($row['next'] ? '&nbsp;' . $row['next'] . '&nbsp;&nbsp;' : '') . '</td>
						</tr>';
            if ($deeper) {
                $keyArray = $this->ext_getTemplateHierarchyArr($arr[$key . '.'], $depthData . ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $LN . '.gif" width="18" height="16" align="top" />'), $keyArray);
            }
        }
        return $keyArray;
    }
 /**
  * Process the Database operation to get the search result.
  *
  * @param string $tableName Database table name
  * @param string $where
  * @param string $orderBy
  * @param string $limit MySql Limit notation
  * @return array
  *
  * @see t3lib_db::exec_SELECT_queryArray()
  * @see t3lib_db::sql_num_rows()
  * @see t3lib_db::sql_fetch_assoc()
  * @see t3lib_iconWorks::getSpriteIconForRecord()
  * @see getTitleFromCurrentRow()
  * @see getEditLink()
  */
 protected function getRecordArray($tableName, $where, $orderBy, $limit)
 {
     $collect = array();
     $isFirst = TRUE;
     $queryParts = array('SELECT' => '*', 'FROM' => $tableName, 'WHERE' => $where, 'ORDERBY' => $orderBy, 'LIMIT' => $limit);
     $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
     $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
         $collect[] = array('id' => $tableName . ':' . $row['uid'], 'recordTitle' => $isFirst ? $this->getRecordTitlePrep($this->getTitleOfCurrentRecordType($tableName), self::GROUP_TITLE_MAX_LENGTH) : '', 'iconHTML' => t3lib_iconWorks::getSpriteIconForRecord($tableName, $row), 'title' => $this->getRecordTitlePrep($this->getTitleFromCurrentRow($tableName, $row), self::RECORD_TITLE_MAX_LENGTH), 'editLink' => $this->getEditLink($tableName, $row));
         $isFirst = FALSE;
     }
     return $collect;
 }
 function main()
 {
     global $SOBE, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
     global $tmpl, $tplRow, $theConstants;
     // **************************
     // Create extension template
     // **************************
     $this->pObj->createTemplate($this->pObj->id);
     // **************************
     // 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???
     $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
     // initialize
     if ($existTemplate) {
         $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
         // Update template ?
         if (t3lib_div::_POST('submit') || t3lib_div::testInt(t3lib_div::_POST('submit_x')) && t3lib_div::testInt(t3lib_div::_POST('submit_y'))) {
             $tmpl->changed = 0;
             $tmpl->ext_procesInput(t3lib_div::_POST(), $_FILES, $theConstants, $tplRow);
             //		debug($tmpl->changed);
             //		debug($tmpl->raw);
             //		$tmpl->changed=0;
             if ($tmpl->changed) {
                 // Set the data to be saved
                 $recData = array();
                 $recData["sys_template"][$saveId]["constants"] = implode($tmpl->raw, LF);
                 // 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);
             }
         }
         // Output edit form
         $tmpl->ext_readDirResources($TYPO3_CONF_VARS["MODS"]["web_ts"]["onlineResourceDir"]);
         $tmpl->ext_resourceDims();
         // Resetting the menu (start). I wonder if this in any way is a violation of the menu-system. Haven't checked. But need to do it here, because the menu is dependent on the categories available.
         $this->pObj->MOD_MENU["constant_editor_cat"] = $tmpl->ext_getCategoryLabelArray();
         $this->pObj->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->pObj->MOD_MENU, t3lib_div::_GP("SET"), $this->pObj->MCONF["name"]);
         // Resetting the menu (stop)
         $theOutput .= $this->pObj->doc->spacer(5);
         $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editConstants', true), t3lib_iconWorks::getSpriteIconForRecord('sys_template', $tplRow) . '<strong>' . $this->pObj->linkWrapTemplateTitle($tplRow["title"], "constants") . '</strong>' . htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : ''), 0, 1);
         if ($manyTemplatesMenu) {
             $theOutput .= $this->pObj->doc->section("", $manyTemplatesMenu);
             $theOutput .= $this->pObj->doc->divider(5);
         }
         $theOutput .= $this->pObj->doc->spacer(5);
         if (count($this->pObj->MOD_MENU["constant_editor_cat"])) {
             $menu = $GLOBALS['LANG']->getLL('category', true) . " " . t3lib_BEfunc::getFuncMenu($this->pObj->id, "SET[constant_editor_cat]", $this->pObj->MOD_SETTINGS["constant_editor_cat"], $this->pObj->MOD_MENU["constant_editor_cat"]);
             $theOutput .= $this->pObj->doc->section("", '<NOBR>' . $menu . '</NOBR>');
         } else {
             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('noConstants', true), $GLOBALS['LANG']->getLL('noConstantsDescription', true), 1, 0, 1);
         }
         // Category and constant editor config:
         $category = $this->pObj->MOD_SETTINGS["constant_editor_cat"];
         /*	$TSCE_tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");	// Defined global here!
         			$TSCE_tmpl->tt_track = 0;	// Do not log time-performance information
         			$TSCE_tmpl->init();
         			$TSCE_tmpl->constants=array($tplRow["constants"]);
         			debug($tplRow);
         			$TSCE_tmpl->generateConfig_constants();
         			debug($TSCE_tmpl->setup);
         			*/
         $tmpl->ext_getTSCE_config($category);
         # NOT WORKING:
         if ($BE_USER_modOptions["properties"]["constantEditor."]["example"] == "top") {
             $theOutput = $this->displayExample($theOutput);
         }
         $printFields = trim($tmpl->ext_printFields($theConstants, $category));
         if ($printFields) {
             $theOutput .= $this->pObj->doc->spacer(20);
             $theOutput .= $this->pObj->doc->section("", $printFields);
         }
         if ($BE_USER_modOptions["properties"]["constantEditor."]["example"] != "top") {
             $theOutput = $this->displayExample($theOutput);
         }
     } else {
         $theOutput .= $this->pObj->noTemplate(1);
     }
     return $theOutput;
 }
Beispiel #18
0
	/**
	 * Render display of a Template Object
	 *
	 * @param	array		Template Object record to render
	 * @param	array		Array of all Template Objects (passed by reference. From here records are unset)
	 * @param	integer		Scope of DS
	 * @param	boolean		If set, the function is asked to render children to template objects (and should not call it self recursively again).
	 * @return	string		HTML content
	 */
	function renderTODisplay($toObj, $scope, $children=0)	{

			// Put together the records icon including content sensitive menu link wrapped around it:
		$recordIcon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_tmplobj', array(), array('title' => $toObj->getKey()));
		$recordIcon = $this->doc->wrapClickMenuOnIcon($recordIcon, 'tx_templavoila_tmplobj', $toObj->getKey(), 1, '&callingScriptId='.rawurlencode($this->doc->scriptID));

			// Preview icon:
		if ($toObj->getIcon())	{
			if (isset($this->modTSconfig['properties']['toPreviewIconThumb']) && $this->modTSconfig['properties']['toPreviewIconThumb'] != '0') {
					$path = realpath(dirname(__FILE__) . '/' . preg_replace('/\w+\/\.\.\//', '', $GLOBALS['BACK_PATH'] . $toObj->getIcon()));
					$path = str_replace(realpath(PATH_site) . '/', PATH_site, $path);
					if($path == FALSE) {
						$icon = $GLOBALS['LANG']->getLL('noicon', 1);
					} else {
						$icon = t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $path,
							'hspace="5" vspace="5" border="1"',
							strpos($this->modTSconfig['properties']['toPreviewIconThumb'], 'x') ? $this->modTSconfig['properties']['toPreviewIconThumb'] : '');
					}
				} else {
					$icon = '<img src="' . $this->doc->backPath . $toObj->getIcon() . '" alt="" />';
				}
		} else {
			$icon = $GLOBALS['LANG']->getLL('noicon', 1);
		}

			// Mapping status / link:
		$linkUrl = '../cm1/index.php?table=tx_templavoila_tmplobj&uid=' . $toObj->getKey() . '&_reload_from=1&id=' . $this->id . '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));

		$fileReference = t3lib_div::getFileAbsFileName($toObj->getFileref());
		if (@is_file($fileReference))	{
			$this->tFileList[$fileReference]++;
			$fileRef = '<a href="'.htmlspecialchars($this->doc->backPath.'../'.substr($fileReference,strlen(PATH_site))).'" target="_blank">'.htmlspecialchars($toObj->getFileref()).'</a>';
			$fileMsg = '';
			$fileMtime = filemtime($fileReference);
		} else {
			$fileRef = htmlspecialchars($toObj->getFileref());
			$fileMsg = '<div class="typo3-red">ERROR: File not found</div>';
			$fileMtime = 0;
		}

		$mappingStatus = $mappingStatus_index = '';
		if ($fileMtime && $toObj->getFilerefMtime()) {
			if ($toObj->getFilerefMD5() != '') {
				$modified = (@md5_file($fileReference) != $toObj->getFilerefMD5());
			} else {
				$modified = ($toObj->getFilerefMtime() != $fileMtime);
			}
			if ($modified)	{
				$mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-warning');
				$mappingStatus.= sprintf($GLOBALS['LANG']->getLL('towasupdated', 1), t3lib_BEfunc::datetime($toObj->getTstamp()));
				$this->setErrorLog($scope, 'warning', sprintf($GLOBALS['LANG']->getLL('warning_mappingstatus', 1), $mappingStatus, $toObj->getLabel()));
			} else {
				$mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-ok');
				$mappingStatus.= $GLOBALS['LANG']->getLL('mapping_uptodate', 1);
			}
			$mappingStatus .= '<br/><input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('update_mapping', 1) . '" />';
		} elseif (!$fileMtime) {
			$mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-error');
			$mappingStatus.= $GLOBALS['LANG']->getLL('notmapped', 1);
			$this->setErrorLog($scope, 'fatal', sprintf($GLOBALS['LANG']->getLL('warning_mappingstatus', 1), $mappingStatus, $toObj->getLabel()));

			$mappingStatus .= $GLOBALS['LANG']->getLL('updatemapping_info');
			$mappingStatus .= '<br/><input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('map', 1) . '" />';
		} else {
			$mappingStatus = '';
			$mappingStatus .= '<input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('remap', 1) . '" />';
			$mappingStatus .= '&nbsp;<input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl . '&_preview=1') . '\');" value="' . $GLOBALS['LANG']->getLL('preview', 1) . '" />';
		}

		if ($this->MOD_SETTINGS['set_details'])	{
			$XMLinfo = $this->DSdetails($toObj->getLocalDataprotXML(TRUE));
		}

			// Format XML if requested
		if ($this->MOD_SETTINGS['set_details'])	{
			if ($toObj->getLocalDataprotXML(TRUE))	{
				require_once(PATH_t3lib.'class.t3lib_syntaxhl.php');
				$hlObj = t3lib_div::makeInstance('t3lib_syntaxhl');
				$lpXML = '<pre>'.str_replace(chr(9),'&nbsp;&nbsp;&nbsp;',$hlObj->highLight_DS($toObj->getLocalDataprotXML(TRUE))).'</pre>';
			} else $lpXML = '';
		}
		$lpXML.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj]['.$toObj->getKey().']=edit&columnsOnly=localprocessing',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';

			// Compile info table:
		$tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 3px;" class="lrPadding"';

			// Links:
		$toTitle = '<a href="' . htmlspecialchars($linkUrl) . '">' . htmlspecialchars($GLOBALS['LANG']->sL($toObj->getLabel())) . '</a>';
		$editLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj]['.$toObj->getKey().']=edit',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';

		$fRWTOUres = array();

		if (!$children)	{
			if ($this->MOD_SETTINGS['set_details'])	{
				$fRWTOUres = $this->findRecordsWhereTOUsed($toObj,$scope);
			}

			$content.='
			<table'.$tableAttribs.'>
				<tr class="bgColor4-20">
					<td colspan="3">'.
						$recordIcon.
						$toTitle.
						$editLink.
						'</td>
				</tr>
				<tr class="bgColor4">
					<td rowspan="'.($this->MOD_SETTINGS['set_details'] ? 7 : 4).'" style="width: 100px; text-align: center;">'.$icon.'</td>
					<td style="width:200px;">' . $GLOBALS['LANG']->getLL('filereference', 1) . ':</td>
					<td>'.$fileRef.$fileMsg.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('description', 1) . ':</td>
					<td>'.htmlspecialchars($toObj->getDescription()).'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('mappingstatus', 1) . ':</td>
					<td>'.$mappingStatus.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('localprocessing_xml') . ':</td>
					<td>
						'.$lpXML.($toObj->getLocalDataprotXML(TRUE) ?
						t3lib_div::formatSize(strlen($toObj->getLocalDataprotXML(TRUE))).' bytes'.
						($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').'
					</td>
				</tr>'.($this->MOD_SETTINGS['set_details'] ? '
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('usedby', 1) . ':</td>
					<td>'.$fRWTOUres['HTML'].'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('created', 1) . ':</td>
					<td>' . t3lib_BEfunc::datetime($toObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $toObj->getCruser() . ']</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('updated', 1) . ':</td>
					<td>'.t3lib_BEfunc::datetime($toObj->getTstamp()).'</td>
				</tr>' : '').'
			</table>
			';
		} else {
			$content.='
			<table'.$tableAttribs.'>
				<tr class="bgColor4-20">
					<td colspan="3">'.
						$recordIcon.
						$toTitle.
						$editLink.
						'</td>
				</tr>
				<tr class="bgColor4">
					<td style="width:200px;">' . $GLOBALS['LANG']->getLL('filereference', 1) . ':</td>
					<td>'.$fileRef.$fileMsg.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('mappingstatus', 1) . ':</td>
					<td>'.$mappingStatus.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('rendertype', 1) . ':</td>
					<td>' . $this->getProcessedValue('tx_templavoila_tmplobj', 'rendertype', $toObj->getRendertype()) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('language', 1) . ':</td>
					<td>' . $this->getProcessedValue('tx_templavoila_tmplobj', 'sys_language_uid', $toObj->getSyslang()) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('localprocessing_xml') . ':</td>
					<td>
						'.$lpXML.($toObj->getLocalDataprotXML(TRUE) ?
						t3lib_div::formatSize(strlen($toObj->getLocalDataprotXML(TRUE))).' bytes'.
						($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').'
					</td>
				</tr>'.($this->MOD_SETTINGS['set_details'] ? '
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('created', 1) . ':</td>
					<td>'.t3lib_BEfunc::datetime($toObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $toObj->getCruser() . ']</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('updated', 1) . ':</td>
					<td>'.t3lib_BEfunc::datetime($toObj->getTstamp()).'</td>
				</tr>' : '').'
			</table>
			';
		}

			// Traverse template objects which are not children of anything:
		if(!$childRen) {
			$toRepo = t3lib_div::makeInstance('tx_templavoila_templateRepository');
			$toChildren = $toRepo->getTemplatesByParentTemplate($toObj);
		} else {
			$toChildren = array();
		}

		if (!$children && count($toChildren))	{
			$TOchildrenContent = '';
			foreach($toChildren as $toChild)	{
				$rTODres = $this->renderTODisplay($toChild, $scope, 1);
				$TOchildrenContent.= $rTODres['HTML'];
			}
			$content.='<div style="margin-left: 102px;">'.$TOchildrenContent.'</div>';
		}

			// Return content
		return array('HTML' => $content, 'mappingStatus' => $mappingStatus_index, 'usage' => $fRWTOUres['usage']);
	}
    /**
     * returns the recent documents list as an array
     *
     * @return	array	all recent documents as list-items
     */
    public function renderMenuEntry($document, $md5sum, $isRecentDoc = false, $isFirstDoc = false)
    {
        $table = $document[3]['table'];
        $uid = $document[3]['uid'];
        $record = t3lib_BEfunc::getRecordWSOL($table, $uid);
        if (!is_array($record)) {
            // record seems to be deleted
            return '';
        }
        $label = htmlspecialchars(strip_tags(t3lib_div::htmlspecialchars_decode($document[0])));
        $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $record);
        $link = $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . $document[2];
        $firstRow = '';
        if ($isFirstDoc) {
            $firstRow = ' first-row';
        }
        if (!$isRecentDoc) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.closeDoc', true);
            // open document
            $closeIcon = t3lib_iconWorks::getSpriteIcon('actions-document-close');
            $entry = '
				<tr class="opendoc' . $firstRow . '">
					<td class="icon">' . $icon . '</td>
					<td class="label"><a href="#" onclick="jump(unescape(\'' . htmlspecialchars($link) . '\'), \'web_list\', \'web\'); TYPO3BackendOpenDocs.toggleMenu(); return false;" target="content">' . $label . '</a></td>
					<td class="close" onclick="return TYPO3BackendOpenDocs.closeDocument(\'' . $md5sum . '\');">' . $closeIcon . '</td>
				</tr>';
        } else {
            // recently used document
            $entry = '
				<tr class="recentdoc' . $firstRow . '">
					<td class="icon">' . $icon . '</td>
					<td class="label" colspan="2"><a href="#" onclick="jump(unescape(\'' . htmlspecialchars($link) . '\'), \'web_list\', \'web\'); TYPO3BackendOpenDocs.toggleMenu(); return false;" target="content">' . $label . '</a></td>
				</tr>';
        }
        return $entry;
    }
    /**
     * Main function
     *
     * @return	string		Output HTML for the module.
     * @access	public
     */
    function main()
    {
        global $BACK_PATH, $LANG, $SOBE, $BE_USER, $TYPO3_DB;
        $this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod.SHARED');
        $this->allAvailableLanguages = $this->getAvailableLanguages(0, true, true, true);
        $output = '';
        $this->templavoilaAPIObj = t3lib_div::makeInstance('tx_templavoila_api');
        // Showing the tree:
        // Initialize starting point of page tree:
        $treeStartingPoint = intval($this->pObj->id);
        $treeStartingRecord = t3lib_BEfunc::getRecord('pages', $treeStartingPoint);
        $depth = $this->pObj->MOD_SETTINGS['depth'];
        // Initialize tree object:
        $tree = t3lib_div::makeInstance('t3lib_pageTree');
        $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1));
        // Creating top icon; the current page
        $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $treeStartingRecord);
        $tree->tree[] = array('row' => $treeStartingRecord, 'HTML' => $HTML);
        // Create the tree from starting point:
        if ($depth > 0) {
            $tree->getTree($treeStartingPoint, $depth, '');
        }
        // Set CSS styles specific for this document:
        $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', '
			TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
		', $this->pObj->content);
        // Process commands:
        if (t3lib_div::_GP('createReferencesForPage')) {
            $this->createReferencesForPage(t3lib_div::_GP('createReferencesForPage'));
        }
        if (t3lib_div::_GP('createReferencesForTree')) {
            $this->createReferencesForTree($tree);
        }
        // Traverse tree:
        $output = '';
        $counter = 0;
        foreach ($tree->tree as $row) {
            $unreferencedElementRecordsArr = $this->getUnreferencedElementsRecords($row['row']['uid']);
            if (count($unreferencedElementRecordsArr)) {
                $createReferencesLink = '<a href="index.php?id=' . $this->pObj->id . '&createReferencesForPage=' . $row['row']['uid'] . '">Reference elements</a>';
            } else {
                $createReferencesLink = '';
            }
            $rowTitle = $row['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $row['row'], TRUE);
            $cellAttrib = $row['row']['_CSSCLASS'] ? ' class="' . $row['row']['_CSSCLASS'] . '"' : '';
            $tCells = array();
            $tCells[] = '<td nowrap="nowrap"' . $cellAttrib . '>' . $rowTitle . '</td>';
            $tCells[] = '<td>' . count($unreferencedElementRecordsArr) . '</td>';
            $tCells[] = '<td nowrap="nowrap">' . $createReferencesLink . '</td>';
            $output .= '
				<tr class="bgColor' . ($counter % 2 ? '-20' : '-10') . '">
					' . implode('
					', $tCells) . '
				</tr>';
            $counter++;
        }
        // Create header:
        $tCells = array();
        $tCells[] = '<td>Page:</td>';
        $tCells[] = '<td>No. of unreferenced elements:</td>';
        $tCells[] = '<td>&nbsp;</td>';
        // Depth selector:
        $depthSelectorBox = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php');
        $finalOutput = '
			<br />
			' . $depthSelectorBox . '
			<a href="index.php?id=' . $this->pObj->id . '&createReferencesForTree=1">Reference elements for whole tree</a><br />
			<br />
			<table border="0" cellspacing="1" cellpadding="0" class="lrPadding c-list">
				<tr class="bgColor5 tableheader">
					' . implode('
					', $tCells) . '
				</tr>' . $output . '
			</table>
		';
        return $finalOutput;
    }
Beispiel #21
0
    /**
     * Render a single item in a subelement list into a table row:
     *
     * @param	array		Table rows, passed by reference
     * @param	string		Table name
     * @param	integer		Page uid for which the subelements are selected/shown
     * @param	array		Row of element in list
     * @param	integer		The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.
     * @param	integer		Mode of icon display: 0=not the last, 1= is the last in list (make joinbottom icon then), 2=do not shown icons are all (for pages from the page tree already rendered)
     * @param	string		Prefix HTML data (icons for tree rendering)
     * @return	void		(Content accumulated in $tCell!)
     */
    function subElements_renderItem(&$tCell, $tN, $uid, $rec, $origId, $iconMode, $HTMLdata)
    {
        global $TCA;
        // Initialize:
        $origUidFields = $TCA[$tN]['ctrl']['origUid'];
        $diffCode = '';
        if ($origUidFields) {
            // If there is a field for this table with original uids we will use that to connect records:
            if (!$origId) {
                // In case we are displaying the online originals:
                $this->targets['orig_' . $uid . '_' . $tN . '_' . $rec['uid']] = $rec;
                // Build up target array (important that
                $tdParams = ' id="orig_' . $uid . '_' . $tN . '_' . $rec['uid'] . '" class="typo3-ver"';
                // Setting ID of the table row
            } else {
                // Version branch:
                if ($this->targets['orig_' . $origId . '_' . $tN . '_' . $rec[$origUidFields]]) {
                    // If there IS a corresponding original record...:
                    // Prepare Table row parameters:
                    $tdParams = ' onmouseover="hlSubelements(\'' . $origId . '_' . $tN . '_' . $rec[$origUidFields] . '\', \'' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '\', 1, ' . ($this->MOD_SETTINGS['diff'] == 2 ? 1 : 0) . ');"' . ' onmouseout="hlSubelements(\'' . $origId . '_' . $tN . '_' . $rec[$origUidFields] . '\', \'' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '\', 0, ' . ($this->MOD_SETTINGS['diff'] == 2 ? 1 : 0) . ');"' . ' id="ver_' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '" class="typo3-ver"';
                    // Create diff view:
                    if ($this->MOD_SETTINGS['diff']) {
                        list($diffHTML, $diffPct) = $this->createDiffView($tN, $rec, $this->targets['orig_' . $origId . '_' . $tN . '_' . $rec[$origUidFields]]);
                        if ($this->MOD_SETTINGS['diff'] == 2) {
                            $diffCode = ($diffPct ? '<span class="nobr">' . $diffPct . '% change</span>' : '-') . '<div style="visibility: hidden; position: absolute;" id="diff_' . $uid . '_' . $tN . '_' . $rec[$origUidFields] . '" class="diffLayer">' . $diffHTML . '</div>';
                        } else {
                            $diffCode = ($diffPct < 0 ? $GLOBALS['LANG']->getLL('notAvailable') : ($diffPct ? $diffPct . '% ' . $GLOBALS['LANG']->getLL('change') : '')) . $diffHTML;
                        }
                    }
                    // Unsetting the target fields allows us to mark all originals without a version in the subtree (see ->markupNewOriginals())
                    unset($this->targets['orig_' . $origId . '_' . $tN . '_' . $rec[$origUidFields]]);
                } else {
                    // No original record, so must be new:
                    $tdParams = ' class="typo3-ver-new"';
                }
            }
        } else {
            // If no original uid column is supported for this table we are forced NOT to display any diff or highlighting.
            $tdParams = ' class="typo3-ver-noComp"';
        }
        // Compile the cell:
        $tCell[] = '
						<tr' . $tdParams . '>
							<td class="iconTitle">' . $HTMLdata . ($iconMode < 2 ? '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/join' . ($iconMode ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . t3lib_iconWorks::getSpriteIconForRecord($tN, $rec) : '') . t3lib_BEfunc::getRecordTitle($tN, $rec, TRUE) . '</td>
							<td class="cmdCell">' . $this->displayWorkspaceOverview_commandLinksSub($tN, $rec, $origId) . '</td>' . ($origId ? '<td class="diffCell">' . $diffCode . '</td>' : '') . '
						</tr>';
    }
Beispiel #22
0
    /**
     * @author Martin Kutschker
     */
    function whoIsOnline()
    {
        $select_fields = 'ses_id, ses_tstamp, ses_iplock, u.uid,u.username, u.admin, u.realName, u.disable, u.starttime, u.endtime, u.deleted, bu.uid AS bu_uid,bu.username AS bu_username, bu.realName AS bu_realName';
        $from_table = 'be_sessions INNER JOIN be_users u ON ses_userid=u.uid LEFT OUTER JOIN be_users bu ON ses_backuserid=bu.uid';
        $where_clause = '';
        $orderBy = 'u.username';
        if (t3lib_div::testInt($GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'])) {
            $where_clause .= 'ses_tstamp+' . $GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'] . ' > ' . $GLOBALS['EXEC_TIME'];
        } else {
            $timeout = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout']);
            if ($timeout > 0) {
                $where_clause .= 'ses_tstamp+' . $timeout . ' > ' . $GLOBALS['EXEC_TIME'];
            }
        }
        // Fetch active sessions of other users from storage:
        $sessions = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($select_fields, $from_table, $where_clause, '', $orderBy);
        // Process and visualized each active session as a table row:
        if (is_array($sessions)) {
            foreach ($sessions as $session) {
                $ip = $session['ses_iplock'];
                $hostName = '';
                if ($session['ses_iplock'] == '[DISABLED]' || $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'] == 0) {
                    $ip = '-';
                } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'] == 4) {
                    $hostName = ' title="' . @gethostbyaddr($session['ses_iplock']) . '"';
                } else {
                    $ip .= str_repeat('.*', 4 - $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP']);
                }
                $outTable .= '
					<tr class="bgColor4" height="17" valign="top">' . '<td nowrap="nowrap">' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $session['ses_tstamp']) . '</td>' . '<td nowrap="nowrap">' . '<span' . $hostName . '>' . $ip . '</span>' . '</td>' . '<td width="130">' . t3lib_iconWorks::getSpriteIconForRecord('be_users', $session, array('title' => $session['uid'])) . htmlspecialchars($session['username']) . '&nbsp;' . '</td>' . '<td nowrap="nowrap">' . htmlspecialchars($session['realName']) . '&nbsp;&nbsp;</td>' . '<td nowrap="nowrap">' . $this->elementLinks('be_users', $session) . '</td>' . '<td nowrap="nowrap" valign="top">' . ($session['bu_username'] ? '&nbsp;SU from: ' : '') . htmlspecialchars($session['bu_username']) . '&nbsp;</td>' . '<td nowrap="nowrap" valign="top">&nbsp;' . htmlspecialchars($session['bu_realName']) . '</td>' . '</tr>';
            }
        }
        // Wrap <table> tag around the rows:
        $outTable = '
		<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
			<tr class="t3-row-header">
				<td>' . $GLOBALS['LANG']->getLL('timestamp', true) . '</td>
				<td>' . $GLOBALS['LANG']->getLL('host', true) . '</td>
				<td colspan="5">' . $GLOBALS['LANG']->getLL('username', true) . '</td>
			</tr>' . $outTable . '
		</table>';
        $content .= $this->doc->section($GLOBALS['LANG']->getLL('whoIsOnline', true), $outTable, 0, 1);
        return $content;
    }
Beispiel #23
0
    /**
     * Showing the permissions in a tree ($this->edit = false)
     * (Adding content to internal content variable)
     *
     * @return	void
     */
    public function notEdit()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of
        $beGroupKeys = $BE_USER->userGroupsUID;
        $beUserArray = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 0);
        }
        $beGroupArray = t3lib_BEfunc::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray, $beGroupKeys, 0);
        }
        // Length of strings:
        $tLen = $this->MOD_SETTINGS['mode'] == 'perms' ? 20 : 30;
        // Selector for depth:
        $code .= $LANG->getLL('Depth') . ': ';
        $code .= t3lib_BEfunc::getFuncMenu($this->id, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']);
        $this->content .= $this->doc->section('', $code);
        $this->content .= $this->doc->spacer(5);
        // Initialize tree object:
        $tree = t3lib_div::makeInstance('t3lib_pageTree');
        $tree->init('AND ' . $this->perms_clause);
        $tree->addField('perms_user', 1);
        $tree->addField('perms_group', 1);
        $tree->addField('perms_everybody', 1);
        $tree->addField('perms_userid', 1);
        $tree->addField('perms_groupid', 1);
        $tree->addField('hidden');
        $tree->addField('fe_group');
        $tree->addField('starttime');
        $tree->addField('endtime');
        $tree->addField('editlock');
        // Creating top icon; the current page
        $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pageinfo);
        $tree->tree[] = array('row' => $this->pageinfo, 'HTML' => $HTML);
        // Create the tree from $this->id:
        $tree->getTree($this->id, $this->MOD_SETTINGS['depth'], '');
        // Make header of table:
        $code = '';
        if ($this->MOD_SETTINGS['mode'] == 'perms') {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td>' . $LANG->getLL('Owner', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('Group', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('Everybody', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>
				</tr>
			';
        } else {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center" nowrap="nowrap">' . $LANG->getLL('User', TRUE) . ': ' . htmlspecialchars($BE_USER->user['username']) . '</td>
					' . (!$BE_USER->isAdmin() ? '<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>' : '') . '
				</tr>';
        }
        // Traverse tree:
        foreach ($tree->tree as $data) {
            $cells = array();
            $pageId = $data['row']['uid'];
            // Background colors:
            $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : '';
            $lE_bgCol = $bgCol;
            // User/Group names:
            $userName = $beUserArray[$data['row']['perms_userid']] ? $beUserArray[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : '');
            if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) {
                $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)), false);
            } else {
                $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)));
            }
            $groupName = $beGroupArray[$data['row']['perms_groupid']] ? $beGroupArray[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : '');
            if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) {
                $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20)), false);
            } else {
                $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20)));
            }
            // Seeing if editing of permissions are allowed for that page:
            $editPermsAllowed = $data['row']['perms_userid'] == $BE_USER->user['uid'] || $BE_USER->isAdmin();
            // First column:
            $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '';
            $cells[] = '
					<td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . '>' . $data['HTML'] . htmlspecialchars(t3lib_div::fixed_lgd_cs($data['row']['title'], $tLen)) . '&nbsp;</td>';
            // "Edit permissions" -icon
            if ($editPermsAllowed && $pageId) {
                $aHref = 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1';
                $cells[] = '
					<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $LANG->getLL('ch_permissions', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a></td>';
            } else {
                $cells[] = '
					<td' . $bgCol . '></td>';
            }
            // Rest of columns (depending on mode)
            if ($this->MOD_SETTINGS['mode'] == 'perms') {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $LANG->getLL('EditLock_descr', 1) . '">' . t3lib_iconWorks::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the &raquo;Admin-only&laquo; edit lock for this page">[+]</a></span>')) . '</td>
				';
            } else {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>';
                $bgCol = $BE_USER->user['uid'] == $data['row']['perms_userid'] ? ' class="bgColor-20"' : $lE_bgCol;
                // FIXME $owner undefined
                $cells[] = '
					<td' . $bgCol . ' nowrap="nowrap" align="center">' . ($pageId ? $owner . SC_mod_web_perm_ajax::renderPermissions($BE_USER->calcPerms($data['row']), $pageId, 'user') : '') . '</td>
					' . (!$BE_USER->isAdmin() ? '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? t3lib_iconWorks::getSpriteIcon('status-warning-lock', array('title' => $LANG->getLL('EditLock_descr', TRUE))) : '') . '</td>
					' : '');
                $bgCol = $lE_bgCol;
            }
            // Compile table row:
            $code .= '
				<tr>
					' . implode('
					', $cells) . '
				</tr>';
        }
        // Wrap rows in table tags:
        $code = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-permissionList">' . $code . '</table>';
        // Adding the content as a section:
        $this->content .= $this->doc->section('', $code);
        // CSH for permissions setting
        $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|');
        // Creating legend table:
        $legendText = '<strong>' . $LANG->getLL('1', 1) . '</strong>: ' . $LANG->getLL('1_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('16', 1) . '</strong>: ' . $LANG->getLL('16_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('2', 1) . '</strong>: ' . $LANG->getLL('2_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('4', 1) . '</strong>: ' . $LANG->getLL('4_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('8', 1) . '</strong>: ' . $LANG->getLL('8_t', 1);
        $code = '<table border="0" id="typo3-legendTable">
			<tr>
				<td valign="top">
					<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" />
				</td>
				<td valign="top" nowrap="nowrap">' . $legendText . '</td>
			</tr>
		</table>';
        $code .= '<div id="perm-legend">' . $LANG->getLL('def', 1);
        $code .= '<br /><br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-granted') . ': ' . $LANG->getLL('A_Granted', 1);
        $code .= '<br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-denied') . ': ' . $LANG->getLL('A_Denied', 1);
        $code .= '</div>';
        // Adding section with legend code:
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section($LANG->getLL('Legend') . ':', $code, 0, 1);
    }
 /**
  * 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;
 }
 /**
  * Main function, adding items to the click menu array.
  *
  * @param	object		Reference to the parent object of the clickmenu class which calls this function
  * @param	array		The current array of menu items - you have to add or remove items to this array in this function. Thats the point...
  * @param	string		The database table OR filename
  * @param	integer		For database tables, the UID
  * @return	array		The modified menu array.
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     global $BE_USER, $LANG, $TYPO3_DB;
     $localItems = array();
     if (!$backRef->cmLevel) {
         $LL = $LANG->includeLLFile(t3lib_extMgm::extPath('templavoila') . 'locallang.xml', 0);
         // Adding link for Mapping tool:
         if (@is_file($table)) {
             if ($BE_USER->isAdmin()) {
                 if (function_exists('finfo_open')) {
                     $finfoMode = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
                     $fi = finfo_open($finfoMode);
                     $mimeInformation = @finfo_file($fi, $table);
                     $enabled = FALSE;
                     if (t3lib_div::isFirstPartOfStr($mimeInformation, 'text/html') || t3lib_div::isFirstPartOfStr($mimeInformation, 'application/xml')) {
                         $enabled = TRUE;
                     }
                     finfo_close($fi);
                 } else {
                     $pi = @pathinfo($table);
                     $enabled = preg_match('/(html?|tmpl|xml)/', $pi['extension']);
                 }
                 if ($enabled) {
                     $url = t3lib_extMgm::extRelPath('templavoila') . 'cm1/index.php?file=' . rawurlencode($table);
                     $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_title', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
                 }
             }
         } elseif (t3lib_div::inList('tx_templavoila_tmplobj,tx_templavoila_datastructure,tx_templavoila_content', $table)) {
             $url = t3lib_extMgm::extRelPath('templavoila') . 'cm1/index.php?table=' . rawurlencode($table) . '&uid=' . $uid . '&_reload_from=1';
             $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_title', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
         }
         $isTVelement = ('tt_content' == $table && $backRef->rec['CType'] == 'templavoila_pi1' || 'pages' == $table) && $backRef->rec['tx_templavoila_flex'];
         // Adding link for "View: Sub elements":
         if ($table == 'tt_content' && $isTVelement) {
             $localItems = array();
             $url = t3lib_extMgm::extRelPath('templavoila') . 'mod1/index.php?id=' . intval($backRef->rec['pid']) . '&altRoot[table]=' . rawurlencode($table) . '&altRoot[uid]=' . $uid . '&altRoot[field_flex]=tx_templavoila_flex';
             $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_viewsubelements', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
         }
         // Adding link for "View: Flexform XML" (admin only):
         if ($BE_USER->isAdmin() && $isTVelement) {
             $url = t3lib_extMgm::extRelPath('templavoila') . 'cm2/index.php?' . '&viewRec[table]=' . rawurlencode($table) . '&viewRec[uid]=' . $uid . '&viewRec[field_flex]=tx_templavoila_flex';
             $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_viewflexformxml', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm2/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
         }
         // Adding link for "View: DS/TO" (admin only):
         if ($BE_USER->isAdmin() && $isTVelement) {
             if (tx_templavoila_div::canBeInterpretedAsInteger($backRef->rec['tx_templavoila_ds'])) {
                 $url = t3lib_extMgm::extRelPath('templavoila') . 'cm1/index.php?' . 'table=tx_templavoila_datastructure&uid=' . $backRef->rec['tx_templavoila_ds'];
                 $localItems[] = $backRef->linkItem($LANG->getLLL('cm_viewdsto', $LL, 1) . ' [' . $backRef->rec['tx_templavoila_ds'] . '/' . $backRef->rec['tx_templavoila_to'] . ']', $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm2/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
             }
         }
         #			if ($table=='tt_content') {
         #					// Adding link for "Pages using this element":
         #				$localItems[] = $backRef->linkItem(
         #					$LANG->getLLL('cm1_pagesusingthiselement',$LL),
         #					$backRef->excludeIcon('<img src="'.t3lib_extMgm::extRelPath('templavoila').'cm1/cm_icon_activate.gif" width="15" height="12" border=0 align=top>'),
         #					"top.loadTopMenu('".t3lib_div::linkThisScript()."&cmLevel=1&subname=tx_templavoila_cm1_pagesusingthiselement');return false;",
         #					0,
         #					1
         #				);
         #			}
     } else {
         if (t3lib_div::_GP('subname') == 'tx_templavoila_cm1_pagesusingthiselement') {
             $menuItems = array();
             $url = t3lib_extMgm::extRelPath('templavoila') . 'mod1/index.php?id=';
             // Generate a list of pages where this element is also being used:
             $res = $TYPO3_DB->exec_SELECTquery('*', 'tx_templavoila_elementreferences', 'uid=' . $backRef->rec['uid']);
             if ($res) {
                 while (false != ($referenceRecord = $TYPO3_DB->sql_fetch_assoc($res))) {
                     $pageRecord = t3lib_beFunc::getRecord('pages', $referenceRecord['pid']);
                     $icon = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord);
                     // To do: Display language flag icon and jump to correct language
                     #						if ($referenceRecord['lkey'] != 'lDEF') {
                     #							$icon .= ' lKey:'.$referenceRecord['lkey'];
                     #						} elseif ($referenceRecord['vkey'] != 'vDEF') {
                     #							$icon .= ' vKey:'.$referenceRecord['vkey'];
                     #						}
                     if (is_array($pageRecord)) {
                         $menuItems[] = $backRef->linkItem($icon, t3lib_beFunc::getRecordTitle('pages', $pageRecord, 1), $backRef->urlRefForCM($url . $pageRecord['uid'], 'returnUrl'), 1);
                     }
                 }
             }
         }
     }
     // Simply merges the two arrays together and returns ...
     if (count($localItems)) {
         $menuItems = array_merge($menuItems, $localItems);
     }
     return $menuItems;
 }
    /**
     * Shows the log of indexed URLs
     *
     * @return	string		HTML output
     */
    function drawLog()
    {
        global $BACK_PATH;
        $output = '';
        // Init:
        $this->crawlerObj = t3lib_div::makeInstance('tx_crawler_lib');
        $this->crawlerObj->setAccessMode('gui');
        $this->crawlerObj->setID = t3lib_div::md5int(microtime());
        $this->CSVExport = t3lib_div::_POST('_csv');
        // Read URL:
        if (t3lib_div::_GP('qid_read')) {
            $this->crawlerObj->readUrl(intval(t3lib_div::_GP('qid_read')), TRUE);
        }
        // Look for set ID sent - if it is, we will display contents of that set:
        $showSetId = intval(t3lib_div::_GP('setID'));
        // Show details:
        if (t3lib_div::_GP('qid_details')) {
            // Get entry record:
            list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid=' . intval(t3lib_div::_GP('qid_details')));
            // Explode values:
            $resStatus = $this->getResStatus($q_entry);
            $q_entry['parameters'] = unserialize($q_entry['parameters']);
            $q_entry['result_data'] = unserialize($q_entry['result_data']);
            if (is_array($q_entry['result_data'])) {
                $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
            }
            if (!$this->pObj->MOD_SETTINGS['log_resultLog']) {
                unset($q_entry['result_data']['content']['log']);
            }
            // Print rudimentary details:
            $output .= '
				<br /><br />
				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
				<input type="hidden" value="' . $showSetId . '" name="setID" />
				<br />
				Current server time: ' . date('H:i:s', time()) . '<br />' . 'Status: ' . $resStatus . '<br />' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($q_entry) : t3lib_utility_Debug::viewArray($q_entry));
        } else {
            // Show list:
            // If either id or set id, show list:
            if ($this->pObj->id || $showSetId) {
                if ($this->pObj->id) {
                    // Drawing tree:
                    $tree = t3lib_div::makeInstance('t3lib_pageTree');
                    $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
                    $tree->init('AND ' . $perms_clause);
                    // Set root row:
                    $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
                    $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
                    $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML);
                    // Get branch beneath:
                    if ($this->pObj->MOD_SETTINGS['depth']) {
                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
                    }
                    // Traverse page tree:
                    $code = '';
                    $count = 0;
                    foreach ($tree->tree as $data) {
                        $code .= $this->drawLog_addRows($data['row'], $data['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $data['row'], TRUE), intval($this->pObj->MOD_SETTINGS['itemsPerPage']));
                        if (++$count == 1000) {
                            break;
                        }
                    }
                } else {
                    $code = '';
                    $code .= $this->drawLog_addRows($showSetId, 'Set ID: ' . $showSetId);
                }
                if ($code) {
                    $output .= '
						<br /><br />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist') . '" name="_reload" />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv') . '" name="_csv" />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushvisiblequeue') . '" name="_flush" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushfullqueue') . '" name="_flush_all" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" />
						<input type="hidden" value="' . $this->pObj->id . '" name="id" />
						<input type="hidden" value="' . $showSetId . '" name="setID" />
						<br />
						' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime') . ': ' . date('H:i:s', time()) . '
						<br /><br />


						<table class="lrPadding c-list crawlerlog">' . $this->drawLog_printTableHeader() . $code . '</table>';
                }
            } else {
                // Otherwise show available sets:
                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('set_id, count(*) as count_value, scheduled', 'tx_crawler_queue', '', 'set_id, scheduled', 'scheduled DESC');
                $code = '
					<tr class="bgColor5 tableheader">
						<td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid') . ':</td>
						<td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count') . 't:</td>
						<td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time') . ':</td>
					</tr>
				';
                $cc = 0;
                foreach ($setList as $set) {
                    $code .= '
						<tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '">
							<td><a href="' . htmlspecialchars('index.php?setID=' . $set['set_id']) . '">' . $set['set_id'] . '</a></td>
							<td>' . $set['count_value'] . '</td>
							<td>' . t3lib_BEfunc::dateTimeAge($set['scheduled']) . '</td>
						</tr>
					';
                    $cc++;
                }
                $output .= '
					<br /><br />
					<table class="lrPadding c-list">' . $code . '</table>';
            }
        }
        if ($this->CSVExport) {
            $this->outputCsvFile();
        }
        // Return output
        return $output;
    }
    /**
     * 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 = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord);
        $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage'))));
        $editButton = $this->pObj->link_edit($iconEdit, 'pages', $pageRecord['uid']);
        if ($this->userHasAccessToListModule()) {
            if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) {
                $listModuleURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'db_list.php?id=' . intval($this->pObj->id);
            } else {
                $listModuleURL = t3lib_BEfunc::getModuleUrl('web_list', array('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 />' . t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . '<strong><a href="#" onClick="' . $onClick . '">' . $LANG->getLL('editpage_sysfolder_switchtolistview', '', 1) . '</a></strong>
			';
        } else {
            $listModuleLink = $LANG->getLL('editpage_sysfolder_listview_noaccess', '', 1);
        }
        $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('editpage_sysfolder_intro', '', 1), '', t3lib_FlashMessage::INFO);
        $content = $flashMessage->render() . $listModuleLink;
        return $content;
    }
    /**
     * The main processing method if this class
     *
     * @return	string		Information of the template status or the taken actions as HTML string
     */
    function main()
    {
        global $SOBE, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        global $tmpl, $tplRow, $theConstants;
        $edit = $this->pObj->edit;
        $e = $this->pObj->e;
        t3lib_div::loadTCA('sys_template');
        // **************************
        // 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'];
        }
        // **************************
        // Initialize
        // **************************
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        if ($existTemplate) {
            $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
        }
        // **************************
        // Create extension template
        // **************************
        $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
        if ($newId) {
            // switch to new template
            t3lib_utility_Http::redirect('index.php?id=' . $this->pObj->id . '&SET[templatesOnPage]=' . $newId);
        }
        if ($existTemplate) {
            // Update template ?
            $POST = t3lib_div::_POST();
            if ($POST['submit'] || t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']) || $POST['saveclose'] || t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y'])) {
                // Set the data to be saved
                $recData = array();
                $alternativeFileName = array();
                $resList = $tplRow['resources'];
                $tmp_upload_name = '';
                $tmp_newresource_name = '';
                // Set this to blank
                if (is_array($POST['data'])) {
                    foreach ($POST['data'] as $field => $val) {
                        switch ($field) {
                            case 'constants':
                            case 'config':
                            case 'title':
                            case 'sitetitle':
                            case 'description':
                                $recData['sys_template'][$saveId][$field] = $val;
                                break;
                            case 'resources':
                                $tmp_upload_name = t3lib_div::upload_to_tempfile($_FILES['resources']['tmp_name']);
                                // If there is an uploaded file, move it for the sake of safe_mode.
                                if ($tmp_upload_name) {
                                    if ($tmp_upload_name != 'none' && $_FILES['resources']['name']) {
                                        $alternativeFileName[$tmp_upload_name] = trim($_FILES['resources']['name']);
                                        $resList = $tmp_upload_name . ',' . $resList;
                                    }
                                }
                                break;
                            case 'new_resource':
                                $newName = trim(t3lib_div::_GP('new_resource'));
                                if ($newName) {
                                    $newName .= '.' . t3lib_div::_GP('new_resource_ext');
                                    $tmp_newresource_name = t3lib_div::tempnam('new_resource_');
                                    $alternativeFileName[$tmp_newresource_name] = $newName;
                                    $resList = $tmp_newresource_name . ',' . $resList;
                                }
                                break;
                            case 'makecopy_resource':
                                if (is_array($val)) {
                                    $resList = ',' . $resList . ',';
                                    foreach ($val as $k => $file) {
                                        $tmp_name = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $file;
                                        $resList = $tmp_name . ',' . $resList;
                                    }
                                }
                                break;
                            case 'remove_resource':
                                if (is_array($val)) {
                                    $resList = ',' . $resList . ',';
                                    foreach ($val as $k => $file) {
                                        $resList = str_replace(',' . $file . ',', ',', $resList);
                                    }
                                }
                                break;
                            case 'totop_resource':
                                if (is_array($val)) {
                                    $resList = ',' . $resList . ',';
                                    foreach ($val as $k => $file) {
                                        $resList = str_replace(',' . $file . ',', ',', $resList);
                                        $resList = ',' . $file . $resList;
                                    }
                                }
                                break;
                        }
                    }
                }
                $resList = implode(',', t3lib_div::trimExplode(',', $resList, 1));
                if (strcmp($resList, $tplRow['resources'])) {
                    $recData['sys_template'][$saveId]['resources'] = $resList;
                }
                if (count($recData)) {
                    // Create new  tce-object
                    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                    $tce->stripslashes_values = 0;
                    $tce->alternativeFileName = $alternativeFileName;
                    // 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');
                    // tce were processed successfully
                    $this->tce_processed = true;
                    // re-read the template ...
                    $this->initialize_editor($this->pObj->id, $template_uid);
                }
                // Unlink any uploaded/new temp files there was:
                t3lib_div::unlink_tempfile($tmp_upload_name);
                t3lib_div::unlink_tempfile($tmp_newresource_name);
                // If files has been edited:
                if (is_array($edit)) {
                    if ($edit['filename'] && $tplRow['resources'] && t3lib_div::inList($tplRow['resources'], $edit['filename'])) {
                        // Check if there are resources, and that the file is in the resourcelist.
                        $path = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $edit['filename'];
                        $fI = t3lib_div::split_fileref($edit['filename']);
                        if (@is_file($path) && t3lib_div::getFileAbsFileName($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext'])) {
                            // checks that have already been done.. Just to make sure
                            // @TODO: Check if the hardcorded value already has a config member, otherwise create one
                            if (filesize($path) < 30720) {
                                // checks that have already been done.. Just to make sure
                                t3lib_div::writeFile($path, $edit['file']);
                                $theOutput .= $this->pObj->doc->spacer(10);
                                $theOutput .= $this->pObj->doc->section('<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>', sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']), 0, 0, 0, 1);
                                // Clear cache - the file has probably affected the template setup
                                // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
                                $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                                $tce->stripslashes_values = 0;
                                $tce->start(array(), array());
                                $tce->clear_cacheCmd('all');
                            }
                        }
                    }
                }
            }
            // hook	Post updating template/TCE processing
            if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) {
                $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'];
                if (is_array($postTCEProcessingHook)) {
                    $hookParameters = array('POST' => $POST, 'tce' => $tce);
                    foreach ($postTCEProcessingHook as $hookFunction) {
                        t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
                    }
                }
            }
            $theOutput .= $this->pObj->doc->spacer(5);
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), t3lib_iconWorks::getSpriteIconForRecord('sys_template', $tplRow) . '<strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' - (' . $tplRow['sitetitle'] . ')' : ''), 0, 1);
            if ($manyTemplatesMenu) {
                $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
                $theOutput .= $this->pObj->doc->divider(5);
            }
            #$numberOfRows= t3lib_div::intInRange($this->pObj->MOD_SETTINGS["ts_template_editor_TArows"],0,150);
            #if (!$numberOfRows)
            $numberOfRows = 35;
            // If abort pressed, nothing should be edited:
            if ($POST['abort'] || t3lib_div::testInt($POST['abort_x']) && t3lib_div::testInt($POST['abort_y']) || $POST['saveclose'] || t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y'])) {
                unset($e);
            }
            if ($e['title']) {
                $outCode = '<input type="Text" name="data[title]" value="' . htmlspecialchars($tplRow['title']) . '"' . $this->pObj->doc->formWidth() . '>';
                $outCode .= '<input type="Hidden" name="e[title]" value="1">';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode);
            }
            if ($e['sitetitle']) {
                $outCode = '<input type="Text" name="data[sitetitle]" value="' . htmlspecialchars($tplRow['sitetitle']) . '"' . $this->pObj->doc->formWidth() . '>';
                $outCode .= '<input type="Hidden" name="e[sitetitle]" value="1">';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode);
            }
            if ($e['description']) {
                $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, '', '') . '>' . t3lib_div::formatForTextarea($tplRow['description']) . '</textarea>';
                $outCode .= '<input type="Hidden" name="e[description]" value="1">';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode);
            }
            if ($e['resources']) {
                // Upload
                $outCode = '<input type="File" name="resources"' . $this->pObj->doc->formWidth() . ' size="50">';
                $outCode .= '<input type="Hidden" name="data[resources]" value="1">';
                $outCode .= '<input type="Hidden" name="e[resources]" value="1">';
                $outCode .= '<BR>' . $GLOBALS['LANG']->getLL('allowedExtensions') . ' <strong>' . $TCA['sys_template']['columns']['resources']['config']['allowed'] . '</strong>';
                $outCode .= '<BR>' . $GLOBALS['LANG']->getLL('maxFilesize') . ' <strong>' . t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size'] * 1024) . '</strong>';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('uploadResource'), $outCode);
                // New
                $opt = explode(',', $this->pObj->textExtensions);
                $optTags = '';
                foreach ($opt as $extVal) {
                    $optTags .= '<option value="' . $extVal . '">.' . $extVal . '</option>';
                }
                $outCode = '<input type="text" name="new_resource"' . $this->pObj->doc->formWidth(20) . '>
					<select name="new_resource_ext">' . $optTags . '</select>';
                $outCode .= '<input type="Hidden" name="data[new_resource]" value="1">';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('newTextResource'), $outCode);
                // Make copy
                $rL = $this->resourceListForCopy($this->pObj->id, $template_uid);
                if ($rL) {
                    $theOutput .= $this->pObj->doc->spacer(20);
                    $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('copyResource'), $rL);
                }
                // Update resource list
                $rL = $this->procesResources($tplRow['resources'], 1);
                if ($rL) {
                    $theOutput .= $this->pObj->doc->spacer(20);
                    $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('updateResourceList'), $rL);
                }
            }
            if ($e['constants']) {
                $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($tplRow['constants']) . '</textarea>';
                $outCode .= '<input type="Hidden" name="e[constants]" value="1">';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '');
                $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
            }
            if ($e['file']) {
                $path = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $e[file];
                $fI = t3lib_div::split_fileref($e[file]);
                if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext'])) {
                    if (filesize($path) < $TCA['sys_template']['columns']['resources']['config']['max_size'] * 1024) {
                        $fileContent = t3lib_div::getUrl($path);
                        $outCode = $GLOBALS['LANG']->getLL('file') . ' <strong>' . $e[file] . '</strong><BR>';
                        $outCode .= '<textarea name="edit[file]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($fileContent) . '</textarea>';
                        $outCode .= '<input type="Hidden" name="edit[filename]" value="' . $e[file] . '">';
                        $outCode .= '<input type="Hidden" name="e[file]" value="' . htmlspecialchars($e[file]) . '">';
                        $theOutput .= $this->pObj->doc->spacer(15);
                        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), '');
                        $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
                    } else {
                        $theOutput .= $this->pObj->doc->spacer(15);
                        $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $TCA['sys_template']['columns']['resources']['config']['max_size']);
                        $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $TCA['sys_template']['columns']['resources']['config']['max_size']);
                        $theOutput .= $this->pObj->doc->section('<font color=red>' . $fileToBig . '</font>', $filesizeNotAllowed, 0, 0, 0, 1);
                    }
                }
            }
            if ($e['config']) {
                $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, "width:98%;height:70%", "off") . ' class="fixed-font">' . t3lib_div::formatForTextarea($tplRow["config"]) . '</textarea>';
                if (t3lib_extMgm::isLoaded('tsconfig_help')) {
                    $url = $BACK_PATH . 'wizard_tsconfig.php?mode=tsref';
                    $params = array('formName' => 'editForm', 'itemName' => 'data[config]');
                    $outCode .= '<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;">' . t3lib_iconWorks::getSpriteIcon('actions-system-typoscript-documentation-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef', true))) . '</a>';
                }
                $outCode .= '<input type="Hidden" name="e[config]" value="1">';
                $theOutput .= $this->pObj->doc->spacer(15);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '');
                $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
            }
            // Processing:
            $outCode = '';
            $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('title'), htmlspecialchars($tplRow['title']), 'title');
            $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle');
            $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description');
            $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('resources'), $this->procesResources($tplRow['resources']), 'resources');
            $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('constants'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0), 'constants');
            $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('setup'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0), 'config');
            $outCode = '<br /><br /><table class="t3-table-info">' . $outCode . '</table>';
            // Edit all icon:
            $outCode .= '<br /><a href="#" onClick="' . t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0') . '&amp;edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' . t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editTemplateRecord'))) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>';
            $theOutput .= $this->pObj->doc->section('', $outCode);
            // hook	after compiling the output
            if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) {
                $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
                if (is_array($postOutputProcessingHook)) {
                    $hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows);
                    foreach ($postOutputProcessingHook as $hookFunction) {
                        t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
                    }
                }
            }
        } else {
            $theOutput .= $this->pObj->noTemplate(1);
        }
        return $theOutput;
    }
 /**
  * For RTE: This displays all content elements on a page and lets you create a link to the element.
  *
  * @return	string		HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
  */
 function expandPage()
 {
     $out = '';
     $expPageId = $this->browseLinks->expandPage;
     // Set page id (if any) to expand
     // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
     if (!$this->browseLinks->expandPage && $this->browseLinks->curUrlInfo['cElement']) {
         $expPageId = $this->browseLinks->curUrlInfo['pageid'];
         // Set to the current link page id.
     }
     // Draw the record list IF there is a page id to expand:
     if ($expPageId && t3lib_utility_Math::canBeInterpretedAsInteger($expPageId) && $GLOBALS['BE_USER']->isInWebMount($expPageId)) {
         // Set header:
         $out .= $this->browseLinks->barheader($GLOBALS['LANG']->getLL('contentElements') . ':');
         // Create header for listing, showing the page title/icon:
         $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
         $mainPageRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $expPageId);
         $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
         $picon .= \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $mainPageRec, TRUE);
         $out .= $picon . '<br />';
         // Look up tt_content elements from the expanded page:
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,header,hidden,starttime,endtime,fe_group,CType,colPos,bodytext,tx_jfmulticontent_view,tx_jfmulticontent_pages,tx_jfmulticontent_contents', 'tt_content', 'pid=' . intval($expPageId) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_content') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
         $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
         // Traverse list of records:
         $c = 0;
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $c++;
             $icon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row);
             if ($this->browseLinks->curUrlInfo['act'] == 'page' && $this->browseLinks->curUrlInfo['cElement'] == $row['uid']) {
                 $arrCol = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
             } else {
                 $arrCol = '';
             }
             // Putting list element HTML together:
             $out .= '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/join' . ($c == $cc ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . $arrCol . '<a href="#" onclick="return link_typo3Page(\'' . $expPageId . '\',\'#' . $row['uid'] . '\');">' . $icon . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('tt_content', $row, TRUE) . '</a><br />';
             $contents = array();
             // get all contents
             switch ($row['tx_jfmulticontent_view']) {
                 case "page":
                     $contents = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(",", $row['tx_jfmulticontent_pages']);
                     break;
                 case "content":
                     $contents = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(",", $row['tx_jfmulticontent_contents']);
                     break;
                 case "irre":
                     $resIrre = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'tx_jfmulticontent_irre_parentid=' . intval($row['uid']) . ' AND deleted = 0 AND hidden = 0', '', '');
                     while ($rowIrre = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resIrre)) {
                         $contents[] = $rowIrre['uid'];
                     }
                     break;
             }
             if (count($contents) > 0) {
                 $out .= '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />' . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/blank.gif', 'width="18" height="16"') . ' alt="" />';
                 foreach ($contents as $key => $content) {
                     $out .= '<a href="#" onclick="return link_typo3Page(\'' . $expPageId . '\',\'#jfmulticontent_c' . $row['uid'] . '-' . ($key + 1) . '\');">' . '&nbsp;' . ($key + 1) . '&nbsp;' . '</a>';
                 }
                 $out .= '<br/>';
             }
         }
     }
     return $out;
 }
    /**
     * Main function creating the content for the module.
     *
     * @return	string		HTML content for the module, actually a "section" made through the parent object in $this->pObj
     */
    function main()
    {
        global $SOBE, $LANG;
        $theCode = '';
        $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
        // create new pages here?
        $pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
        $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect');
        $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
        if (is_array($pRec)) {
            $data = t3lib_div::_GP('data');
            if (is_array($data['pages'])) {
                if (t3lib_div::_GP('createInListEnd')) {
                    $endI = end($menuItems);
                    $thePid = -intval($endI['uid']);
                    if (!$thePid) {
                        $thePid = $this->pObj->id;
                    }
                } else {
                    $thePid = $this->pObj->id;
                }
                $firstRecord = true;
                foreach ($data['pages'] as $identifier => $dat) {
                    if (!trim($dat['title'])) {
                        unset($data['pages'][$identifier]);
                    } else {
                        $data['pages'][$identifier]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0;
                        if ($firstRecord) {
                            $firstRecord = false;
                            $data['pages'][$identifier]['pid'] = $thePid;
                        } else {
                            $data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
                        }
                        $previousIdentifier = $identifier;
                    }
                }
                if (count($data['pages'])) {
                    reset($data);
                    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                    $tce->stripslashes_values = 0;
                    // set default TCA values specific for the user
                    $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
                    if (is_array($TCAdefaultOverride)) {
                        $tce->setDefaultsFromUserTS($TCAdefaultOverride);
                    }
                    $tce->start($data, array());
                    $tce->process_datamap();
                    t3lib_BEfunc::setUpdateSignal('updatePageTree');
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR);
                }
                $theCode .= $flashMessage->render();
                // Display result:
                $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
                $lines = array();
                foreach ($menuItems as $rec) {
                    t3lib_BEfunc::workspaceOL('pages', $rec);
                    if (is_array($rec)) {
                        $lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>';
                    }
                }
                $theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
            } else {
                // Create loremIpsum code:
                if (t3lib_extMgm::isLoaded('lorem_ipsum')) {
                    $loremIpsumObj = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
                }
                // Display create form
                $lines = array();
                for ($a = 0; $a < 9; $a++) {
                    $lines[] = '<label for="page_new_' . $a . '"> ' . $LANG->getLL('wiz_newPages_page') . ' ' . ($a + 1) . ':&nbsp;</label><input type="text" id="page_new_' . $a . '" name="data[pages][NEW' . $a . '][title]"' . $this->pObj->doc->formWidth(35) . ' />' . (is_object($loremIpsumObj) ? '<a href="#" onclick="' . htmlspecialchars($loremIpsumObj->getHeaderTitleJS('document.forms[0][\'data[pages][NEW' . $a . '][title]\'].value', 'title')) . '">' . $loremIpsumObj->getIcon('', $this->pObj->doc->backPath) . '</a>' : '');
                }
                $theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . implode('<br />', $lines) . '<br /><br />
				<input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' . $LANG->getLL('wiz_newPages_listEnd') . '</label><br />
				<input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' . $LANG->getLL('wiz_newPages_hidePages') . '</label><br /><br />
				<input type="submit" name="create" value="' . $LANG->getLL('wiz_newPages_lCreate') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" />&nbsp;<input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />';
            }
        } else {
            $theCode .= $GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1'));
        }
        // CSH
        $theCode .= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'], '<br />|');
        $out = $this->pObj->doc->section($LANG->getLL('wiz_crMany'), $theCode, 0, 1);
        return $out;
    }