コード例 #1
0
ファイル: index.php プロジェクト: punktDe/solr
    /**
     * Generates the module content
     *
     * @return void
     */
    protected function getModuleContent()
    {
        //// TEMPORARY
        // TODO add a "discover/update Solr connections button to the global section"
        $content = '
			<input type="hidden" id="solraction" name="solraction" value="" />
			';
        $content .= '<fieldset><legend>Site Actions</legend>';
        $content .= $this->renderIndexQueueInitializationSelector();
        $content .= '
				<input type="submit" value="Initialize Index Queue" name="s_initializeIndexQueue" onclick="document.forms[0].solraction.value=\'initializeIndexQueue\';" /> ';
        $content .= t3lib_BEfunc::wrapInHelp('', '', '', array('title' => 'Index Queue Initialization', 'description' => 'Initializing the Index Queue is the most complete way to force reindexing, or to build the Index Queue for
							 the first time. The Index Queue Worker scheduler task will then index the items listed in the Index Queue.
							 Initializing the Index Queue without selecting specific indexing configurations will behave like selecting all.'));
        $content .= '
				<br /><br /><hr /><br />
				<input type="submit" value="Clean up Site Index" name="s_cleanupSiteCores" onclick="document.forms[0].solraction.value=\'cleanupSiteCores\';" />';
        $content .= '
				<br /><br />
				<input type="submit" value="Empty Site Index" name="s_deleteSiteDocuments" onclick="Check = confirm(\'This will commit documents which may be pending, delete documents belonging to the currently selected site and commit again afterwards. Are you sure you want to delete the site\\\'s documents?\'); if (Check == true) document.forms[0].solraction.value=\'deleteSiteDocuments\';" />
			';
        $content .= '
				<br /><br />
				<input type="submit" value="Reload Index Configuration" name="s_reloadCore" onclick="document.forms[0].solraction.value=\'reloadSiteCores\';" />';
        $content .= '
			<br /><br /><hr /><br />
			<p>
				Delete document(s) from site index<br /><br />
			</p>
			<label for="delete_uid" style="display:block;width:60px;float:left">Item uid</label>
			<input id="delete_uid" type="text" name="delete_uid" value="" /> (also accepts comma separated lists of uids)<br /><br />
			<label for="delete_type" style="display:block;width:60px;float:left;">Item type</label>
			<input id="delete_type" type="text" name="delete_type" value="" /> (table name)<br /><br />
			<input type="submit" value="Delete Document(s)"name="s_deleteDocument" onclick="document.forms[0].solraction.value=\'deleteDocument\';" /><br /><br />
			';
        $content .= '</fieldset>';
        $content .= '
			<fieldset>
				<legend>Global Actions (affecting all sites and indexes)</legend>
				<input type="submit" value="Empty Index" name="s_emptyIndex" onclick="Check = confirm(\'This will commit documents which may be pending, clear the index and commit again afterwards. Are you sure you want to empty the index?\'); if (Check == true) document.forms[0].solraction.value=\'emptyIndex\';" /><br /><br />
			</fieldset>';
        $content .= '
			<hr class="double" />
			API Key: ' . Tx_Solr_Api::getApiKey();
        // TODO add a checkbox to the delete documents fields to also remove from Index Queue
        switch ($_POST['solraction']) {
            case 'initializeIndexQueue':
                $this->initializeIndexQueue();
                break;
            case 'cleanupSiteCores':
                $this->cleanupSiteIndex();
                break;
            case 'deleteSiteDocuments':
                $this->deleteSiteDocuments();
                break;
            case 'reloadSiteCores':
                $this->reloadSiteCores();
                break;
            case 'emptyIndex':
                $this->emptyIndex();
                break;
            case 'deleteDocument':
                $this->deleteDocument();
                break;
            default:
        }
        $this->content .= $this->doc->section('Apache Solr for TYPO3', $content, FALSE, TRUE);
    }
コード例 #2
0
ファイル: index.php プロジェクト: NaveedWebdeveloper/Test
 /**
  * Returns the CSH Icon for given string
  *
  * @param	string		Locallang key
  * @param	string		The label to be used, that should be wrapped in help
  * @return	string		HTML output.
  */
 protected function getCSH($str, $label)
 {
     $context = '_MOD_user_setup';
     $field = $str;
     $strParts = explode(':', $str);
     if (count($strParts) > 1) {
         // Setting comes from another extension
         $context = $strParts[0];
         $field = $strParts[1];
     } else {
         if (!t3lib_div::inList('language,simuser', $str)) {
             $field = 'option_' . $str;
         }
     }
     return t3lib_BEfunc::wrapInHelp($context, $field, $label);
 }
コード例 #3
0
ファイル: db_new.php プロジェクト: NaveedWebdeveloper/Test
    /**
     * Create a regular new element (pages and records)
     *
     * @return	void
     */
    function regularNew()
    {
        $doNotShowFullDescr = false;
        // Initialize array for accumulating table rows:
        $this->tRows = array();
        // tree images
        $halfLine = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' alt="" />';
        $firstLevel = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />';
        $secondLevel = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />';
        $secondLevelLast = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/joinbottom.gif', 'width="18" height="16"') . ' alt="" />';
        // Slight spacer from header:
        $this->code .= $halfLine;
        // New Page
        $table = 'pages';
        $v = $GLOBALS['TCA'][$table];
        $pageIcon = t3lib_iconWorks::getSpriteIconForRecord($table, array());
        $newPageIcon = t3lib_iconWorks::getSpriteIcon('actions-page-new');
        $rowContent = $firstLevel . $newPageIcon . '&nbsp;<strong>' . $GLOBALS['LANG']->getLL('createNewPage') . '</strong>';
        // New pages INSIDE this pages
        if ($this->newPagesInto && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, 'pages')) {
            // Create link to new page inside:
            $rowContent .= '<br />' . $secondLevel . $this->linkWrap(t3lib_iconWorks::getSpriteIconForRecord($table, array()) . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.inside', 1) . ')', $table, $this->id);
        }
        // New pages AFTER this pages
        if ($this->newPagesAfter && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
            $rowContent .= '<br />' . $secondLevel . $this->linkWrap($pageIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after', 1) . ')', 'pages', -$this->id);
        }
        // Link to page-wizard:
        $rowContent .= '<br />' . $secondLevelLast . '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($GLOBALS['LANG']->getLL('pageSelectPosition')) . '</a>';
        // Half-line:
        $rowContent .= '<br />' . $halfLine;
        // Compile table row to show the icon for "new page (select position)"
        $startRows = array();
        if ($this->showNewRecLink('pages')) {
            $startRows[] = '
				<tr>
					<td nowrap="nowrap">' . $rowContent . '</td>
					<td>' . t3lib_BEfunc::wrapInHelp($table, '') . '</td>
				</tr>
			';
        }
        // New tables (but not pages) INSIDE this pages
        $isAdmin = $GLOBALS['BE_USER']->isAdmin();
        $newContentIcon = t3lib_iconWorks::getSpriteIcon('actions-document-new');
        if ($this->newContentInto) {
            if (is_array($GLOBALS['TCA'])) {
                $groupName = '';
                foreach ($GLOBALS['TCA'] as $table => $v) {
                    $count = count($GLOBALS['TCA'][$table]);
                    $counter = 1;
                    if ($table != 'pages' && $this->showNewRecLink($table) && $this->isTableAllowedForThisPage($this->pageinfo, $table) && $GLOBALS['BE_USER']->check('tables_modify', $table) && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1) && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, $table)) {
                        $newRecordIcon = t3lib_iconWorks::getSpriteIconForRecord($table, array());
                        $rowContent = '';
                        // Create new link for record:
                        $newLink = $this->linkWrap($newRecordIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1), $table, $this->id);
                        // If the table is 'tt_content' (from "cms" extension), create link to wizard
                        if ($table == 'tt_content') {
                            $groupName = $GLOBALS['LANG']->getLL('createNewContent');
                            $rowContent = $firstLevel . $newContentIcon . '&nbsp;<strong>' . $GLOBALS['LANG']->getLL('createNewContent') . '</strong>';
                            // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead:
                            $overrideExt = $this->web_list_modTSconfig['properties']['newContentWiz.']['overrideWithExtension'];
                            $pathToWizard = t3lib_extMgm::isLoaded($overrideExt) ? t3lib_extMgm::extRelPath($overrideExt) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
                            $href = $pathToWizard . '?id=' . $this->id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                            $rowContent .= '<br />' . $secondLevel . $newLink . '<br />' . $secondLevelLast . '<a href="' . htmlspecialchars($href) . '">' . $newContentIcon . htmlspecialchars($GLOBALS['LANG']->getLL('clickForWizard')) . '</a>';
                            // Half-line added:
                            $rowContent .= '<br />' . $halfLine;
                        } else {
                            // get the title
                            if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) {
                                continue;
                            }
                            if ($v['ctrl']['adminOnly'] && !$isAdmin) {
                                continue;
                            }
                            $nameParts = explode('_', $table);
                            $thisTitle = '';
                            if ($nameParts[0] == 'tx' || $nameParts[0] == 'tt') {
                                // try to extract extension name
                                if (substr($v['ctrl']['title'], 0, 8) == 'LLL:EXT:') {
                                    $_EXTKEY = substr($v['ctrl']['title'], 8);
                                    $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY, '/'));
                                    if ($_EXTKEY != '') {
                                        // first try to get localisation of extension title
                                        $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY)));
                                        $langFile = $temp[0];
                                        $thisTitle = $GLOBALS['LANG']->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
                                        // if no localisation available, read title from ext_emconf.php
                                        if (!$thisTitle && is_file(t3lib_extMgm::extPath($_EXTKEY) . 'ext_emconf.php')) {
                                            include t3lib_extMgm::extPath($_EXTKEY) . 'ext_emconf.php';
                                            $thisTitle = $EM_CONF[$_EXTKEY]['title'];
                                        }
                                        $iconFile[$_EXTKEY] = '<img src="' . t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif" />';
                                    } else {
                                        $thisTitle = $nameParts[1];
                                        $iconFile[$_EXTKEY] = '';
                                    }
                                } else {
                                    $thisTitle = $nameParts[1];
                                    $iconFile[$_EXTKEY] = '';
                                }
                            } else {
                                $_EXTKEY = 'system';
                                $thisTitle = $GLOBALS['LANG']->getLL('system_records');
                                $iconFile['system'] = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root');
                            }
                            if ($groupName == '' || $groupName != $_EXTKEY) {
                                $groupName = $_EXTKEY;
                            }
                            $rowContent .= $newLink;
                            $counter++;
                        }
                        // Compile table row:
                        if ($table == 'tt_content') {
                            $startRows[] = '
								<tr>
									<td nowrap="nowrap">' . $rowContent . '</td>
									<td>' . t3lib_BEfunc::wrapInHelp($table, '') . '</td>
								</tr>';
                        } else {
                            $this->tRows[$groupName]['title'] = $thisTitle;
                            $this->tRows[$groupName]['html'][] = $rowContent;
                            $this->tRows[$groupName]['table'][] = $table;
                        }
                    }
                }
            }
        }
        // user sort
        $pageTS = t3lib_BEfunc::getPagesTSconfig($this->id);
        if (isset($pageTS['mod.']['wizards.']['newRecord.']['order'])) {
            $this->newRecordSortList = t3lib_div::trimExplode(',', $pageTS['mod.']['wizards.']['newRecord.']['order'], true);
        }
        uksort($this->tRows, array($this, 'sortNewRecordsByConfig'));
        // Compile table row:
        $finalRows = array();
        $finalRows[] = implode('', $startRows);
        foreach ($this->tRows as $key => $value) {
            $row = '<tr>
						<td nowrap="nowrap">' . $halfLine . '<br />' . $firstLevel . '' . $iconFile[$key] . '&nbsp;<strong>' . $value['title'] . '</strong>' . '</td><td>' . t3lib_BEfunc::wrapInHelp($table, '') . '</td>
						</tr>';
            $count = count($value['html']) - 1;
            foreach ($value['html'] as $recordKey => $record) {
                $row .= '
					<tr>
						<td nowrap="nowrap">' . ($recordKey < $count ? $secondLevel : $secondLevelLast) . $record . '</td>
						<td>' . t3lib_BEfunc::wrapInHelp($value['table'][$recordKey], '') . '</td>
					</tr>';
            }
            $finalRows[] = $row;
        }
        // end of tree
        $finalRows[] = '
			<tr>
				<td><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/stopper.gif', 'width="18" height="16"') . ' alt="" /></td>
				<td></td>
			</tr>
		';
        // Make table:
        $this->code .= '
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-newRecord">
			' . implode('', $finalRows) . '
			</table>
		';
    }
コード例 #4
0
ファイル: index.php プロジェクト: NaveedWebdeveloper/Test
    /**
     * Main function, starting the rendering of the list.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $CLIENT;
        // Start document template object:
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/db_list.html');
        // Loading current page record and checking access:
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        // Apply predefined values for hidden checkboxes
        // Set predefined value for DisplayBigControlPanel:
        if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') {
            $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
        } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') {
            $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
        }
        // Set predefined value for Clipboard:
        if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') {
            $this->MOD_SETTINGS['clipBoard'] = TRUE;
        } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') {
            $this->MOD_SETTINGS['clipBoard'] = FALSE;
        }
        // Set predefined value for LocalizationView:
        if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') {
            $this->MOD_SETTINGS['localization'] = TRUE;
        } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') {
            $this->MOD_SETTINGS['localization'] = FALSE;
        }
        // Initialize the dblist object:
        $dblist = t3lib_div::makeInstance('localRecordList');
        $dblist->backPath = $BACK_PATH;
        $dblist->script = t3lib_BEfunc::getModuleUrl('web_list', array(), '');
        $dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo);
        $dblist->thumbs = $BE_USER->uc['thumbnailsByDefault'];
        $dblist->returnUrl = $this->returnUrl;
        $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0;
        $dblist->localizationView = $this->MOD_SETTINGS['localization'];
        $dblist->showClipboard = 1;
        $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
        $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
        $dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
        $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
        $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
        $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0;
        $dblist->allowedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1);
        $dblist->deniedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1);
        $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
        $dblist->pageRow = $this->pageinfo;
        $dblist->counter++;
        $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
        $dblist->modTSconfig = $this->modTSconfig;
        // Clipboard is initialized:
        $dblist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
        // Start clipboard
        $dblist->clipObj->initializeClipboard();
        // Initialize - reads the clipboard content from the user session
        // Clipboard actions are handled:
        $CB = t3lib_div::_GET('CB');
        // CB is the clipboard command array
        if ($this->cmd == 'setCB') {
            // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements
            // This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
            $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array) t3lib_div::_POST('CBH'), (array) t3lib_div::_POST('CBC')), $this->cmd_table);
        }
        if (!$this->MOD_SETTINGS['clipBoard']) {
            $CB['setP'] = 'normal';
        }
        // If the clipboard is NOT shown, set the pad to 'normal'.
        $dblist->clipObj->setCmd($CB);
        // Execute commands.
        $dblist->clipObj->cleanCurrent();
        // Clean up pad
        $dblist->clipObj->endClipboard();
        // Save the clipboard content
        // This flag will prevent the clipboard panel in being shown.
        // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
        $dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$BE_USER->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
        // If there is access to the page, then render the list contents and set up the document template object:
        if ($access) {
            // Deleting records...:
            // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
            if ($this->cmd == 'delete') {
                $items = $dblist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), $this->cmd_table, 1);
                if (count($items)) {
                    $cmd = array();
                    foreach ($items as $iK => $value) {
                        $iKParts = explode('|', $iK);
                        $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1;
                    }
                    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                    $tce->stripslashes_values = 0;
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    if (isset($cmd['pages'])) {
                        t3lib_BEfunc::setUpdateSignal('updatePageTree');
                    }
                    $tce->printLogErrorMessages(t3lib_div::getIndpEnv('REQUEST_URI'));
                }
            }
            // Initialize the listing object, dblist, for rendering the list:
            $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
            $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
            $dblist->setDispFields();
            // Render versioning selector:
            if (t3lib_extMgm::isLoaded('version')) {
                $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
            }
            // Render the list of tables:
            $dblist->generateList();
            // Write the bottom of the page:
            $dblist->writeBottom();
            $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH']));
            // Add JavaScript functions to the page:
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
					return false;
				}
				function jumpExt(URL,anchor)	{	//
					var anc = anchor?anchor:"";
					window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
					return false;
				}
				function jumpSelf(URL)	{	//
					window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
					return false;
				}

				function setHighlight(id)	{	//
					top.fsMod.recentIds["web"]=id;
					top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

					if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)	{
						top.content.nav_frame.refresh_nav();
					}
				}
				' . $this->doc->redirectUrls($listUrl) . '
				' . $dblist->CBfunctions() . '
				function editRecords(table,idList,addParams,CBflag)	{	//
					window.location.href="' . $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
				}
				function editList(table,idList)	{	//
					var list="";

						// Checking how many is checked, how many is not
					var pointer=0;
					var pos = idList.indexOf(",");
					while (pos!=-1)	{
						if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
							list+=idList.substr(pointer,pos-pointer)+",";
						}
						pointer=pos+1;
						pos = idList.indexOf(",",pointer);
					}
					if (cbValue(table+"|"+idList.substr(pointer))) {
						list+=idList.substr(pointer)+",";
					}

					return list ? list : idList;
				}

				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
        }
        // access
        // Begin to compile the whole page, starting out with page header:
        $this->body = '';
        $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
        $this->body .= $dblist->HTMLcode;
        $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
        // If a listing was produced, create the page footer with search form etc:
        if ($dblist->HTMLcode) {
            // Making field select box (when extended view for a single table is enabled):
            if ($dblist->table) {
                $this->body .= $dblist->fieldSelectBox($dblist->table);
            }
            // Adding checkbox options for extended listing and clipboard display:
            $this->body .= '

					<!--
						Listing options for extended view, clipboard and localization view
					-->
					<div id="typo3-listOptions">
						<form action="" method="post">';
            // Add "display bigControlPanel" checkbox:
            if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') {
                $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"');
                $this->body .= '<label for="checkLargeControl">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />';
            }
            // Add "clipboard" checkbox:
            if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') {
                if ($dblist->showClipboard) {
                    $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"');
                    $this->body .= '<label for="checkShowClipBoard">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />';
                }
            }
            // Add "localization view" checkbox:
            if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') {
                $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"');
                $this->body .= '<label for="checkLocalization">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />';
            }
            $this->body .= '
						</form>
					</div>';
            // Printing clipboard if enabled:
            if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) {
                $this->body .= $dblist->clipObj->printClipboard();
            }
            // Search box:
            $sectionTitle = t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE));
            $this->body .= $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE);
            // Display sys-notes, if any are found:
            $this->body .= $dblist->showSysNotesForPage();
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $dblist->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body);
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render('DB list', $this->content);
    }
コード例 #5
0
    /**
     * Prints the clipboard
     *
     * @return	string		HTML output
     */
    function printClipboard()
    {
        global $TBE_TEMPLATE, $LANG;
        $out = array();
        $elCount = count($this->elFromTable($this->fileMode ? '_FILE' : ''));
        // Upper header
        $out[] = '
			<tr class="t3-row-header">
				<td colspan="3">' . t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_clipboard', $this->clLabel('clipboard', 'buttons')) . '</td>
			</tr>';
        // Button/menu header:
        $thumb_url = t3lib_div::linkThisScript(array('CB' => array('setThumb' => $this->clipData['_setThumb'] ? 0 : 1)));
        $rmall_url = t3lib_div::linkThisScript(array('CB' => array('removeAll' => $this->current)));
        // Copymode Selector menu
        $copymode_url = t3lib_div::linkThisScript();
        $moveLabel = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:moveElements'));
        $copyLabel = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:copyElements'));
        $opt = array();
        $opt[] = '<option style="padding-left: 20px; background-image: url(\'' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/clip_cut.gif', '', 1) . '\'); background-repeat: no-repeat;" value="" ' . ($this->currentMode() == 'copy' ? '' : 'selected="selected"') . '>' . $moveLabel . '</option>';
        $opt[] = '<option style="padding-left: 20px; background-image: url(\'' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/clip_copy.gif', '', 1) . '\'); background-repeat: no-repeat;" value="1" ' . ($this->currentMode() == 'copy' ? 'selected="selected"' : '') . '>' . $copyLabel . '</option>';
        $copymode_selector = ' <select name="CB[setCopyMode]" onchange="this.form.method=\'POST\'; this.form.action=\'' . htmlspecialchars($copymode_url . '&CB[setCopyMode]=') . '\'+(this.options[this.selectedIndex].value); this.form.submit(); return true;" >' . implode('', $opt) . '</select>';
        // Selector menu + clear button
        $opt = array();
        $opt[] = '<option value="" selected="selected">' . $this->clLabel('menu', 'rm') . '</option>';
        // Import / Export link:
        if ($elCount && t3lib_extMgm::isLoaded('impexp')) {
            $opt[] = '<option value="' . htmlspecialchars("window.location.href='" . $this->backPath . t3lib_extMgm::extRelPath('impexp') . 'app/index.php' . $this->exportClipElementParameters() . '\';') . '">' . $this->clLabel('export', 'rm') . '</option>';
        }
        // Edit:
        if (!$this->fileMode && $elCount) {
            $opt[] = '<option value="' . htmlspecialchars("window.location.href='" . $this->editUrl() . "&returnUrl='+top.rawurlencode(window.location.href);") . '">' . $this->clLabel('edit', 'rm') . '</option>';
        }
        // Delete:
        if ($elCount) {
            if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
                $js = "\n\t\t\tif(confirm(" . $GLOBALS['LANG']->JScharCode(sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.deleteClip'), $elCount)) . ")){\n\t\t\t\twindow.location.href='" . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . "&redirect='+top.rawurlencode(window.location.href);\n\t\t\t}\n\t\t\t\t\t";
            } else {
                $js = " window.location.href='" . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . "&redirect='+top.rawurlencode(window.location.href); ";
            }
            $opt[] = '<option value="' . htmlspecialchars($js) . '">' . $this->clLabel('delete', 'rm') . '</option>';
        }
        $selector_menu = '<select name="_clipMenu" onchange="eval(this.options[this.selectedIndex].value);this.selectedIndex=0;">' . implode('', $opt) . '</select>';
        $out[] = '
			<tr class="typo3-clipboard-head">
				<td nowrap="nowrap">' . '<a href="' . htmlspecialchars($thumb_url) . '#clip_head">' . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/thumb_' . ($this->clipData['_setThumb'] ? 's' : 'n') . '.gif', 'width="21" height="16"') . ' vspace="2" border="0" title="' . $this->clLabel('thumbmode_clip') . '" alt="" />' . '</a>' . '</td>
				<td width="95%" nowrap="nowrap">' . $copymode_selector . ' ' . $selector_menu . '</td>
				<td>' . '<a href="' . htmlspecialchars($rmall_url) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-document-close', array('title' => $LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.clear', TRUE))) . '</a></td>
			</tr>';
        // Print header and content for the NORMAL tab:
        $out[] = '
			<tr class="bgColor5">
				<td colspan="3"><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CB' => array('setP' => 'normal')))) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-view-table-' . ($this->current == 'normal' ? 'collapse' : 'expand')) . $this->padTitleWrap('Normal', 'normal') . '</a></td>
			</tr>';
        if ($this->current == 'normal') {
            $out = array_merge($out, $this->printContentFromTab('normal'));
        }
        // Print header and content for the NUMERIC tabs:
        for ($a = 1; $a <= $this->numberTabs; $a++) {
            $out[] = '
				<tr class="bgColor5">
					<td colspan="3"><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CB' => array('setP' => 'tab_' . $a)))) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-view-table-' . ($this->current == 'tab_' . $a ? 'collapse' : 'expand')) . $this->padTitleWrap($this->clLabel('cliptabs') . $a, 'tab_' . $a) . '</a></td>
				</tr>';
            if ($this->current == 'tab_' . $a) {
                $out = array_merge($out, $this->printContentFromTab('tab_' . $a));
            }
        }
        // Wrap accumulated rows in a table:
        $output = '<a name="clip_head"></a>

			<!--
				TYPO3 Clipboard:
			-->
			<table cellpadding="0" cellspacing="1" border="0" width="290" id="typo3-clipboard">
				' . implode('', $out) . '
			</table>';
        // Wrap in form tag:
        $output = '<form action="">' . $output . '</form>';
        // Return the accumulated content:
        return $output;
    }
 /**
  * Render additional information fields within the scheduler backend.
  *
  * @param	array		$taksInfo: array information of task to return
  * @param	task		$task: task object
  * @param	tx_scheduler_Module		$schedulerModule: reference to the calling object (BE module of the Scheduler)
  * @return	array		additional fields
  * @see interfaces/tx_scheduler_AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
  */
 public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule)
 {
     $additionalFields = array();
     if (empty($taskInfo['configuration'])) {
         if ($schedulerModule->CMD == 'add') {
             $taskInfo['configuration'] = '';
         } elseif ($schedulerModule->CMD == 'edit') {
             $taskInfo['configuration'] = $task->getConfiguration();
         } else {
             $taskInfo['configuration'] = $task->getConfiguration();
         }
     }
     if (empty($taskInfo['depth'])) {
         if ($schedulerModule->CMD == 'add') {
             $taskInfo['depth'] = array();
         } elseif ($schedulerModule->CMD == 'edit') {
             $taskInfo['depth'] = $task->getDepth();
         } else {
             $taskInfo['depth'] = $task->getDepth();
         }
     }
     if (empty($taskInfo['page'])) {
         if ($schedulerModule->CMD == 'add') {
             $taskInfo['page'] = '';
         } elseif ($schedulerModule->CMD == 'edit') {
             $taskInfo['page'] = $task->getPage();
         } else {
             $taskInfo['page'] = $task->getPage();
         }
     }
     if (empty($taskInfo['email'])) {
         if ($schedulerModule->CMD == 'add') {
             $taskInfo['email'] = '';
         } elseif ($schedulerModule->CMD == 'edit') {
             $taskInfo['email'] = $task->getEmail();
         } else {
             $taskInfo['email'] = $task->getEmail();
         }
     }
     if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
         if ($schedulerModule->CMD == 'add') {
             $taskInfo['emailOnBrokenLinkOnly'] = 1;
         } elseif ($schedulerModule->CMD == 'edit') {
             $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
         } else {
             $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
         }
     }
     if (empty($taskInfo['emailTemplateFile'])) {
         if ($schedulerModule->CMD == 'add') {
             $taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/res/mailtemplate.html';
         } elseif ($schedulerModule->CMD == 'edit') {
             $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
         } else {
             $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
         }
     }
     $fieldID = 'task_page';
     $fieldCode = '<input type="text" name="tx_scheduler[linkvalidator][page]"  id="' . $fieldID . '" value="' . htmlspecialchars($taskInfo['page']) . '"/>';
     $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.page');
     $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => $label);
     // input for depth
     $fieldID = 'task_depth';
     $fieldValueArray = array('0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'), '1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'), '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'), '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'), '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'), '999' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi'));
     $fieldCode = '<select name="tx_scheduler[linkvalidator][depth]" id="' . $fieldID . '">';
     foreach ($fieldValueArray as $depth => $label) {
         $fieldCode .= "\t" . '<option value="' . htmlspecialchars($depth) . '"' . ($depth == $taskInfo['depth'] ? ' selected="selected"' : '') . '>' . $label . '</option>';
     }
     $fieldCode .= '</select>';
     $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.depth');
     $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => $label);
     $fieldID = 'task_configuration';
     $fieldCode = '<textarea  name="tx_scheduler[linkvalidator][configuration]" id="' . $fieldID . '" >' . htmlspecialchars($taskInfo['configuration']) . '</textarea>';
     $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.conf');
     $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => $label);
     $fieldID = 'task_email';
     $fieldCode = '<input type="text"  name="tx_scheduler[linkvalidator][email]" id="' . $fieldID . '" value="' . htmlspecialchars($taskInfo['email']) . '" />';
     $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.email');
     $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => $label);
     $fieldID = 'task_emailOnBrokenLinkOnly';
     $fieldCode = '<input type="checkbox"  name="tx_scheduler[linkvalidator][emailOnBrokenLinkOnly]" id="' . $fieldID . '" ' . (htmlspecialchars($taskInfo['emailOnBrokenLinkOnly']) ? 'checked="checked"' : '') . ' />';
     $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
     $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => $label);
     $fieldID = 'task_emailTemplateFile';
     $fieldCode = '<input type="text"  name="tx_scheduler[linkvalidator][emailTemplateFile]" id="' . $fieldID . '" value="' . htmlspecialchars($taskInfo['emailTemplateFile']) . '" />';
     $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
     $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
     $additionalFields[$fieldID] = array('code' => $fieldCode, 'label' => $label);
     return $additionalFields;
 }
コード例 #7
0
    /**
     * Recursive rendering of flexforms
     *
     * @param	array		(part of) Data Structure for which to render. Keys on first level is flex-form fields
     * @param	array		(part of) Data array of flexform corresponding to the input DS. Keys on first level is flex-form field names
     * @param	string		Table name, eg. tt_content
     * @param	string		Field name, eg. tx_templavoila_flex
     * @param	array		The particular record from $table in which the field $field is found
     * @param	array		Array of standard information for rendering of a form field in TCEforms, see other rendering functions too
     * @param	string		Form field prefix, eg. "[data][sDEF][lDEF][...][...]"
     * @param	integer		Indicates nesting level for the function call
     * @param	string		Prefix for ID-values
     * @param	boolean		Defines whether the next flexform level is open or closed. Comes from _TOGGLE pseudo field in FlexForm xml.
     * @return	string		HTMl code for form.
     */
    function getSingleField_typeFlex_draw($dataStruct, $editData, $table, $field, $row, &$PA, $formPrefix = '', $level = 0, $idPrefix = 'ID', $toggleClosed = FALSE)
    {
        $output = '';
        $mayRestructureFlexforms = $GLOBALS['BE_USER']->checkLanguageAccess(0);
        // Data Structure array must be ... and array of course...
        if (is_array($dataStruct)) {
            foreach ($dataStruct as $key => $value) {
                // Traversing fields in structure:
                if (is_array($value)) {
                    // The value of each entry must be an array.
                    // ********************
                    // Making the row:
                    // ********************
                    // Title of field:
                    $theTitle = htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($value['tx_templavoila']['title']), 30));
                    // If it's a "section" or "container":
                    if ($value['type'] == 'array') {
                        // Creating IDs for form fields:
                        // It's important that the IDs "cascade" - otherwise we can't dynamically expand the flex form because this relies on simple string substitution of the first parts of the id values.
                        $thisId = t3lib_div::shortMd5(uniqid('id', TRUE));
                        // This is a suffix used for forms on this level
                        $idTagPrefix = $idPrefix . '-' . $thisId;
                        // $idPrefix is the prefix for elements on lower levels in the hierarchy and we combine this with the thisId value to form a new ID on this level.
                        // If it's a "section" containing other elements:
                        if ($value['section']) {
                            // Load script.aculo.us if flexform sections can be moved by drag'n'drop:
                            $GLOBALS['SOBE']->doc->getPageRenderer()->loadScriptaculous();
                            // Render header of section:
                            $output .= '<div class="t3-form-field-label-flexsection"><strong>' . $theTitle . '</strong></div>';
                            // Render elements in data array for section:
                            $tRows = array();
                            $cc = 0;
                            if (is_array($editData[$key]['el'])) {
                                foreach ($editData[$key]['el'] as $k3 => $v3) {
                                    $cc = $k3;
                                    if (is_array($v3)) {
                                        $theType = key($v3);
                                        $theDat = $v3[$theType];
                                        $newSectionEl = $value['el'][$theType];
                                        if (is_array($newSectionEl)) {
                                            $tRows[] = $this->getSingleField_typeFlex_draw(array($theType => $newSectionEl), array($theType => $theDat), $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el][' . $cc . ']', $level + 1, $idTagPrefix, $v3['_TOGGLE']);
                                        }
                                    }
                                }
                            }
                            // Now, we generate "templates" for new elements that could be added to this section by traversing all possible types of content inside the section:
                            // We have to handle the fact that requiredElements and such may be set during this rendering process and therefore we save and reset the state of some internal variables - little crude, but works...
                            // Preserving internal variables we don't want to change:
                            $TEMP_requiredElements = $this->requiredElements;
                            // Traversing possible types of new content in the section:
                            $newElementsLinks = array();
                            foreach ($value['el'] as $nnKey => $nCfg) {
                                $additionalJS_post_saved = $this->additionalJS_post;
                                $this->additionalJS_post = array();
                                $additionalJS_submit_saved = $this->additionalJS_submit;
                                $this->additionalJS_submit = array();
                                $newElementTemplate = $this->getSingleField_typeFlex_draw(array($nnKey => $nCfg), array(), $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el][' . $idTagPrefix . '-form]', $level + 1, $idTagPrefix);
                                // Makes a "Add new" link:
                                $var = uniqid('idvar');
                                $replace = 'replace(/' . $idTagPrefix . '-/g,"' . $idTagPrefix . '-"+' . $var . '+"-")';
                                $onClickInsert = 'var ' . $var . ' = "' . 'idx"+(new Date()).getTime();';
                                // Do not replace $isTagPrefix in setActionStatus() because it needs section id!
                                $onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), unescape("' . rawurlencode($newElementTemplate) . '").' . $replace . '); setActionStatus("' . $idTagPrefix . '");';
                                $onClickInsert .= 'eval(unescape("' . rawurlencode(implode(';', $this->additionalJS_post)) . '").' . $replace . ');';
                                $onClickInsert .= 'TBE_EDITOR.addActionChecks("submit", unescape("' . rawurlencode(implode(';', $this->additionalJS_submit)) . '").' . $replace . ');';
                                $onClickInsert .= 'return false;';
                                // Kasper's comment (kept for history): Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works...
                                $this->additionalJS_post = $additionalJS_post_saved;
                                $this->additionalJS_submit = $additionalJS_submit_saved;
                                $new = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new', 1);
                                $newElementsLinks[] = '<a href="#" onclick="' . htmlspecialchars($onClickInsert) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($nCfg['tx_templavoila']['title']), 30)) . '</a>';
                            }
                            // Reverting internal variables we don't want to change:
                            $this->requiredElements = $TEMP_requiredElements;
                            // Adding the sections:
                            $toggleAll = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.toggleall', 1);
                            $output .= '
							<div class="t3-form-field-toggle-flexsection">
								<a href="#" onclick="' . htmlspecialchars('flexFormToggleSubs("' . $idTagPrefix . '"); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . '
								</a>
							</div>

							<div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsection">' . implode('', $tRows) . '</div>';
                            $output .= $mayRestructureFlexforms ? '<div class="t3-form-field-add-flexsection"><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.addnew', 1) . ':</strong> ' . implode(' | ', $newElementsLinks) . '</div>' : '';
                        } else {
                            // It is a container
                            $toggleIcon_open = t3lib_iconWorks::getSpriteIcon('actions-move-down');
                            $toggleIcon_close = t3lib_iconWorks::getSpriteIcon('actions-move-right');
                            // Create on-click actions.
                            //$onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;';	// Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file.
                            $onClickRemove = 'if (confirm("Are you sure?")){/*###REMOVE###*/;$("' . $idTagPrefix . '").hide();setActionStatus("' . $idPrefix . '");} return false;';
                            $onClickToggle = 'flexFormToggle("' . $idTagPrefix . '"); return false;';
                            $onMove = 'flexFormSortable("' . $idPrefix . '")';
                            // Notice: Creating "new" elements after others seemed to be too difficult to do and since moving new elements created in the bottom is now so easy with drag'n'drop I didn't see the need.
                            // Putting together header of a section. Sections can be removed, copied, opened/closed, moved up and down:
                            // I didn't know how to make something right-aligned without a table, so I put it in a table. can be made into <div>'s if someone like to.
                            // Notice: The fact that I make a "Sortable.create" right onmousedown is that if we initialize this when rendering the form in PHP new and copied elements will not be possible to move as a sortable. But this way a new sortable is initialized everytime someone tries to move and it will always work.
                            $ctrlHeader = '
								<table class="t3-form-field-header-flexsection" onmousedown="' . ($mayRestructureFlexforms ? htmlspecialchars($onMove) : '') . '">
								<tr>
									<td>
										<a href="#" onclick="' . htmlspecialchars($onClickToggle) . '" id="' . $idTagPrefix . '-toggle">
											' . ($toggleClosed ? $toggleIcon_close : $toggleIcon_open) . '
										</a>
										<strong>' . $theTitle . '</strong> <em><span id="' . $idTagPrefix . '-preview"></span></em>
									</td>
									<td align="right">' . ($mayRestructureFlexforms ? t3lib_iconWorks::getSpriteIcon('actions-move-move', array('title' => 'Drag to Move')) : '') . ($mayRestructureFlexforms ? '<a href="#" onclick="' . htmlspecialchars($onClickRemove) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Delete')) : '') . '</td>
									</tr>
								</table>';
                            $s = t3lib_div::revExplode('[]', $formPrefix, 2);
                            $actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION][' . $s[1];
                            // Push the container to DynNestedStack as it may be toggled
                            $this->pushToDynNestedStack('flex', $idTagPrefix);
                            // Putting together the container:
                            $this->additionalJS_delete = array();
                            $output .= '
								<div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsections">
									<input id="' . $idTagPrefix . '-action" type="hidden" name="' . htmlspecialchars($actionFieldName) . '" value=""/>

									' . $ctrlHeader . '
									<div class="t3-form-field-record-flexsection" id="' . $idTagPrefix . '-content"' . ($toggleClosed ? ' style="display:none;"' : '') . '>' . $this->getSingleField_typeFlex_draw($value['el'], $editData[$key]['el'], $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el]', $level + 1, $idTagPrefix) . '
									</div>
									<input id="' . $idTagPrefix . '-toggleClosed" type="hidden" name="' . htmlspecialchars('data[' . $table . '][' . $row['uid'] . '][' . $field . ']' . $formPrefix . '[_TOGGLE]') . '" value="' . ($toggleClosed ? 1 : 0) . '" />
								</div>';
                            $output = str_replace('/*###REMOVE###*/', t3lib_div::slashJS(htmlspecialchars(implode('', $this->additionalJS_delete))), $output);
                            // NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized" according to the data structure. It means that flexform XML will report unclean and a cleaning operation will remove the recorded togglestates. This is not a fatal problem. Ideally we should save the toggle states in meta-data but it is much harder to do that. And this implementation was easy to make and with no really harmful impact.
                            // Pop the container from DynNestedStack
                            $this->popFromDynNestedStack('flex', $idTagPrefix);
                        }
                        // If it's a "single form element":
                    } elseif (is_array($value['TCEforms']['config'])) {
                        // Rendering a single form element:
                        if (is_array($PA['_valLang'])) {
                            $rotateLang = $PA['_valLang'];
                        } else {
                            $rotateLang = array($PA['_valLang']);
                        }
                        $conditionData = is_array($editData) ? $editData : array();
                        // add current $row to data processed by isDisplayCondition()
                        $conditionData['parentRec'] = $row;
                        $tRows = array();
                        foreach ($rotateLang as $vDEFkey) {
                            $vDEFkey = 'v' . $vDEFkey;
                            if (!$value['TCEforms']['displayCond'] || $this->isDisplayCondition($value['TCEforms']['displayCond'], $conditionData, $vDEFkey)) {
                                $fakePA = array();
                                $fakePA['fieldConf'] = array('label' => $this->sL(trim($value['TCEforms']['label'])), 'config' => $value['TCEforms']['config'], 'defaultExtras' => $value['TCEforms']['defaultExtras'], 'onChange' => $value['TCEforms']['onChange']);
                                if ($PA['_noEditDEF'] && $PA['_lang'] === 'lDEF') {
                                    $fakePA['fieldConf']['config'] = array('type' => 'none', 'rows' => 2);
                                }
                                if ($fakePA['fieldConf']['onChange'] == 'reload' || $GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key, $GLOBALS['TCA'][$table]['ctrl']['type']) || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $key)) {
                                    if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
                                        $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                                    } else {
                                        $alertMsgOnChange = 'if(TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}';
                                    }
                                } else {
                                    $alertMsgOnChange = '';
                                }
                                $fakePA['fieldChangeFunc'] = $PA['fieldChangeFunc'];
                                if (strlen($alertMsgOnChange)) {
                                    $fakePA['fieldChangeFunc']['alert'] = $alertMsgOnChange;
                                }
                                $fakePA['onFocus'] = $PA['onFocus'];
                                $fakePA['label'] = $PA['label'];
                                $fakePA['itemFormElName'] = $PA['itemFormElName'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']';
                                $fakePA['itemFormElName_file'] = $PA['itemFormElName_file'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']';
                                $fakePA['itemFormElID'] = $fakePA['itemFormElName'];
                                if (isset($editData[$key][$vDEFkey])) {
                                    $fakePA['itemFormElValue'] = $editData[$key][$vDEFkey];
                                } else {
                                    $fakePA['itemFormElValue'] = $fakePA['fieldConf']['config']['default'];
                                }
                                $theFormEl = $this->getSingleField_SW($table, $field, $row, $fakePA);
                                $theTitle = htmlspecialchars($fakePA['fieldConf']['label']);
                                if (!in_array('DEF', $rotateLang)) {
                                    $defInfo = '<div class="typo3-TCEforms-originalLanguageValue">' . $this->getLanguageIcon($table, $row, 0) . $this->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field) . '&nbsp;</div>';
                                } else {
                                    $defInfo = '';
                                }
                                if (!$PA['_noEditDEF']) {
                                    $prLang = $this->getAdditionalPreviewLanguages();
                                    foreach ($prLang as $prL) {
                                        $defInfo .= '<div class="typo3-TCEforms-originalLanguageValue">' . $this->getLanguageIcon($table, $row, 'v' . $prL['ISOcode']) . $this->previewFieldValue($editData[$key]['v' . $prL['ISOcode']], $fakePA['fieldConf'], $field) . '&nbsp;</div>';
                                    }
                                }
                                $languageIcon = '';
                                if ($vDEFkey != 'vDEF') {
                                    $languageIcon = $this->getLanguageIcon($table, $row, $vDEFkey);
                                }
                                // Put row together
                                // possible linebreaks in the label through xml: \n => <br/>, usage of nl2br() not possible, so it's done through str_replace
                                $processedTitle = str_replace('\\n', '<br />', $theTitle);
                                $tRows[] = '<div class="t3-form-field-container t3-form-field-container-flex">' . '<div class="t3-form-field-label t3-form-field-label-flex">' . $languageIcon . t3lib_BEfunc::wrapInHelp($PA['_cshKey'], $key, $processedTitle) . '</div>
									<div class="t3-form-field t3-form-field-flex">' . $theFormEl . $defInfo . $this->renderVDEFDiff($editData[$key], $vDEFkey) . '</div>
								</div>';
                            }
                        }
                        if (count($tRows)) {
                            $output .= implode('', $tRows);
                        }
                    }
                }
            }
        }
        return $output;
    }
コード例 #8
0
 /**
  * Returns the header column (for the extension details item), and applies help text if available
  *
  * @param	string	field key
  * @return	string	HTML ready to go
  */
 function headerCol($key)
 {
     $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_' . $key);
     return t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_' . $key, $headerCol);
 }
コード例 #9
0
ファイル: index.php プロジェクト: NaveedWebdeveloper/Test
    /**
     * Display extensions details.
     *
     * @param	string		Extension key
     * @return	void		Writes content to $this->content
     */
    function showExtDetails($extKey)
    {
        global $TYPO3_LOADED_EXT;
        list($list, ) = $this->extensionList->getInstalledExtensions();
        $absPath = tx_em_Tools::getExtPath($extKey, $list[$extKey]['type']);
        // Check updateModule:
        if (isset($list[$extKey]) && @is_file($absPath . 'class.ext_update.php')) {
            require_once $absPath . 'class.ext_update.php';
            $updateObj = new ext_update();
            if (!$updateObj->access()) {
                unset($this->MOD_MENU['singleDetails']['updateModule']);
            }
        } else {
            unset($this->MOD_MENU['singleDetails']['updateModule']);
        }
        if ($this->CMD['doDelete']) {
            $this->MOD_MENU['singleDetails'] = array();
        }
        // Function menu here:
        if (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone')) {
            $content = $GLOBALS['LANG']->getLL('ext_details_ext') . '&nbsp;<strong>' . $this->extensionTitleIconHeader($extKey, $list[$extKey]) . '</strong> (' . htmlspecialchars($extKey) . ')';
            $this->content .= $this->doc->section('', $content);
        }
        // Show extension details:
        if ($list[$extKey]) {
            // Checking if a command for install/uninstall is executed:
            if (($this->CMD['remove'] || $this->CMD['load']) && !in_array($extKey, $this->requiredExt)) {
                // Install / Uninstall extension here:
                if (t3lib_extMgm::isLocalconfWritable()) {
                    // Check dependencies:
                    $depStatus = $this->install->checkDependencies($extKey, $list[$extKey]['EM_CONF'], $list);
                    if (!$this->CMD['remove'] && !$depStatus['returnCode']) {
                        $this->content .= $depStatus['html'];
                        $newExtList = -1;
                    } elseif ($this->CMD['remove']) {
                        $newExtList = $this->extensionList->removeExtFromList($extKey, $list);
                    } else {
                        $newExtList = $this->extensionList->addExtToList($extKey, $list);
                    }
                    // Successful installation:
                    if ($newExtList != -1) {
                        $updates = '';
                        if ($this->CMD['load']) {
                            if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                                $script = t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[load]' => 1, 'CMD[clrCmd]' => $this->CMD['clrCmd'], 'SET[singleDetails]' => 'info'));
                            } else {
                                $script = '';
                            }
                            $standaloneUpdates = '';
                            if ($this->CMD['standAlone']) {
                                $standaloneUpdates .= '<input type="hidden" name="standAlone" value="1" />';
                            }
                            if ($this->CMD['silendMode']) {
                                $standaloneUpdates .= '<input type="hidden" name="silendMode" value="1" />';
                            }
                            $depsolver = t3lib_div::_POST('depsolver');
                            if (is_array($depsolver['ignore'])) {
                                foreach ($depsolver['ignore'] as $depK => $depV) {
                                    $dependencyUpdates .= '<input type="hidden" name="depsolver[ignore][' . $depK . ']" value="1" />';
                                }
                            }
                            $updatesForm = $this->install->updatesForm($extKey, $list[$extKey], 1, $script, $dependencyUpdates . $standaloneUpdates . '<input type="hidden" name="_do_install" value="1" /><input type="hidden" name="_clrCmd" value="' . $this->CMD['clrCmd'] . '" />', TRUE);
                            if ($updatesForm) {
                                $updates = $GLOBALS['LANG']->getLL('ext_details_new_tables_fields') . '<br />' . $GLOBALS['LANG']->getLL('ext_details_new_tables_fields_select') . $updatesForm;
                                $labelDBUpdate = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_db_needs_update'), 'toUpper');
                                $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $labelDBUpdate, $updates, 1, 1, 1, 1);
                            }
                        } elseif ($this->CMD['remove']) {
                            $updates .= $this->install->checkClearCache($list[$extKey]);
                            if ($updates) {
                                $updates = '
								<form action="' . $this->script . '" method="post">' . $updates . '
								<br /><input type="submit" name="write" value="' . $GLOBALS['LANG']->getLL('ext_details_remove_ext') . '" />
								<input type="hidden" name="_do_install" value="1" />
								<input type="hidden" name="_clrCmd" value="' . $this->CMD['clrCmd'] . '" />
								<input type="hidden" name="CMD[showExt]" value="' . $this->CMD['showExt'] . '" />
								<input type="hidden" name="CMD[remove]" value="' . $this->CMD['remove'] . '" />
								<input type="hidden" name="standAlone" value="' . $this->CMD['standAlone'] . '" />
								<input type="hidden" name="silentMode" value="' . $this->CMD['silentMode'] . '" />
								' . ($this->noDocHeader ? '<input type="hidden" name="nodoc" value="1" />' : '') . '
								</form>';
                                $labelDBUpdate = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_db_needs_update'), 'toUpper');
                                $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_removing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $labelDBUpdate, $updates, 1, 1, 1, 1);
                            }
                        }
                        if (!$updates || t3lib_div::_GP('_do_install') || $this->noDocHeader && $this->CMD['remove']) {
                            $this->install->writeNewExtensionList($newExtList);
                            $action = $this->CMD['load'] ? 'installed' : 'removed';
                            $GLOBALS['BE_USER']->writelog(5, 1, 0, 0, 'Extension list has been changed, extension %s has been %s', array($extKey, $action));
                            if (!t3lib_div::_GP('silentMode') && !$this->CMD['standAlone']) {
                                $messageLabel = 'ext_details_ext_' . $action . '_with_key';
                                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL($messageLabel), $extKey), '', t3lib_FlashMessage::OK, TRUE);
                                t3lib_FlashMessageQueue::addMessage($flashMessage);
                            }
                            if ($this->CMD['clrCmd'] || t3lib_div::_GP('_clrCmd')) {
                                if ($this->CMD['load'] && @is_file($absPath . 'ext_conf_template.txt')) {
                                    $vA = array('CMD' => array('showExt' => $extKey));
                                } else {
                                    $vA = array('CMD' => '');
                                }
                            } else {
                                $vA = array('CMD' => array('showExt' => $extKey));
                            }
                            if ($this->CMD['standAlone'] || t3lib_div::_GP('standAlone')) {
                                $this->content .= sprintf($GLOBALS['LANG']->getLL('ext_details_ext_installed_removed'), $this->CMD['load'] ? $GLOBALS['LANG']->getLL('ext_details_installed') : $GLOBALS['LANG']->getLL('ext_details_removed')) . '<br /><br />' . $this->getSubmitAndOpenerCloseLink();
                            } else {
                                // Determine if new modules were installed:
                                $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $list[$extKey]);
                                if (($this->CMD['load'] || $this->CMD['remove']) && is_array($techInfo['flags']) && in_array('Module', $techInfo['flags'], true)) {
                                    $vA['CMD']['refreshMenu'] = 1;
                                }
                                t3lib_utility_Http::redirect(t3lib_div::linkThisScript($vA));
                                exit;
                            }
                        }
                    }
                } else {
                    $writeAccessError = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_write_access_error'), 'toUpper');
                    $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $writeAccessError, $GLOBALS['LANG']->getLL('ext_details_write_error_localconf'), 1, 1, 2, 1);
                }
            } elseif ($this->CMD['downloadFile'] && !in_array($extKey, $this->requiredExt)) {
                // Link for downloading extension has been clicked - deliver content stream:
                $dlFile = $this->CMD['downloadFile'];
                if (t3lib_div::isAllowedAbsPath($dlFile) && t3lib_div::isFirstPartOfStr($dlFile, PATH_site) && t3lib_div::isFirstPartOfStr($dlFile, $absPath) && @is_file($dlFile)) {
                    $mimeType = 'application/octet-stream';
                    Header('Content-Type: ' . $mimeType);
                    Header('Content-Disposition: attachment; filename=' . basename($dlFile));
                    echo t3lib_div::getUrl($dlFile);
                    exit;
                } else {
                    throw new RuntimeException('TYPO3 Fatal Error: ' . $GLOBALS['LANG']->getLL('ext_details_error_downloading'), 1270853980);
                }
            } elseif ($this->CMD['editFile'] && !in_array($extKey, $this->requiredExt)) {
                // Editing extension file:
                $editFile = rawurldecode($this->CMD['editFile']);
                if (t3lib_div::isAllowedAbsPath($editFile) && t3lib_div::isFirstPartOfStr($editFile, $absPath)) {
                    $fI = t3lib_div::split_fileref($editFile);
                    if (@is_file($editFile) && t3lib_div::inList($this->editTextExtensions, $fI['fileext'] ? $fI['fileext'] : $fI['filebody'])) {
                        if (filesize($editFile) < $this->kbMax * 1024) {
                            $outCode = '<form action="' . $this->script . ' method="post" name="editfileform">';
                            $info = '';
                            $submittedContent = t3lib_div::_POST('edit');
                            $saveFlag = 0;
                            if (isset($submittedContent['file']) && !$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) {
                                // Check referer here?
                                $oldFileContent = t3lib_div::getUrl($editFile);
                                if ($oldFileContent != $submittedContent['file']) {
                                    $oldMD5 = md5(str_replace(CR, '', $oldFileContent));
                                    $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_previous'), '<strong>' . $oldMD5 . '</strong>') . '<br />';
                                    t3lib_div::writeFile($editFile, $submittedContent['file']);
                                    $saveFlag = 1;
                                } else {
                                    $info .= $GLOBALS['LANG']->getLL('ext_details_no_changes') . '<br />';
                                }
                            }
                            $fileContent = t3lib_div::getUrl($editFile);
                            $outCode .= sprintf($GLOBALS['LANG']->getLL('ext_details_file'), '<strong>' . substr($editFile, strlen($absPath)) . '</strong> (' . t3lib_div::formatSize(filesize($editFile)) . ')<br />');
                            $fileMD5 = md5(str_replace(CR, '', $fileContent));
                            $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_current'), '<strong>' . $fileMD5 . '</strong>') . '<br />';
                            if ($saveFlag) {
                                $saveMD5 = md5(str_replace(CR, '', $submittedContent['file']));
                                $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_submitted'), '<strong>' . $saveMD5 . '</strong>') . '<br />';
                                if ($fileMD5 != $saveMD5) {
                                    $info .= tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_saving_failed_changes_lost') . '</strong>') . '<br />';
                                } else {
                                    $info .= tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_file_saved') . '</strong>') . '<br />';
                                }
                            }
                            $outCode .= '<textarea name="edit[file]" rows="35" wrap="off"' . $this->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font enable-tab">' . t3lib_div::formatForTextarea($fileContent) . '</textarea>';
                            $outCode .= '<input type="hidden" name="edit[filename]" value="' . $editFile . '" />';
                            $outCode .= '<input type="hidden" name="CMD[editFile]" value="' . htmlspecialchars($editFile) . '" />';
                            $outCode .= '<input type="hidden" name="CMD[showExt]" value="' . $extKey . '" />';
                            $outCode .= $info;
                            if (!$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) {
                                $outCode .= '<br /><input type="submit" name="save_file" value="' . $GLOBALS['LANG']->getLL('ext_details_file_save_button') . '" />';
                            } else {
                                $outCode .= tx_em_Tools::rfw('<br />' . $GLOBALS['LANG']->getLL('ext_details_saving_disabled') . ' ');
                            }
                            $onClick = 'window.location.href="' . t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey)) . '";return false;';
                            $outCode .= '<input type="submit" name="cancel" value="' . $GLOBALS['LANG']->getLL('ext_details_cancel_button') . '" onclick="' . htmlspecialchars($onClick) . '" /></form>';
                            $theOutput .= $this->doc->spacer(15);
                            $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_edit_file'), '', 0, 1);
                            $theOutput .= $this->doc->sectionEnd() . $outCode;
                            $this->content .= $theOutput;
                        } else {
                            $theOutput .= $this->doc->spacer(15);
                            $theOutput .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_filesize_exceeded_kb'), $this->kbMax), sprintf($GLOBALS['LANG']->getLL('ext_details_file_too_large'), $this->kbMax));
                        }
                    }
                } else {
                    die(sprintf($GLOBALS['LANG']->getLL('ext_details_fatal_edit_error'), htmlspecialchars($editFile)));
                }
            } else {
                // MAIN:
                switch ((string) $this->MOD_SETTINGS['singleDetails']) {
                    case 'info':
                        // Loaded / Not loaded:
                        if (!in_array($extKey, $this->requiredExt)) {
                            if ($TYPO3_LOADED_EXT[$extKey]) {
                                $content = '<strong>' . $GLOBALS['LANG']->getLL('ext_details_loaded_and_running') . '</strong><br />' . '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[remove]' => 1))) . '">' . $GLOBALS['LANG']->getLL('ext_details_remove_button') . ' ' . tx_em_Tools::removeButton() . '</a>';
                            } else {
                                $content = $GLOBALS['LANG']->getLL('ext_details_not_loaded') . '<br />' . '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[load]' => 1))) . '">' . $GLOBALS['LANG']->getLL('ext_details_install_button') . ' ' . tx_em_Tools::installButton() . '</a>';
                            }
                        } else {
                            $content = $GLOBALS['LANG']->getLL('ext_details_always_loaded');
                        }
                        $this->content .= $this->doc->spacer(10);
                        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_current_status'), $content, 0, 1);
                        if (t3lib_extMgm::isLoaded($extKey)) {
                            $updates = $this->install->updatesForm($extKey, $list[$extKey]);
                            if ($updates) {
                                $this->content .= $this->doc->spacer(10);
                                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_update_needed'), $updates . '<br /><br />' . $GLOBALS['LANG']->getLL('ext_details_notice_static_data'), 0, 1);
                            }
                        }
                        // Config:
                        if (@is_file($absPath . 'ext_conf_template.txt')) {
                            $this->content .= $this->doc->spacer(10);
                            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_configuration'), $GLOBALS['LANG']->getLL('ext_details_notice_clear_cache') . '<br /><br />', 0, 1);
                            $this->content .= $this->install->tsStyleConfigForm($extKey, $list[$extKey]);
                        }
                        // Show details:
                        $headline = $GLOBALS['LANG']->getLL('ext_details_details');
                        $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'info', $headline);
                        $content = $this->extensionDetails->extInformationarray($extKey, $list[$extKey]);
                        $this->content .= $this->doc->spacer(10);
                        $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
                        break;
                    case 'upload':
                        $em = t3lib_div::_POST('em');
                        if ($em['action'] == 'doUpload') {
                            $em['extKey'] = $extKey;
                            $em['extInfo'] = $list[$extKey];
                            $content = $this->extensionDetails->uploadExtensionToTER($em);
                            $content .= $this->doc->spacer(10);
                            // Must reload this, because EM_CONF information has been updated!
                            list($list, ) = $this->extensionList->getInstalledExtensions();
                        } else {
                            // headline and CSH
                            $headline = $GLOBALS['LANG']->getLL('ext_details_upload_to_ter');
                            $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'upload', $headline);
                            // Upload:
                            if (substr($extKey, 0, 5) != 'user_') {
                                $content = $this->getRepositoryUploadForm($extKey, $list[$extKey]);
                                $eC = 0;
                            } else {
                                $content = $GLOBALS['LANG']->getLL('ext_details_no_unique_ext');
                                $eC = 2;
                            }
                            if (!$this->fe_user['username']) {
                                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('ext_details_no_username'), '<a href="' . t3lib_div::linkThisScript(array('SET[function]' => 3)) . '">', '</a>'), '', t3lib_FlashMessage::INFO);
                                $content .= '<br />' . $flashMessage->render();
                            }
                        }
                        $this->content .= $this->doc->section($headline, $content, 0, 1, $eC, TRUE);
                        break;
                    case 'backup':
                        if ($this->CMD['doDelete']) {
                            $content = $this->install->extDelete($extKey, $list[$extKey], $this->CMD);
                            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_delete'), $GLOBALS['LANG']->getLL('ext_details_delete'), $content, 0, 1);
                        } else {
                            // headline and CSH
                            $headline = $GLOBALS['LANG']->getLL('ext_details_backup');
                            $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'backup_delete', $headline);
                            $content = $this->extBackup($extKey, $list[$extKey]);
                            $this->content .= $this->doc->section($headline, $content, 0, 1, 0, 1);
                            $content = $this->install->extDelete($extKey, $list[$extKey], $this->CMD);
                            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_delete'), $content, 0, 1);
                            $content = $this->extUpdateEMCONF($extKey, $list[$extKey]);
                            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_update_em_conf'), $content, 0, 1);
                        }
                        break;
                    case 'dump':
                        $this->extDumpTables($extKey, $list[$extKey]);
                        break;
                    case 'edit':
                        // headline and CSH
                        $headline = $GLOBALS['LANG']->getLL('ext_details_ext_files');
                        $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'editfiles', $headline);
                        $content = $this->getFileListOfExtension($extKey, $list[$extKey]);
                        $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
                        break;
                    case 'updateModule':
                        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_update'), is_object($updateObj) ? $updateObj->main() : $GLOBALS['LANG']->getLL('ext_details_no_update_object'), 0, 1);
                        break;
                    default:
                        $this->extObjContent();
                        break;
                }
            }
        }
    }
コード例 #10
0
ファイル: db_layout.php プロジェクト: NaveedWebdeveloper/Test
 /**
  * Rendering all other listings than QuickEdit
  *
  * @return	void
  */
 function renderListContent()
 {
     global $LANG, $BACK_PATH, $TCA;
     // Initialize list object (see "class.db_layout.inc"):
     $dblist = t3lib_div::makeInstance('tx_cms_layout');
     $dblist->backPath = $BACK_PATH;
     $dblist->thumbs = $this->imagemode;
     $dblist->no_noWrap = 1;
     $dblist->descrTable = $this->descrTable;
     $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
     $dblist->script = 'db_layout.php';
     $dblist->showIcon = 0;
     $dblist->setLMargin = 0;
     $dblist->doEdit = $this->EDIT_CONTENT;
     $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
     $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
     $dblist->id = $this->id;
     $dblist->nextThree = t3lib_div::intInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
     $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0';
     $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
     $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
     if (!$dblist->nextThree) {
         $dblist->nextThree = 1;
     }
     $dblist->externalTables = $this->externalTables;
     // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
     $h_menu = $dblist->getTableMenu($this->id);
     // Initialize other variables:
     $h_func = '';
     $tableOutput = array();
     $tableJSOutput = array();
     $CMcounter = 0;
     // Traverse the list of table names which has records on this page (that array is populated by the $dblist object during the function getTableMenu()):
     foreach ($dblist->activeTables as $table => $value) {
         // Load full table definitions:
         t3lib_div::loadTCA($table);
         if (!isset($dblist->externalTables[$table])) {
             // Creating special conditions for each table:
             switch ($table) {
                 case 'tt_board':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_board]', $this->MOD_SETTINGS['tt_board'], $this->MOD_MENU['tt_board'], 'db_layout.php', '');
                     break;
                 case 'tt_address':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_address]', $this->MOD_SETTINGS['tt_address'], $this->MOD_MENU['tt_address'], 'db_layout.php', '');
                     break;
                 case 'tt_links':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_links]', $this->MOD_SETTINGS['tt_links'], $this->MOD_MENU['tt_links'], 'db_layout.php', '');
                     break;
                 case 'tt_calender':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_calender]', $this->MOD_SETTINGS['tt_calender'], $this->MOD_MENU['tt_calender'], 'db_layout.php', '');
                     break;
                 case 'tt_products':
                     $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[tt_products]', $this->MOD_SETTINGS['tt_products'], $this->MOD_MENU['tt_products'], 'db_layout.php', '');
                     break;
                 case 'tt_guest':
                 case 'tt_news':
                 case 'fe_users':
                     // Nothing
                     break;
                 case 'tt_content':
                     $q_count = $this->getNumberOfHiddenElements();
                     $h_func_b = t3lib_BEfunc::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE')) : $LANG->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>';
                     $dblist->tt_contentConfig['showCommands'] = 1;
                     // Boolean: Display up/down arrows and edit icons for tt_content records
                     $dblist->tt_contentConfig['showInfo'] = 1;
                     // Boolean: Display info-marks or not
                     $dblist->tt_contentConfig['single'] = 0;
                     // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
                     if ($this->MOD_SETTINGS['function'] == 4) {
                         // grid view
                         $dblist->tt_contentConfig['showAsGrid'] = 1;
                     }
                     // Setting up the tt_content columns to show:
                     if (is_array($TCA['tt_content']['columns']['colPos']['config']['items'])) {
                         $colList = array();
                         $tcaItems = t3lib_div::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $this->id, $this);
                         foreach ($tcaItems as $temp) {
                             $colList[] = $temp[1];
                         }
                     } else {
                         // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
                         $colList = array('1', '0', '2', '3');
                     }
                     if (strcmp($this->colPosList, '')) {
                         $colList = array_intersect(t3lib_div::intExplode(',', $this->colPosList), $colList);
                     }
                     // If only one column found, display the single-column view.
                     if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) {
                         $dblist->tt_contentConfig['single'] = 1;
                         // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
                         $dblist->tt_contentConfig['showSingleCol'] = current($colList);
                         // The column(s) to show if single mode (under each other)
                     }
                     $dblist->tt_contentConfig['cols'] = implode(',', $colList);
                     // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
                     $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
                     $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
                     // If the function menu is set to "Language":
                     if ($this->MOD_SETTINGS['function'] == 2) {
                         $dblist->tt_contentConfig['single'] = 0;
                         $dblist->tt_contentConfig['languageMode'] = 1;
                         $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
                         $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
                     }
                     break;
             }
         } else {
             if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
                 $h_func = t3lib_BEfunc::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', '');
             } else {
                 $h_func = '';
             }
         }
         // Start the dblist object:
         $dblist->itemsLimitSingleTable = 1000;
         $dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
         $dblist->counter = $CMcounter;
         $dblist->ext_function = $this->MOD_SETTINGS['function'];
         // Render versioning selector:
         $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
         // Generate the list of elements here:
         $dblist->generateList();
         // Adding the list content to the tableOutput variable:
         $tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
         // ... and any accumulated JavaScript goes the same way!
         $tableJSOutput[$table] = $dblist->JScode;
         // Increase global counter:
         $CMcounter += $dblist->counter;
         // Reset variables after operation:
         $dblist->HTMLcode = '';
         $dblist->JScode = '';
         $h_func = '';
         $h_func_b = '';
     }
     // END: traverse tables
     // For Context Sensitive Menus:
     $this->doc->getContextMenuCode();
     // Now, create listing based on which element is selected in the function menu:
     if ($this->MOD_SETTINGS['function'] == 3) {
         // Making page info:
         $content .= $this->doc->spacer(10);
         $content .= $this->doc->section($LANG->getLL('pageInformation'), $dblist->getPageInfoBox($this->pageinfo, $this->CALC_PERMS & 2), 0, 1);
     } else {
         // Add the content for each table we have rendered (traversing $tableOutput variable)
         foreach ($tableOutput as $table => $output) {
             $content .= $this->doc->section('<a name="' . $table . '"></a>' . $dblist->activeTables[$table], $output, TRUE, TRUE, 0, TRUE);
             $content .= $this->doc->spacer(15);
             $content .= $this->doc->sectionEnd();
         }
         // Making search form:
         if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
             $sectionTitle = t3lib_BEfunc::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE));
             $content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
         }
         // Making display of Sys-notes (from extension "sys_note")
         $dblist->id = $this->id;
         $sysNotes = $dblist->showSysNotesForPage();
         if ($sysNotes) {
             $content .= $this->doc->spacer(10);
             $content .= $this->doc->section($LANG->getLL('internalNotes'), $sysNotes, 0, 1);
         }
         // Add spacer in bottom of page:
         $content .= $this->doc->spacer(10);
     }
     // Ending page:
     $content .= $this->doc->spacer(10);
     return $content;
 }
コード例 #11
0
    /**
     * Renders translation module
     *
     * @return string or direct output
     */
    public function translationHandling()
    {
        global $LANG, $TYPO3_LOADED_EXT;
        $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
        //prepare docheader
        $docHeaderButtons = $this->parentObject->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->parentObject->getFuncMenu());
        $content = '';
        $incoming = t3lib_div::_POST('SET');
        if (isset($incoming['selectedLanguages']) && is_array($incoming['selectedLanguages'])) {
            t3lib_BEfunc::getModuleData($this->parentObject->MOD_MENU, array('selectedLanguages' => serialize($incoming['selectedLanguages'])), $this->parentObject->MCONF['name'], '', 'selectedLanguages');
            $this->parentObject->MOD_SETTINGS['selectedLanguages'] = serialize($incoming['selectedLanguages']);
        }
        $selectedLanguages = unserialize($this->parentObject->MOD_SETTINGS['selectedLanguages']);
        if (count($selectedLanguages) == 1 && empty($selectedLanguages[0])) {
            $selectedLanguages = array();
        }
        $theLanguages = t3lib_div::trimExplode('|', TYPO3_languages);
        foreach ($theLanguages as $val) {
            if ($val != 'default') {
                $localLabel = '  -  [' . htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_' . $val]) . ']';
                $selected = is_array($selectedLanguages) && in_array($val, $selectedLanguages) ? ' selected="selected"' : '';
                $opt[$GLOBALS['LANG']->getLL('lang_' . $val, 1) . '--' . $val] = '
			 <option value="' . $val . '"' . $selected . '>' . $LANG->getLL('lang_' . $val, 1) . $localLabel . '</option>';
            }
        }
        ksort($opt);
        $headline = $GLOBALS['LANG']->getLL('translation_settings');
        $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'translation', $headline);
        // Prepare the HTML output:
        $content .= '
			<form action="' . $this->parentObject->script . '" method="post" name="translationform">
			<fieldset><legend>' . $GLOBALS['LANG']->getLL('translation_settings') . '</legend>
			<table border="0" cellpadding="2" cellspacing="2">
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('languages_to_fetch') . '</td>
					<td>
					  <select name="SET[selectedLanguages][]" multiple="multiple" size="10">
					  <option>&nbsp;</option>' . implode('', $opt) . '
			</select>
		  </td>
				</tr>
			</table>
			<br />
			<p>' . $GLOBALS['LANG']->getLL('translation_info') . '<br />
			<br />' . $GLOBALS['LANG']->getLL('translation_loaded_exts') . '</p>
			</fieldset>
			<br />
			<input type="submit" value="' . $GLOBALS['LANG']->getLL('translation_save_selection') . '" />
			<br />
			</form>';
        $this->parentObject->content .= $this->parentObject->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
        if (count($selectedLanguages) > 0) {
            $mirrorURL = $this->parentObject->getMirrorURL();
            $content = '<input type="button" value="' . $GLOBALS['LANG']->getLL('translation_check_status_button') . '" onclick="document.location.href=\'' . htmlspecialchars(t3lib_div::linkThisScript(array('l10n' => 'check'))) . '\'" />&nbsp;<input type="button" value="' . $GLOBALS['LANG']->getLL('translation_update_button') . '" onclick="document.location.href=\'' . htmlspecialchars(t3lib_div::linkThisScript(array('l10n' => 'update'))) . '\'" />';
            // as this page loads dynamically, quit output buffering caused by ob_gzhandler
            t3lib_div::cleanOutputBuffers();
            if (t3lib_div::_GET('l10n') == 'check') {
                $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
                $loadedExtensions = array_diff($loadedExtensions, array('_CACHEFILE'));
                // Override content output - we now do that ourselves:
                $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
                // Setting up the buttons and markers for docheader
                $content = $this->parentObject->doc->startPage('Extension Manager');
                $content .= $this->parentObject->doc->moduleBody($this->parentObject->pageinfo, $docHeaderButtons, $markers);
                $contentParts = explode('###CONTENT###', $content);
                echo $contentParts[0] . $this->parentObject->content;
                $this->parentObject->doPrintContent = FALSE;
                flush();
                echo '
				<br />
				<br />
				<p id="progress-message">
					' . $GLOBALS['LANG']->getLL('translation_check_status') . '
				</p>
				<br />
				<div style="width:100%; height:20px; border: 1px solid black;">
					<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
					<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:' . $this->parentObject->doc->bgColor2 . ';">&nbsp;</div>
				</div>
				<br />
				<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_check') . '</p><br />
				<table border="0" cellpadding="2" cellspacing="2">
					<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
				';
                foreach ($selectedLanguages as $lang) {
                    echo '<td>' . $LANG->getLL('lang_' . $lang, 1) . '</td>';
                }
                echo '</tr>';
                $counter = 1;
                foreach ($loadedExtensions as $extKey) {
                    $percentDone = intval($counter / count($loadedExtensions) * 100);
                    echo '
					<script type="text/javascript">
						document.getElementById("progress-bar").style.width = "' . $percentDone . '%";
						document.getElementById("transparent-bar").style.width = "' . (100 - $percentDone) . '%";
						document.getElementById("progress-message").firstChild.data="' . sprintf($GLOBALS['LANG']->getLL('translation_checking_extension'), $extKey) . '";
					</script>
					';
                    flush();
                    $translationStatusArr = $this->parentObject->terConnection->fetchTranslationStatus($extKey, $mirrorURL);
                    echo '<tr class="bgColor4"><td>' . $extKey . '</td>';
                    foreach ($selectedLanguages as $lang) {
                        // remote unknown -> no l10n available
                        if (!isset($translationStatusArr[$lang])) {
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_no_translation') . '">' . $GLOBALS['LANG']->getLL('translation_n_a') . '</td>';
                            continue;
                        }
                        // determine local md5 from zip
                        if (is_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip')) {
                            $localmd5 = md5_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip');
                        } else {
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_not_installed') . '" style="background-color:#ff0">' . $GLOBALS['LANG']->getLL('translation_status_unknown') . '</td>';
                            continue;
                        }
                        // local!=remote -> needs update
                        if ($localmd5 != $translationStatusArr[$lang]['md5']) {
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_needs_update') . '" style="background-color:#ff0">' . $GLOBALS['LANG']->getLL('translation_status_update') . '</td>';
                            continue;
                        }
                        echo '<td title="' . $GLOBALS['LANG']->getLL('translation_is_ok') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_ok') . '</td>';
                    }
                    echo '</tr>';
                    $counter++;
                }
                echo '</table>
					<script type="text/javascript">
						document.getElementById("progress-message").firstChild.data="' . $GLOBALS['LANG']->getLL('translation_check_done') . '";
					</script>
				';
                echo $contentParts[1] . $this->parentObject->doc->endPage();
                exit;
            } elseif (t3lib_div::_GET('l10n') == 'update') {
                $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
                $loadedExtensions = array_diff($loadedExtensions, array('_CACHEFILE'));
                // Override content output - we now do that ourselves:
                $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
                // Setting up the buttons and markers for docheader
                $content = $this->parentObject->doc->startPage('Extension Manager');
                $content .= $this->parentObject->doc->moduleBody($this->parentObject->pageinfo, $docHeaderButtons, $markers);
                $contentParts = explode('###CONTENT###', $content);
                echo $contentParts[0] . $this->parentObject->content;
                $this->parentObject->doPrintContent = FALSE;
                flush();
                echo '
				<br />
				<br />
				<p id="progress-message">
					' . $GLOBALS['LANG']->getLL('translation_update_status') . '
				</p>
				<br />
				<div style="width:100%; height:20px; border: 1px solid black;">
					<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
					<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:' . $this->parentObject->doc->bgColor2 . ';">&nbsp;</div>
				</div>
				<br />
				<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_update') . '<br />
				<em>' . $GLOBALS['LANG']->getLL('translation_full_check_update') . '</em></p><br />
				<table border="0" cellpadding="2" cellspacing="2">
					<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
				';
                foreach ($selectedLanguages as $lang) {
                    echo '<td>' . $LANG->getLL('lang_' . $lang, 1) . '</td>';
                }
                echo '</tr>';
                $counter = 1;
                foreach ($loadedExtensions as $extKey) {
                    $percentDone = intval($counter / count($loadedExtensions) * 100);
                    echo '
					<script type="text/javascript">
						document.getElementById("progress-bar").style.width = "' . $percentDone . '%";
						document.getElementById("transparent-bar").style.width = "' . (100 - $percentDone) . '%";
						document.getElementById("progress-message").firstChild.data="' . sprintf($GLOBALS['LANG']->getLL('translation_updating_extension'), $extKey) . '";
					</script>
					';
                    flush();
                    $translationStatusArr = $this->parentObject->terConnection->fetchTranslationStatus($extKey, $mirrorURL);
                    echo '<tr class="bgColor4"><td>' . $extKey . '</td>';
                    if (is_array($translationStatusArr)) {
                        foreach ($selectedLanguages as $lang) {
                            // remote unknown -> no l10n available
                            if (!isset($translationStatusArr[$lang])) {
                                echo '<td title="' . $GLOBALS['LANG']->getLL('translation_no_translation') . '">' . $GLOBALS['LANG']->getLL('translation_n_a') . '</td>';
                                continue;
                            }
                            // determine local md5 from zip
                            if (is_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip')) {
                                $localmd5 = md5_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip');
                            } else {
                                $localmd5 = 'zzz';
                            }
                            // local!=remote or not installed -> needs update
                            if ($localmd5 != $translationStatusArr[$lang]['md5']) {
                                $ret = $this->updateTranslation($extKey, $lang, $mirrorURL);
                                if ($ret === true) {
                                    echo '<td title="' . $GLOBALS['LANG']->getLL('translation_has_been_updated') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_update') . '</td>';
                                } else {
                                    echo '<td title="' . htmlspecialchars($ret) . '" style="background-color:#cb3352">' . $GLOBALS['LANG']->getLL('translation_status_error') . '</td>';
                                }
                                continue;
                            }
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_is_ok') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_ok') . '</td>';
                        }
                    } else {
                        echo '<td colspan="' . count($selectedLanguages) . '" title="' . $GLOBALS['LANG']->getLL('translation_problems') . '">' . $GLOBALS['LANG']->getLL('translation_status_could_not_fetch') . '</td>';
                    }
                    echo '</tr>';
                    $counter++;
                }
                echo '</table>
					<script type="text/javascript">
						document.getElementById("progress-message").firstChild.data="' . $GLOBALS['LANG']->getLL('translation_update_done') . '";
					</script>
				';
                // Fix permissions on unzipped language xml files in the entire l10n folder and all subfolders
                t3lib_div::fixPermissions(PATH_typo3conf . 'l10n', TRUE);
                echo $contentParts[1] . $this->parentObject->doc->endPage();
                exit;
            }
            $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
        }
    }
コード例 #12
0
ファイル: index.php プロジェクト: NaveedWebdeveloper/Test
 /**
  * Gets the filled markers that are used in the HTML template.
  *
  * @return	array		The filled marker array
  */
 protected function getTemplateMarkers()
 {
     $markers = array('CSH' => t3lib_BEfunc::wrapInHelp('_MOD_tools_txschedulerM1', ''), 'FUNC_MENU' => $this->getFunctionMenu(), 'CONTENT' => $this->content, 'TITLE' => $GLOBALS['LANG']->getLL('title'));
     return $markers;
 }
コード例 #13
0
 /**
  * Builds the checkboxes out of the hooks array.
  *
  * @param array $brokenLinkOverView array of broken links information
  * @return string code content
  */
 protected function getCheckOptions(array $brokenLinkOverView, $prefix = '')
 {
     $markerArray = array();
     $additionalAttr = '';
     if (!empty($prefix)) {
         $additionalAttr = ' onclick="toggleActionButton(\'' . $prefix . '\');" class="' . $prefix . '" ';
     } else {
         $additionalAttr = ' onclick="toggleActionButton(\'refresh\');" class="refresh" ';
     }
     $checkOptionsTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###');
     $hookSectionContent = '';
     $hookSectionTemplate = t3lib_parsehtml::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
     $markerArray['statistics_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('report.statistics.header'));
     $totalCountLabel = $GLOBALS['LANG']->getLL('overviews.nbtotal');
     $totalCountLabel = t3lib_BEfunc::wrapInHelp('linkvalidator', 'checkboxes', $totalCountLabel);
     $markerArray['total_count_label'] = $totalCountLabel;
     if (empty($brokenLinkOverView['brokenlinkCount'])) {
         $markerArray['total_count'] = '0';
     } else {
         $markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'];
     }
     $linktypes = t3lib_div::trimExplode(',', $this->modTS['linktypes'], 1);
     $hookSectionContent = '';
     if (is_array($linktypes)) {
         if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
                 if (in_array($type, $linktypes)) {
                     $hookSectionMarker = array();
                     if (empty($brokenLinkOverView[$type])) {
                         $hookSectionMarker['count'] = '0';
                     } else {
                         $hookSectionMarker['count'] = $brokenLinkOverView[$type];
                     }
                     $translation = $GLOBALS['LANG']->getLL('hooks.' . $type);
                     $translation = $translation ? $translation : $type;
                     $option = '<input type="checkbox" ' . $additionalAttr . '  id="' . $prefix . 'SET_' . $type . '" name="' . $prefix . 'SET[' . $type . ']" value="1"' . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '') . '/>' . '<label for="' . $prefix . 'SET[' . $type . ']">' . htmlspecialchars($translation) . '</label>';
                     $hookSectionMarker['option'] = $option;
                     $hookSectionContent .= t3lib_parsehtml::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
                 }
             }
         }
     }
     $checkOptionsTemplate = t3lib_parsehtml::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent);
     return t3lib_parsehtml::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
 }