/**
	 * Main function, returning the HTML content of the module
	 *
	 * @return	string		HTML
	 */
	function main()	{

		require_once(t3lib_extMgm::extPath(STATIC_INFO_TABLES_EXTkey).'class.tx_staticinfotables_encoding.php');

		$tableArray = array ('static_countries', 'static_country_zones', 'static_languages', 'static_currencies');

		$content = '';
		$content.= '<br />Convert character encoding of the static info tables.';
		$content.= '<br />The default encoding is UTF-8.';
		$destEncoding = htmlspecialchars(t3lib_div::_GP('dest_encoding'));

		if(t3lib_div::_GP('convert') AND ($destEncoding != '')) {
			foreach ($tableArray as $table) {
				$content .= '<p>'.htmlspecialchars($table.' > '.$destEncoding).'</p>';
				tx_staticinfotables_encoding::convertEncodingTable($table, 'utf-8', $destEncoding);
			}
			$content .= '<p>You must enter the charset \''.$destEncoding.'\' now manually in the EM for static_info_tables!</p>';
			$content .= '<p>Done</p>';
		} else {
			$content .= '<form name="static_info_tables_form" action="'.htmlspecialchars(t3lib_div::linkThisScript()).'" method="post">';
			$linkScript = t3lib_div::slashJS(t3lib_div::linkThisScript());
			$content .= '<br /><br />';
			$content .= 'This conversion works only once. When you converted the tables and you want to do it again to another encoding you have to reinstall the tables with the Extension Manager or select \'UPDATE!\'.';
			$content .= '<br /><br />';
			$content .= 'Destination character encoding:';
			$content .= '<br />'.tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', '', $TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset']);
			$content .= '<br /><br />';
			$content .= '<input type="submit" name="convert" value="Convert"  onclick="this.form.action=\''.$linkScript.'\';submit();" />';
			$content .= '</form>';
		}

		return $content;

	}
Exemplo n.º 2
0
    /**
     * Main function, returning the HTML content of the module
     *
     * @return	string		HTML
     */
    function main()
    {
        $content = '';
        $content .= '<p>Following functions modify the database which might be needed due to changed default behaviour of content elements.</p>';
        $updateAction = t3lib_div::_GP('updateAction');
        if ($updateAction === 'do_imagecaption_position_hidden') {
            $updateContent = $this->perform_update_tt_content_imagecaption_position('hidden');
        }
        if ($updateAction === 'do_imagecaption_position_default') {
            $updateContent = $this->perform_update_tt_content_imagecaption_position('default');
        }
        if ($updateContent) {
            $content .= '<div class="bgColor5" style="margin:2em 0 1em 0; padding: 0.5em; border:1px solid #aaa">' . $updateContent . '</div>';
        }
        //
        // captions
        //
        $onClickHidden = "document.location.href='" . t3lib_div::linkThisScript(array('updateAction' => 'do_imagecaption_position_hidden')) . "'; return false;";
        $onClickVisible = "document.location.href='" . t3lib_div::linkThisScript(array('updateAction' => 'do_imagecaption_position_default')) . "'; return false;";
        $content .= '<br /><h3>Image caption display</h3>
				<p>When css_styled_content is used for rendering, this extension can change the rendering so captions can be fetched from DAM for the content elements Image and Text w/image (see extension options).</p>
				<p>Captions might be visible now (coming from DAM) where no captions were needed. With the following functions...</p>
				<ul>
				  <li>all unused captions can be set hidden</li>
				  <li>all hidden captions can be set visible again</li>
				</ul>

			<input onclick="' . htmlspecialchars($onClickHidden) . '" type="submit" value="Set unused captions hidden"> ' . '<input onclick="' . htmlspecialchars($onClickVisible) . '" type="submit" value="unhide captions"></form>
		';
        return $content;
    }
 /**
  * Main function
  *
  * @param   [type]    $$backRef: ...
  * @param   [type]    $menuItems: ...
  * @param   [type]    $table: ...
  * @param   [type]    $uid: ...
  * @return  [type]    ...
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     global $BE_USER, $TCA, $LANG;
     $localItems = array();
     if (!$backRef->cmLevel) {
         // Returns directly, because the clicked item was not from the pages table
         if ($table == "tx_l10nmgr_cfg") {
             // Adds the regular item:
             $LL = $this->includeLL();
             // Repeat this (below) for as many items you want to add!
             // Remember to add entries in the localconf.php file for additional titles.
             $url = t3lib_extMgm::extRelPath("l10nmgr") . "cm1/index.php?id=" . $uid;
             $localItems[] = $backRef->linkItem($GLOBALS["LANG"]->getLLL("cm1_title", $LL), $backRef->excludeIcon('<img src="' . t3lib_extMgm::extRelPath("l10nmgr") . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" />'), $backRef->urlRefForCM($url), 1);
         }
         $localItems["moreoptions_tx_l10nmgr_cm3"] = $backRef->linkItem('L10Nmgr tools', '', "top.loadTopMenu('" . t3lib_div::linkThisScript() . "&cmLevel=1&subname=moreoptions_tx_l10nmgrXX_cm3');return false;", 0, 1);
         // Simply merges the two arrays together and returns ...
         $menuItems = array_merge($menuItems, $localItems);
     } elseif (t3lib_div::_GET('subname') == 'moreoptions_tx_l10nmgrXX_cm3') {
         $url = t3lib_extMgm::extRelPath("l10nmgr") . "cm3/index.php?id=" . $uid . '&table=' . $table;
         $localItems[] = $backRef->linkItem('Create priority', '', $backRef->urlRefForCM($url . '&cmd=createPriority'), 1);
         $localItems[] = $backRef->linkItem('Manage priorities', '', $backRef->urlRefForCM($url . '&cmd=managePriorities'), 1);
         $localItems[] = $backRef->linkItem('Update Index', '', $backRef->urlRefForCM($url . '&cmd=updateIndex'), 1);
         $localItems[] = $backRef->linkItem('Flush Translations', '', $backRef->urlRefForCM($url . '&cmd=flushTranslations'), 1);
         $menuItems = array_merge($menuItems, $localItems);
     }
     return $menuItems;
 }
 /**
  * Main function, returning the HTML content of the module
  *
  * @return	string		HTML
  */
 function main()
 {
     $content = '';
     $content .= '<br />Update the Static Info Tables with new language labels.';
     $content .= '<br />';
     if (t3lib_div::_GP('import')) {
         $destEncoding = t3lib_div::_GP('dest_encoding');
         $extPath = t3lib_extMgm::extPath('static_info_tables_it');
         $fileContent = explode("\n", t3lib_div::getUrl($extPath . 'ext_tables_static_update.sql'));
         foreach ($fileContent as $line) {
             if ($line = trim($line) and preg_match('#^UPDATE#i', $line)) {
                 $query = $this->getUpdateEncoded($line, $destEncoding);
                 $res = $GLOBALS['TYPO3_DB']->admin_query($query);
             }
         }
         $content .= '<br />';
         $content .= '<p>Encoding: ' . htmlspecialchars($destEncoding) . '</p>';
         $content .= '<p>Done.</p>';
     } elseif (t3lib_extMgm::isLoaded('static_info_tables_it')) {
         $content .= '</form>';
         $content .= '<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">';
         $content .= '<br />Destination character encoding:';
         $content .= '<br />' . tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', 'utf-8');
         $content .= '<br />(The character encoding must match the encoding of the existing tables data. By default this is UTF-8.)';
         $content .= '<br /><br />';
         $content .= '<input type="submit" name="import" value="Import" />';
         $content .= '</form>';
     } else {
         $content .= '<br /><strong>The extension needs to be installed first!</strong>';
     }
     return $content;
 }
Exemplo n.º 5
0
    /**
     * Main function, returning the HTML content of the module
     *
     * @return	string		HTML
     */
    function main()
    {
        if (!t3lib_div::_GP('do_update')) {
            $onClick = "document.location.href='" . t3lib_div::linkThisScript(array('do_update' => 1)) . "'; return false;";
            return 'Do you want to perform the database update now?

				<form action=""><input type="submit" value="DO IT" onclick="' . htmlspecialchars($onClick) . '"></form>
			';
        } else {
            return $this->perform_update();
        }
    }
 /**
  * Main function, returning the HTML content of the update module
  *
  * @return	string		HTML
  */
 function main()
 {
     $fieldsets = array();
     $fieldsets['Character encoding'] = $this->getDestEncodingSelect();
     $fieldsets['Update Static Info Tables'] = $this->handleUpdateStaticInfoTables();
     $content = '';
     $content .= '<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">';
     foreach ($fieldsets as $legend => $fieldset) {
         $content .= '<fieldset>';
         if ($legend && !is_numeric($legend)) {
             $content .= '<legend><strong>&nbsp;' . $legend . '&nbsp;</strong></legend>';
         }
         $content .= $fieldset;
         $content .= '</fieldset>';
         $content .= '<p><br /></p>';
     }
     $content .= '<p><input type="submit" /></p>';
     $content .= '</form>';
     return $content;
 }
    /**
     * Get the form for extension configuration
     *
     * @param  string  $cat
     * @param  array $theConstants
     * @param  string  $script
     * @param  string $addFields
     * @param  string $extKey
     * @param  bool  Adds opening <form> tag to the ouput, if TRUE
     * @return  string the form
     */
    function ext_getForm($cat, $theConstants, $script = "", $addFields = "", $extKey = "", $addFormTag = TRUE)
    {
        $this->ext_makeHelpInformationForCategory($cat);
        $printFields = trim($this->ext_printFields($theConstants, $cat));
        $content = '';
        $content .= t3lib_div::wrapJS('
			function uFormUrl(aname) {
				document.' . $this->ext_CEformName . '.action = "' . t3lib_div::linkThisScript() . '#"+aname;
			}
		');
        if ($addFormTag) {
            $content .= '<form action="' . htmlspecialchars($script ? $script : t3lib_div::linkThisScript()) . '" name="' . $this->ext_CEformName . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        }
        $content .= $addFields;
        $content .= $printFields;
        $content .= '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsfe.xml:update', TRUE) . '" id="configuration-submit-' . htmlspecialchars($extKey) . '" />';
        $example = $this->ext_displayExample();
        $content .= $example ? '<hr/>' . $example : "";
        return $content;
    }
Exemplo n.º 8
0
    /**
     * Main function of the MODULE. Write the content to $this->content
     * There are three main modes:
     * - Based on a file reference, creating/modifying a DS/TO
     * - Based on a Template Object uid, remapping
     * - Based on a Data Structure uid, selecting a Template Object to map.
     *
     * @return	void
     */
    function main_mode()
    {
        global $LANG, $BACK_PATH;
        // Draw the header.
        $this->doc = t3lib_div::makeInstance('noDoc');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->docType = 'xhtml_trans';
        $this->doc->inDocStylesArray[] = '
			DIV.typo3-noDoc { width: 98%; margin: 0 0 0 0; }
			DIV.typo3-noDoc H2 { width: 100%; }
			TABLE#c-mapInfo {margin-top: 10px; margin-bottom: 5px; }
			TABLE#c-mapInfo TR TD {padding-right: 20px;}
		';
        // General GPvars for module mode:
        $this->displayFile = t3lib_div::GPvar('file');
        $this->displayTable = t3lib_div::GPvar('table');
        $this->displayUid = t3lib_div::GPvar('uid');
        $this->displayPath = t3lib_div::GPvar('htmlPath');
        $this->returnUrl = t3lib_div::GPvar('returnUrl');
        // GPvars specific to the DS listing/table and mapping features:
        $this->_preview = t3lib_div::GPvar('_preview');
        $this->mapElPath = t3lib_div::GPvar('mapElPath');
        $this->doMappingOfPath = t3lib_div::GPvar('doMappingOfPath');
        $this->showPathOnly = t3lib_div::GPvar('showPathOnly');
        $this->mappingToTags = t3lib_div::GPvar('mappingToTags');
        $this->DS_element = t3lib_div::GPvar('DS_element');
        $this->DS_cmd = t3lib_div::GPvar('DS_cmd');
        $this->fieldName = t3lib_div::GPvar('fieldName');
        // GPvars specific for DS creation from a file.
        $this->_load_ds_xml_content = t3lib_div::GPvar('_load_ds_xml_content');
        $this->_load_ds_xml_to = t3lib_div::GPvar('_load_ds_xml_to');
        $this->_saveDSandTO_TOuid = t3lib_div::GPvar('_saveDSandTO_TOuid');
        $this->_saveDSandTO_title = t3lib_div::GPvar('_saveDSandTO_title');
        $this->_saveDSandTO_type = t3lib_div::GPvar('_saveDSandTO_type');
        $this->_saveDSandTO_pid = t3lib_div::GPvar('_saveDSandTO_pid');
        $this->DS_element_DELETE = t3lib_div::GPvar('DS_element_DELETE');
        // Finding Storage folder:
        $this->findingStorageFolderIds();
        // Setting up form-wrapper:
        $this->doc->form = '<form action="' . $this->linkThisScript(array()) . '" method="post" name="pageform">';
        // JavaScript
        $this->doc->JScode .= $this->doc->wrapScriptTags('
			script_ended = 0;
			function jumpToUrl(URL)	{	//
				document.location = URL;
			}
			function updPath(inPath)	{	//
				document.location = "' . t3lib_div::linkThisScript(array('htmlPath' => '', 'doMappingOfPath' => 1)) . '&htmlPath="+top.rawurlencode(inPath);
			}
		') . $this->doc->getDynTabMenuJScode();
        // Setting up the context sensitive menu:
        $CMparts = $this->doc->getContextMenuCode();
        $this->doc->bodyTagAdditions = $CMparts[1];
        $this->doc->JScode .= $CMparts[0];
        $this->doc->postCode .= $CMparts[2];
        $this->content .= $this->doc->startPage($LANG->getLL('title'));
        $this->content .= $this->doc->header($LANG->getLL('title'));
        $this->content .= $this->doc->spacer(5);
        if ($this->returnUrl) {
            $this->content .= '<a href="' . htmlspecialchars($this->returnUrl) . '" class="typo3-goBack">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/goback.gif', 'width="14" height="14"') . ' alt="" />' . $LANG->sL('LLL:EXT:lang/locallang_misc.xml:goBack', 1) . '</a><br/>';
        }
        // Render content, depending on input values:
        if ($this->displayFile) {
            // Browsing file directly, possibly creating a template/data object records.
            $this->renderFile();
        } elseif ($this->displayTable == 'tx_templavoila_datastructure') {
            // Data source display
            $this->renderDSO();
        } elseif ($this->displayTable == 'tx_templavoila_tmplobj') {
            // Data source display
            $this->renderTO();
        }
        // Add spacer:
        $this->content .= $this->doc->spacer(10);
    }
 /**
  * Returns a form tag with the current configured params
  *
  * @param 	string $name Name of the form tag
  * @return	string HTML form tag
  */
 function getFormTag($name = 'editform')
 {
     global $TYPO3_CONF_VARS;
     $addParams = $this->addParams ? $this->addParams : array();
     $formAction = t3lib_div::linkThisScript($addParams);
     return '<form action="' . htmlspecialchars($formAction) . '" method="post" name="' . $name . '" id="' . $name . '" autocomplete="off" enctype="' . $TYPO3_CONF_VARS['SYS']['form_enctype'] . '">';
 }
Exemplo n.º 10
0
    /**
     * Creates a table of properties:
     *
     * @param	array		Array with properties for the current object path
     * @param	string		Object path
     * @param	array		Object tree
     * @return	string		HTML content.
     */
    function printTable($table, $objString, $objTree)
    {
        if (is_array($table['rows'])) {
            // Initialize:
            $lines = array();
            // Adding header:
            $lines[] = '
				<tr class="t3-row-header">
					<td>Property:</td>
					<td>Data type:</td>
					<td>Description:</td>
					<td>Default:</td>
				</tr>';
            // Traverse the content of "rows":
            foreach ($table['rows'] as $i => $row) {
                // Linking:
                $lP = t3lib_div::trimExplode(LF, $row['property'], 1);
                $lP2 = array();
                foreach ($lP as $k => $lStr) {
                    $lP2[$k] = $this->linkProperty($lStr, $lStr, $objString, $row['datatype']);
                }
                $linkedProperties = implode('<hr />', $lP2);
                // Data type:
                $dataType = $row['datatype'];
                // Generally "->[something]"
                $reg = array();
                preg_match('/->[[:alnum:]_]*/', $dataType, $reg);
                if ($reg[0] && is_array($objTree[$reg[0]])) {
                    $dataType = str_replace($reg[0], '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('show' => $objTree[$reg[0]][0]['uid'], 'objString' => $objString . '.' . $lP[0]))) . '">' . htmlspecialchars($reg[0]) . '</a>', $dataType);
                }
                // stdWrap
                if (!strstr($dataType, '->stdWrap') && strstr(strip_tags($dataType), 'stdWrap')) {
                    // Potential problem can be that "stdWrap" is substituted inside another A-tag. So maybe we should even check if there is already a <A>-tag present and if so, not make a substitution?
                    $dataType = str_replace('stdWrap', '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('show' => $objTree['->stdWrap'][0]['uid'], 'objString' => $objString . '.' . $lP[0]))) . '">stdWrap</a>', $dataType);
                }
                $lines[] = '
					<tr class="t3-row ' . ($i % 2 ? 't3-row-even' : 't3-row-odd') . '">
						<td valign="top" class="bgColor4-20" nowrap="nowrap"><strong>' . $linkedProperties . '</strong></td>
						<td valign="top">' . nl2br($dataType . '&nbsp;') . '</td>
						<td valign="top">' . nl2br($row['description']) . '</td>
						<td valign="top">' . nl2br($row['default']) . '</td>
					</tr>';
            }
            // Return it all:
            return '



			<!--
				TSconfig, attribute selector:
			-->
				<table border="0" cellpadding="0" cellspacing="1" width="98%" class="t3-table" id="typo3-attributes">
					' . implode('', $lines) . '
				</table>';
        }
    }
 /**
  * Adds a button to edit the row in RTE wizard
  *
  * @param	array		The row of tt_content element
  * @return	string		Button to click if you want to edit in RTE wizard.
  */
 function linkRTEbutton($row)
 {
     $params = array();
     $params['table'] = 'tt_content';
     $params['uid'] = $row['uid'];
     $params['pid'] = $row['pid'];
     $params['field'] = 'bodytext';
     $params['returnUrl'] = t3lib_div::linkThisScript();
     $RTEonClick = "window.location.href='" . $this->backPath . "wizard_rte.php?" . t3lib_div::implodeArrayForUrl('', array('P' => $params)) . "';return false;";
     $addButton = $this->option_showBigButtons && $this->doEdit ? $GLOBALS['SOBE']->doc->t3Button($RTEonClick, $GLOBALS['LANG']->getLL('editInRTE')) : '';
     return $addButton;
 }
    /**
     * [Describe function...]
     *
     * @param	[type]		$row: ...
     * @param	[type]		$conf: ...
     * @param	[type]		$table: ...
     * @return	[type]		...
     */
    function resultRowDisplay($row, $conf, $table)
    {
        static $even = FALSE;
        $tce = t3lib_div::makeInstance('t3lib_TCEmain');
        $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
        $out = '<tr class="bgColor' . ($even ? '6' : '4') . '">';
        $even = !$even;
        foreach ($row as $fN => $fV) {
            if (t3lib_div::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') {
                if ($SET['search_result_labels']) {
                    $fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />');
                } else {
                    $fVnew = htmlspecialchars($fV);
                }
                $out .= '<td>' . $fVnew . '</td>';
            }
        }
        $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
        $out .= '<td nowrap>';
        if (!$row['deleted']) {
            $out .= '<a href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ',\'' . $GLOBALS['BACK_PATH'] . '\');return false;">' . t3lib_iconWorks::getSpriteIcon('status-dialog-information') . '</a>';
            $out .= '<a href="#" onClick="' . t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], t3lib_div::getIndpEnv('REQUEST_URI') . t3lib_div::implodeArrayForUrl('SET', (array) t3lib_div::_POST('SET'))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
        } else {
            $out .= '<a href="' . t3lib_div::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => t3lib_div::linkThisScript(array()))) . t3lib_BEfunc::getUrlToken('tceAction') . '">';
            $out .= t3lib_iconWorks::getSpriteIcon('actions-edit-restore', array('title' => 'undelete only')) . '</a>';
            $out .= '<a href="' . t3lib_div::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => t3lib_div::linkThisUrl('alt_doc.php', array('edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 'returnUrl' => t3lib_div::linkThisScript(array()))))) . t3lib_BEfunc::getUrlToken('tceAction') . '">';
            $out .= t3lib_iconWorks::getSpriteIcon('actions-edit-restore-edit', array('title' => 'undelete and edit')) . '</a>';
        }
        $_params = array($table => $row);
        if (is_array($this->hookArray['additionalButtons'])) {
            foreach ($this->hookArray['additionalButtons'] as $_funcRef) {
                $out .= t3lib_div::callUserFunction($_funcRef, $_params, $this);
            }
        }
        $out .= '</td>
		</tr>
		';
        return $out;
    }
 /**
  * Initializes the script path
  *
  * @return	void
  */
 function localFolderTree()
 {
     $this->thisScript = t3lib_div::linkThisScript();
     $this->t3lib_folderTree();
 }
Exemplo n.º 14
0
    /**
     * Creates the version selector for the page id inputted.
     * Requires the core version management extension, "version" to be loaded.
     *
     * @param	integer		Page id to create selector for.
     * @param	boolean		If set, there will be no button for swapping page.
     * @return	void
     */
    function getVersionSelector($id, $noAction = FALSE)
    {
        if ($id > 0) {
            if (t3lib_extMgm::isLoaded('version') && $GLOBALS['BE_USER']->workspace == 0) {
                // Get Current page record:
                $curPage = t3lib_BEfunc::getRecord('pages', $id);
                // If the selected page is not online, find the right ID
                $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id;
                // Select all versions of online version:
                $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id');
                // If more than one was found...:
                if (count($versions) > 1) {
                    $selectorLabel = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.label', TRUE) . '</strong>';
                    // Create selector box entries:
                    $opt = array();
                    foreach ($versions as $vRow) {
                        if ($vRow['uid'] == $onlineId) {
                            //Live version
                            $label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.live', TRUE) . ']';
                        } else {
                            $label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionId', TRUE) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')';
                        }
                        $opt[] = '<option value="' . htmlspecialchars(t3lib_div::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>';
                    }
                    // Add management link:
                    $management = '<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.mgm', TRUE) . '" onclick="window.location.href=\'' . htmlspecialchars($this->backPath . t3lib_extMgm::extRelPath('version') . 'cm1/index.php?table=pages&uid=' . $onlineId) . '\';" />';
                    // Create onchange handler:
                    $onChange = "window.location.href=this.options[this.selectedIndex].value;";
                    // Controls:
                    if ($id == $onlineId) {
                        $controls .= '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="absmiddle" alt="" /> <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online', TRUE) . '</strong>';
                    } elseif (!$noAction) {
                        $controls .= '<a href="' . $this->issueCommand('&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap', t3lib_div::linkThisScript(array('id' => $onlineId))) . '" class="nobr">' . t3lib_iconWorks::getSpriteIcon('actions-version-swap-version', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swapPage', TRUE), 'style' => 'margin-left:5px;vertical-align:bottom;')) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap', TRUE) . '</strong></a>';
                    }
                    // Write out HTML code:
                    return '

						<!--
							Version selector:
						-->
						<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
							<tr>
								<td>' . $selectorLabel . '</td>
								<td>
									<select onchange="' . htmlspecialchars($onChange) . '">
										' . implode('', $opt) . '
									</select></td>
								<td>' . $controls . '</td>
								<td>' . $management . '</td>
							</tr>
						</table>
					';
                }
            } elseif ($GLOBALS['BE_USER']->workspace !== 0) {
                // Write out HTML code:
                switch ($GLOBALS['BE_USER']->workspace) {
                    case 0:
                        $wsTitle = $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:live', TRUE);
                        break;
                    case -1:
                        $wsTitle = $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:draft', TRUE);
                        break;
                    default:
                        $wsTitle = $GLOBALS['BE_USER']->workspaceRec['title'];
                        break;
                }
                if (t3lib_BEfunc::isPidInVersionizedBranch($id) == 'branchpoint') {
                    return '

						<!--
							Version selector:
						-->
						<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
							<tr>
								<td>' . $selectorLabel . '</td>
								<td>Workspace: "' . htmlspecialchars($wsTitle) . '"</td>
								<td><em>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.inBranch', TRUE) . '</em></td>
							</tr>
						</table>
					';
                } else {
                    // Get Current page record:
                    $curPage = t3lib_BEfunc::getRecord('pages', $id);
                    // If the selected page is not online, find the right ID
                    $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id;
                    // The version of page:
                    $verPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'pages', $onlineId);
                    if (!$verPage) {
                        if (!count(t3lib_BEfunc::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $onlineId))) {
                            if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) {
                                $onClick = $this->issueCommand('&cmd[pages][' . $onlineId . '][version][action]=new&cmd[pages][' . $onlineId . '][version][treeLevels]=0', t3lib_div::linkThisScript(array('id' => $onlineId)));
                                $onClick = 'window.location.href=\'' . $onClick . '\'; return false;';
                                // Write out HTML code:
                                return '

									<!--
										No version yet, create one?
									-->
									<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
										<tr>
											<td>' . $selectorLabel . '</td>
											<td>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:workspace', TRUE) . ': "' . htmlspecialchars($wsTitle) . '"</td>
											<td>
												<input type="button" value="New version of page" name="_" onclick="' . htmlspecialchars($onClick) . '" /></td>
										</tr>
									</table>
								';
                            }
                        } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['elementVersioningOnly'] == FALSE && $GLOBALS['TYPO3_CONF_VARS']['BE']['newPagesVersioningType'] == 0) {
                            // only add this info if old/deprecated newPagesVersioning is allowed
                            return '

								<!--
									Version selector:
								-->
								<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
									<tr>
										<td>' . $selectorLabel . '</td>
										<td>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:workspace', TRUE) . ': "' . htmlspecialchars($wsTitle) . '"</td>
										<td><em>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.versionsFound', TRUE) . '</em></td>
									</tr>
								</table>
							';
                        }
                    } elseif ($verPage['t3ver_swapmode'] == 0) {
                        $onClick = $this->issueCommand('&cmd[pages][' . $onlineId . '][version][action]=swap&cmd[pages][' . $onlineId . '][version][swapWith]=' . $verPage['uid'], t3lib_div::linkThisScript(array('id' => $onlineId)));
                        $onClick = 'window.location.href=\'' . $onClick . '\'; return false;';
                        // Write out HTML code:
                        return '

							<!--
								Version selector:
							-->
							<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
								<tr>
									<td>' . $selectorLabel . '</td>
									<td>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:workspace', TRUE) . ': "' . htmlspecialchars($wsTitle) . '"</td>
									<td>
										<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.publish', TRUE) . '" onclick="' . htmlspecialchars($onClick) . '" /></td>
								</tr>
							</table>
						';
                    }
                }
            }
        }
    }
 /**
  * Set some variables with the current parameters
  *
  * @return void
  */
 function reinitParams()
 {
     global $TYPO3_CONF_VARS;
     // needed for browsetrees and just to be save
     $this->addParams = array();
     $GLOBALS['SOBE']->browser->act = $GLOBALS['SOBE']->act = $this->addParams['act'] = $this->act;
     $GLOBALS['SOBE']->browser->mode = $GLOBALS['SOBE']->mode = $this->addParams['mode'] = $this->mode;
     $GLOBALS['SOBE']->browser->bparams = $GLOBALS['SOBE']->bparams = $this->addParams['bparams'] = $this->bparams;
     $GLOBALS['SOBE']->browser->expandFolder = $GLOBALS['SOBE']->expandFolder = $this->addParams['expandFolder'] = $this->expandFolder;
     $this->formTag = '<form action="' . htmlspecialchars(t3lib_div::linkThisScript($this->addParams)) . '" method="post" name="editform" enctype="' . $TYPO3_CONF_VARS['SYS']['form_enctype'] . '">';
 }
Exemplo n.º 16
0
    /**
     * Compares the users with the given flags
     *
     * @param	array		options that should be taking into account to compare the users
     * @return	string		the content
     */
    function compareUsers($compareFlags)
    {
        // Menu:
        $options = array('filemounts' => $GLOBALS['LANG']->getLL('filemounts', true), 'webmounts' => $GLOBALS['LANG']->getLL('webmounts', true), 'tempPath' => $GLOBALS['LANG']->getLL('defaultUploadPath', true), 'firstMainGroup' => $GLOBALS['LANG']->getLL('mainUserGroup', true), 'groupList' => $GLOBALS['LANG']->getLL('memberOfGroups', true), 'pagetypes_select' => $GLOBALS['LANG']->getLL('pageTypesAccess', true), 'tables_select' => $GLOBALS['LANG']->getLL('selectTables', true), 'tables_modify' => $GLOBALS['LANG']->getLL('modifyTables', true), 'non_exclude_fields' => $GLOBALS['LANG']->getLL('nonExcludeFields', true), 'explicit_allowdeny' => $GLOBALS['LANG']->getLL('explicitAllowDeny', true), 'allowed_languages' => $GLOBALS['LANG']->getLL('limitToLanguages', true), 'workspace_perms' => $GLOBALS['LANG']->getLL('workspacePermissions', true), 'workspace_membership' => $GLOBALS['LANG']->getLL('workspaceMembership', true), 'custom_options' => $GLOBALS['LANG']->getLL('customOptions', true), 'modules' => $GLOBALS['LANG']->getLL('modules', true), 'userTS' => $GLOBALS['LANG']->getLL('tsconfig', true), 'userTS_hl' => $GLOBALS['LANG']->getLL('tsconfigHL', true));
        $be_user_uid = t3lib_div::_GP('be_user_uid');
        if ($be_user_uid) {
            // This is used to test with other users. Development ONLY!
            $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
            // New backend user object
            $tempBE_USER->userTS_dontGetCached = 1;
            $tempBE_USER->OS = TYPO3_OS;
            $tempBE_USER->setBeUserByUid($be_user_uid);
            $tempBE_USER->fetchGroupData();
            $uInfo = $tempBE_USER->ext_compileUserInfoForHash();
            $uInfo_dat = $tempBE_USER->ext_printOverview($uInfo, $options, 1);
            $lines = array();
            foreach ($options as $kk => $vv) {
                if ($kk == 'modules') {
                    $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
                    $loadModules->load($GLOBALS['TBE_MODULES'], $tempBE_USER);
                    $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
                    $uInfo_dat[$kk] = $alt_menuObj->topMenu($loadModules->modules, 1, $GLOBALS['BACK_PATH']);
                }
                $lines[] = '<tr class="bgColor4">
					<td nowrap="nowrap" valign="top">' . $vv . ':&nbsp;&nbsp;</td>
					<td>' . $uInfo_dat[$kk] . '&nbsp;</td>
				</tr>';
                if ($kk == 'webmounts' && !$tempBE_USER->isAdmin()) {
                    $lines[] = '<tr class="bgColor4">
						<td nowrap="nowrap" valign="top">' . $GLOBALS['LANG']->getLL('nonMountedReadablePages', true) . '&nbsp;&nbsp;</td>
						<td>' . $tempBE_USER->ext_getReadableButNonmounted() . '&nbsp;</td>
					</tr>';
                }
            }
            $email = htmlspecialchars($tempBE_USER->user['email']);
            $realname = htmlspecialchars($tempBE_USER->user['realName']);
            $outTable = '<table border="0" cellpadding="1" cellspacing="1"><tr class="bgColor5"><td>' . t3lib_iconWorks::getSpriteIconForRecord('be_users', $tempBE_USER->user, array('title' => $tempBE_USER->user['uid'])) . htmlspecialchars($tempBE_USER->user['username']) . '</td>';
            $outTable .= '<td>' . ($realname ? $realname . ', ' : '') . ($email ? '<a href="mailto:' . $email . '">' . $email . '</a>' : '') . '</td>';
            $outTable .= '<td>' . $this->elementLinks('be_users', $tempBE_USER->user) . '</td></tr></table>';
            $outTable .= '<strong><a href="' . htmlspecialchars($this->MCONF['_']) . '">' . $GLOBALS['LANG']->getLL('backToOverview', true) . '</a></strong><br />';
            $outTable .= '<br /><table border="0" cellpadding="2" cellspacing="1">' . implode('', $lines) . '</table>';
            $content .= $this->doc->section($GLOBALS['LANG']->getLL('userInfo', true), $outTable, 0, 1);
        } else {
            $menu = array(0 => array());
            $rowCounter = 0;
            $columnCounter = 0;
            $itemsPerColumn = ceil(count($options) / 3);
            foreach ($options as $kk => $vv) {
                if ($rowCounter == $itemsPerColumn) {
                    $rowCounter = 0;
                    $columnCounter++;
                    $menu[$columnCounter] = array();
                }
                $rowCounter++;
                $menu[$columnCounter][] = '<input type="checkbox" class="checkbox" value="1" name="compareFlags[' . $kk . ']" id="checkCompare_' . $kk . '"' . ($compareFlags[$kk] ? ' checked="checked"' : '') . '> <label for="checkCompare_' . $kk . '">' . htmlspecialchars($vv) . '</label>';
            }
            $outCode = '<p>' . $GLOBALS['LANG']->getLL('groupBy', true) . '</p>';
            $outCode .= '<table border="0" cellpadding="3" cellspacing="1" class="compare-checklist valign-top"><tr>';
            foreach ($menu as $column) {
                $outCode .= '<td>' . implode('<br />', $column) . '</td>';
            }
            $outCode .= '</tr></table>';
            $outCode .= '<br /><input type="submit" name="ads" value="' . $GLOBALS['LANG']->getLL('update', true) . '">';
            $content = $this->doc->section($GLOBALS['LANG']->getLL('groupAndCompareUsers', true), $outCode, 0, 1);
            // Traverse all users
            $users = t3lib_BEfunc::getUserNames();
            $comparation = array();
            $counter = 0;
            $offset = 0;
            $numberAtTime = 1000;
            $tooManyUsers = '';
            foreach ($users as $r) {
                if ($counter >= $offset) {
                    // This is used to test with other users. Development ONLY!
                    $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
                    // New backend user object
                    /* @var $tempBE_USER local_beUserAuth */
                    $tempBE_USER->OS = TYPO3_OS;
                    $tempBE_USER->setBeUserByUid($r['uid']);
                    $tempBE_USER->fetchGroupData();
                    // Making group data
                    $md5pre = '';
                    $menu = array();
                    $uInfo = $tempBE_USER->ext_compileUserInfoForHash((array) $compareFlags);
                    foreach ($options as $kk => $vv) {
                        if ($compareFlags[$kk]) {
                            $md5pre .= serialize($uInfo[$kk]) . '|';
                        }
                    }
                    // setting md5:
                    $md5 = md5($md5pre);
                    if (!isset($comparation[$md5])) {
                        $comparation[$md5] = $tempBE_USER->ext_printOverview($uInfo, $compareFlags);
                        $comparation[$md5]['users'] = array();
                    }
                    $comparation[$md5]['users'][] = $tempBE_USER->user;
                    unset($tempBE_USER);
                }
                $counter++;
                if ($counter >= $numberAtTime + $offset) {
                    $tooManyUsers = $GLOBALS['LANG']->getLL('tooManyUsers', true) . ' ' . count($users) . '. ' . $GLOBALS['LANG']->getLL('canOnlyDisplay', true) . ' ' . $numberAtTime . '.';
                    break;
                }
            }
            // Print the groups:
            $allGroups = array();
            // Header:
            $allCells = array();
            $link_createNewUser = '******' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[be_users][0]=new', $this->doc->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('newUser', true) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . '</a>';
            $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td><strong>' . $GLOBALS['LANG']->getLL('usernames', TRUE) . '</strong></td><td width="12">' . $link_createNewUser . '</td></tr></table>';
            foreach ($options as $kk => $vv) {
                if ($compareFlags[$kk]) {
                    $allCells[$kk] = '<strong>' . $vv . ':</strong>';
                }
            }
            $allGroups[] = $allCells;
            foreach ($comparation as $dat) {
                $allCells = array();
                $curUid = $GLOBALS['BE_USER']->user['uid'];
                $uListArr = array();
                foreach ($dat['users'] as $uDat) {
                    $uItem = '<tr><td width="130">' . t3lib_iconWorks::getSpriteIconForRecord('be_users', $uDat, array('title' => $uDat['uid'])) . $this->linkUser($uDat['username'], $uDat) . '&nbsp;&nbsp;</td><td nowrap="nowrap">' . $this->elementLinks('be_users', $uDat);
                    if ($curUid != $uDat['uid'] && !$uDat['disable'] && ($uDat['starttime'] == 0 || $uDat['starttime'] < $GLOBALS['EXEC_TIME']) && ($uDat['endtime'] == 0 || $uDat['endtime'] > $GLOBALS['EXEC_TIME'])) {
                        $uItem .= '<a href="' . t3lib_div::linkThisScript(array('SwitchUser' => $uDat['uid'])) . '" target="_top" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('switchUserTo', true) . ' ' . $uDat['username']) . ' ' . $GLOBALS['LANG']->getLL('changeToMode', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-backend-user-switch') . '</a>' . '<a href="' . t3lib_div::linkThisScript(array('SwitchUser' => $uDat['uid'], 'switchBackUser' => 1)) . '" target="_top" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('switchUserTo', true) . ' ' . $uDat['username']) . ' ' . $GLOBALS['LANG']->getLL('switchBackMode', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-backend-user-emulate') . '</a>';
                    }
                    $uItem .= '</td></tr>';
                    $uListArr[] = $uItem;
                }
                $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . implode('', $uListArr) . '</table>';
                foreach ($options as $kk => $vv) {
                    if ($compareFlags[$kk]) {
                        $allCells[$kk] = $dat[$kk];
                    }
                }
                $allGroups[] = $allCells;
            }
            // Make table
            $outTable = '';
            $TDparams = ' nowrap="nowrap" class="bgColor5" valign="top"';
            $i = 0;
            foreach ($allGroups as $allCells) {
                $outTable .= '<tr><td' . $TDparams . '>' . implode('</td><td' . $TDparams . '>', $allCells) . '</td></tr>';
                $TDparams = ' nowrap="nowrap" class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '" valign="top"';
            }
            $outTable = '<table border="0" cellpadding="2" cellspacing="2">' . $outTable . '</table>';
            $outTable .= '<br /><br />' . $GLOBALS['LANG']->getLL('cachedGrouplistsUpdated', true);
            $outTable .= $tooManyUsers ? '<br /><br /><strong><span class="typo3-red">' . $tooManyUsers . '</span></strong>' : '';
            $content .= $this->doc->spacer(10);
            $content .= $this->doc->section($GLOBALS['LANG']->getLL('result', true), $outTable, 0, 1);
        }
        return $content;
    }
 /**
  * Returns a command array for the current type
  *
  * @return	array		Command array
  * @access private
  */
 function _getCommand()
 {
     $filename = tx_dam::file_absolutePath($this->itemInfo);
     $params = '&subname=tx_dam_cm_file&parentname=tx_dam_cm_record&txdamFile=' . $filename;
     $commands['onclick'] = 'top.loadTopMenu(\'' . t3lib_div::linkThisScript() . '&cmLevel=1' . $params . '\');return false;';
     $commands['dontHide'] = true;
     return $commands;
 }
    /**
     * Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set
     *
     * @param	string		Input string, like a page title for the tree
     * @param	array		record row with "php_tree_stop" field
     * @return	string		Modified string
     * @access private
     */
    function wrapStop($str, $row)
    {
        if ($row['php_tree_stop']) {
            $str .= '<span class="typo3-red">
								<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))) . '" class="typo3-red">+</a>
							</span>';
        }
        return $str;
    }
Exemplo n.º 19
0
	/**
	 * Main function of the MODULE. Write the content to $this->content
	 * There are three main modes:
	 * - Based on a file reference, creating/modifying a DS/TO
	 * - Based on a Template Object uid, remapping
	 * - Based on a Data Structure uid, selecting a Template Object to map.
	 *
	 * @return	void
	 */
	function main_mode()	{
		global $LANG, $BACK_PATH;

		$this->doc = t3lib_div::makeInstance('template');
		$this->doc->docType= 'xhtml_trans';
		$this->doc->backPath = $BACK_PATH;
		$this->doc->setModuleTemplate('EXT:templavoila/resources/templates/cm1_default.html');
		$this->doc->bodyTagId = 'typo3-mod-php';
		$this->doc->divClass = '';

		$this->doc->inDocStylesArray[]='
			#templavoila-frame-visual { height:500px; display:block; margin:0 5px; width:98%; border: 1xpx solid black;}
			DIV.typo3-fullDoc H2 { width: 100%; }
			TABLE#c-mapInfo {margin-top: 10px; margin-bottom: 5px; }
			TABLE#c-mapInfo TR TD {padding-right: 20px;}
			select option.pagetemplate {background-image:url(../icon_pagetemplate.gif);background-repeat: no-repeat; background-position: 5px 50%; padding: 1px 0 3px 24px; -webkit-background-size: 0;}
			select option.fce {background-image:url(../icon_fce_ce.png);background-repeat: no-repeat; background-position: 5px 50%; padding: 1px 0 3px 24px; -webkit-background-size: 0;}
			#c-toMenu { margin-bottom:10px; }
		';
		$this->doc->inDocStylesArray[] = self::$gnyfStyleBlock;

			// Add custom styles
		$this->doc->styleSheetFile2 = t3lib_extMgm::extRelPath($this->extKey)."cm1/styles.css";

			// General GPvars for module mode:
		$this->displayFile = tx_templavoila_file::filename(t3lib_div::_GP('file'));
		$this->displayTable = t3lib_div::_GP('table');
		$this->displayUid = t3lib_div::_GP('uid');
		$this->displayPath = t3lib_div::_GP('htmlPath');
		$this->returnUrl =  t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));

			// GPvars specific to the DS listing/table and mapping features:
		$this->_preview = t3lib_div::_GP('_preview');
		$this->mapElPath = t3lib_div::_GP('mapElPath');
		$this->doMappingOfPath = t3lib_div::_GP('doMappingOfPath');
		$this->showPathOnly = t3lib_div::_GP('showPathOnly');
		$this->mappingToTags = t3lib_div::_GP('mappingToTags');
		$this->DS_element = t3lib_div::_GP('DS_element');
		$this->DS_cmd = t3lib_div::_GP('DS_cmd');
		$this->fieldName = t3lib_div::_GP('fieldName');

			// GPvars specific for DS creation from a file.
		$this->_load_ds_xml_content = t3lib_div::_GP('_load_ds_xml_content');
		$this->_load_ds_xml_to = t3lib_div::_GP('_load_ds_xml_to');
		$this->_saveDSandTO_TOuid = t3lib_div::_GP('_saveDSandTO_TOuid');
		$this->_saveDSandTO_title = t3lib_div::_GP('_saveDSandTO_title');
		$this->_saveDSandTO_type = t3lib_div::_GP('_saveDSandTO_type');
		$this->_saveDSandTO_pid = t3lib_div::_GP('_saveDSandTO_pid');
		$this->DS_element_DELETE = t3lib_div::_GP('DS_element_DELETE');

			// Finding Storage folder:
		$this->findingStorageFolderIds();

			// Setting up form-wrapper:
		$this->doc->form='<form action="'.$this->linkThisScript(array()).'" method="post" name="pageform">';

			// JavaScript
		$this->doc->JScode.= $this->doc->wrapScriptTags('
			script_ended = 0;
			function jumpToUrl(URL)	{	//
				document.location = URL;
			}
			function updPath(inPath)	{	//
				document.location = "'.t3lib_div::linkThisScript(array('htmlPath'=>'','doMappingOfPath'=>1)).'&htmlPath="+top.rawurlencode(inPath);
			}

			function openValidator(key) {
				new Ajax.Request("' . $GLOBALS['BACK_PATH'] . 'ajax.php?ajaxID=tx_templavoila_cm1_ajax::getDisplayFileContent&key=" + key, {
					onSuccess: function(response) {
						var valform = new Element(\'form\',{method: \'post\', target:\'_blank\', action: \'http://validator.w3.org/check#validate_by_input\'});
						valform.insert(new Element(\'input\',{name: \'fragment\', value:response.responseText, type: \'hidden\'}));$(document.body).insert(valform);
						valform.submit();
					}
				});
			}
		');

		if(tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) {
			$this->doc->getDynTabMenuJScode();
		} else {
			$this->doc->loadJavascriptLib('js/tabmenu.js');
		}

			// Setting up the context sensitive menu:
		$CMparts = $this->doc->getContextMenuCode();
		$this->doc->bodyTagAdditions = $CMparts[1];
		$this->doc->JScode.=$CMparts[0];
		$this->doc->postCode.= $CMparts[2];

			// Icons
		$this->dsTypes = array(
			'sc' => $LANG->getLL('dsTypes_section') . ': ',
			'co' => $LANG->getLL('dsTypes_container') . ': ',
			'el' => $LANG->getLL('dsTypes_attribute') . ': ',
			'at' => $LANG->getLL('dsTypes_element') . ': ',
			'no' => $LANG->getLL('dsTypes_notmapped') . 'Not : ');
		foreach ($this->dsTypes as $id => $title) {
			$this->dsTypes[$id] = array(
					// abbrevation
				$id,
					// descriptive title
				$title,
					// image-path
				t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('templavoila').'cm1/item_'.$id.'.gif','width="24" height="16" border="0" style="margin-right: 5px;"'),
					// background-path
				t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('templavoila').'cm1/item_'.$id.'.gif','',1)
			);

				// information
			$this->dsTypes[$id][4] = @getimagesize($this->dsTypes[$id][3]);
		}

			// Render content, depending on input values:
		if ($this->displayFile)	{	// Browsing file directly, possibly creating a template/data object records.
			$this->renderFile();
		} elseif ($this->displayTable=='tx_templavoila_datastructure') {	// Data source display
			$this->renderDSO();
		} elseif ($this->displayTable=='tx_templavoila_tmplobj') {	// Data source display
			$this->renderTO();
		}

			// Add spacer:
		$this->content.=$this->doc->spacer(10);

		$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
		$docHeaderButtons = $this->getDocHeaderButtons();
		$docContent = array(
			'CSH' => $docHeaderButtons['csh'],
			'CONTENT' => $this->content
		);

		$content  = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
		$content .= $this->doc->moduleBody(
			$this->pageinfo,
			$docHeaderButtons,
			$docContent
		);
		$content .= $this->doc->endPage();

			// Replace content with templated content
		$this->content = $content;
	}
Exemplo n.º 20
0
 /**
  * Main function, returning the HTML content of the module
  *
  * @return	string		HTML
  */
 function main()
 {
     $content = '';
     $update040a = false;
     $update040b = false;
     $update040c = false;
     $tableNames = $GLOBALS['TYPO3_DB']->admin_get_tables();
     if (!isset($tableNames['tx_myquizpoll_relation_user_id_mm'])) {
         $update040a = true;
         $update040b = true;
         $update040c = true;
     }
     if (t3lib_div::_GP('update040a')) {
         $content .= "<br />Executing: Update relations-table for advanced statistics\n";
         $mmArray = array();
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid_local, uid_foreign', 'tx_myquizpoll_relation_user_id_mm', '', '', '', '');
         $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
         if ($rows > 0) {
             // DB entries found?
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                 $local = $row['uid_local'];
                 $mmArray[$local] = array();
                 $mmArray[$local]['user'] = $row['uid_foreign'];
             }
         }
         $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid_local, uid_foreign', 'tx_myquizpoll_relation_question_id_mm', '', '', '', '');
         $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($res2);
         if ($rows > 0) {
             // DB entries found?
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) {
                 $local = $row['uid_local'];
                 $mmArray[$local]['quest'] = $row['uid_foreign'];
             }
         }
         $updateArray = array();
         foreach ($mmArray as $key => $value) {
             //$content .= "- $key: ".$value['user'].'/'.$value['quest']."<br />\n";
             $updateArray = array('user_id' => $value['user'], 'question_id' => $value['quest']);
             $success = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_myquizpoll_relation', 'uid=' . $key, $updateArray);
             if (!$success) {
                 $content .= "<p>MySQL Update-Error :-(</p>";
             }
         }
         $update040a = true;
     }
     if (t3lib_div::_GP('update040b')) {
         $content .= "<br />Executing: - Delete no longer needed relation-data\n";
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_myquizpoll_relation_user_id_mm', '');
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_myquizpoll_relation_question_id_mm', '');
         $update040b = true;
     }
     if (t3lib_div::_GP('update040c')) {
         $content .= "<br />Executing: - Delete no longer needed relation-tables\n";
         mysql(TYPO3_db, 'DROP TABLE tx_myquizpoll_relation_user_id_mm');
         mysql(TYPO3_db, 'DROP TABLE tx_myquizpoll_relation_question_id_mm');
         $update040c = true;
     }
     if (t3lib_div::_GP('updatepoll') && t3lib_div::_GP('pollpid')) {
         $thePID = intval(t3lib_div::_GP('pollpid'));
         $timestamp = time();
         $content .= "<br />Executing: - Converting basic poll data to advanced poll data (folder {$thePID})\n";
         $res5 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, cruser_id,sys_language_uid,hidden, p_or_a, qids', 'tx_myquizpoll_result', 'pid=' . $thePID, '', '', '');
         $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($res5);
         if ($rows > 0) {
             $statisticsArray = array();
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res5)) {
                 $theUID = $row['uid'];
                 if (intval($row['p_or_a']) > 0 && intval($row['p_or_a']) < 13) {
                     $statisticsArray[$theUID] = array('pid' => $thePID, 'tstamp' => $timestamp, 'crdate' => $timestamp, 'cruser_id' => $row['cruser_id'], 'hidden' => $row['hidden'], 'user_id' => $theUID, 'question_id' => $row['qids'], 'checked' . $row['p_or_a'] => 1, 'sys_language_uid' => $row['sys_language_uid']);
                 }
             }
         }
         if (is_array($statisticsArray)) {
             foreach ($statisticsArray as $type => $element) {
                 $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_myquizpoll_relation', $element);
             }
             $content .= "<br />" . count($statisticsArray) . " elements inserted. done.<br />\n";
         }
     }
     if (t3lib_div::_GP('updatepoll2a') && t3lib_div::_GP('pollpid2a')) {
         $thePID = intval(t3lib_div::_GP('pollpid2a'));
         $timestamp = time();
         $content .= "<br />Executing: - Copy basic poll data to tx_myquizpoll_voting (folder {$thePID})\n";
         $res5 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, crdate,cruser_id,sys_language_uid,hidden, p_or_a, qids, ip', 'tx_myquizpoll_result', 'pid=' . $thePID, '', '', '');
         $rows = $GLOBALS['TYPO3_DB']->sql_num_rows($res5);
         if ($rows > 0) {
             $votingArray = array();
             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res5)) {
                 $theUID = $row['uid'];
                 if (intval($row['p_or_a']) > 0 && intval($row['p_or_a']) < 13) {
                     $votingArray[$theUID] = array('pid' => $thePID, 'tstamp' => $timestamp, 'crdate' => $row['crdate'], 'cruser_id' => $row['cruser_id'], 'hidden' => $row['hidden'], 'question_id' => intval($row['qids']), 'answer_no' => $row['p_or_a'], 'ip' => $row['ip'], 'sys_language_uid' => $row['sys_language_uid']);
                 }
             }
         }
         if (is_array($votingArray)) {
             foreach ($votingArray as $type => $element) {
                 $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_myquizpoll_voting', $element);
             }
             $content .= "<br />" . count($votingArray) . " elements inserted into tx_myquizpoll_voting. done.<br />\n";
         }
     }
     if (t3lib_div::_GP('updatepoll2b') && t3lib_div::_GP('pollpid2a')) {
         $thePID = intval(t3lib_div::_GP('pollpid2a'));
         $content .= "<br />Executing: - Deleting old basic poll data (folder {$thePID})\n";
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_myquizpoll_result', 'pid=' . $thePID);
     }
     // formular
     if ($content) {
         $content .= "<br /><br />\n";
     }
     $linkScript = t3lib_div::linkThisScript();
     // htmlspecialchars()
     //$content.=$linkScript;
     $content .= '<form name="myquiz" action="' . $linkScript . '" method="post">';
     if (!($update040a && $update040b && $update040c)) {
         $content .= '<br /><p>Updates from Version 0.3.0-0.4.2 to 1.0.0:<br />';
         if (!$update040a) {
             $content .= '<input type="checkbox" name="update040a" value="1" checked="checked" /> Update relation-table for advanced statistics<br />';
         }
         if (!$update040b) {
             $content .= '<input type="checkbox" name="update040b" value="1" checked="checked" /> - Delete no longer needed relation-data<br />';
         }
         if (!$update040c) {
             $content .= '<input type="checkbox" name="update040c" value="1" checked="checked" /> - Delete no longer needed relation-tables<br />';
         }
         $content .= '</p><br />';
     }
     $content .= '<p><input type="checkbox" name="updatepoll" value="1"  /> Optional: convert basic poll data to advanced poll data. ID of the folder: ';
     $content .= '<input type="text" name="pollpid" value="" /> (be carefully, there is no check if there are really basic poll data). Execute it only once!</p><br />';
     $content .= '<p><input type="checkbox" name="updatepoll2a" value="1"  /> Optional: copy basic poll data to the table tx_myquizpoll_voting. ID of the folder: ';
     $content .= '<input type="text" name="pollpid2a" value="" /> (be carefully, there is no check if there are really basic poll data). Execute it only once!';
     $content .= '<br />&nbsp; -&nbsp; <input type="checkbox" name="updatepoll2b" value="1"  /> Delete old entries in the table tx_myquizpoll_result with the above ID.</p><br />';
     //$linkScript = t3lib_div::slashJS(t3lib_div::linkThisScript());
     //$content.=$linkScript;
     // this.form.action=\''.$linkScript.'\';
     $content .= '<input type="button" onclick="this.form.submit();" name="send" value="Start" />';
     $content .= '</form>';
     return $content;
 }
    /**
     * Link to dump of database tables
     *
     * @param	array  $tablesArray
     * @param	string $extKey
     * @param	array  $additionalLinkParameter
     * @return	string		HTML
     */
    function dumpDataTablesLine($tablesArray, $extKey, $additionalLinkParameter = array())
    {
        $tables = array();
        $tablesNA = array();
        $allTables = array_keys($GLOBALS['TYPO3_DB']->admin_get_tables());
        foreach ($tablesArray as $tableName) {
            if (in_array($tableName, $allTables)) {
                $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $tableName);
                $tables[$tableName] = '<tr><td>&nbsp;</td><td>
					<a class="t3-link dumpLink" href="' . htmlspecialchars(t3lib_div::linkThisScript(array_merge(array('CMD[dumpTables]' => $tableName, 'CMD[showExt]' => $extKey), $additionalLinkParameter))) . '" title="' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_dump_table'), $tableName) . '">' . $tableName . '</a></td><td>&nbsp;&nbsp;&nbsp;</td><td>' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_number_of_records'), $count) . '</td></tr>';
            } else {
                $tablesNA[$tableName] = '<tr><td>&nbsp;</td><td>' . $tableName . '</td><td>&nbsp;</td><td>' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_table_not_there') . '</td></tr>';
            }
        }
        $label = '<table border="0" cellpadding="0" cellspacing="0">' . implode('', array_merge($tables, $tablesNA)) . '</table>';
        if (count($tables)) {
            $label = '<a class="t3-link dumpLink" href="' . htmlspecialchars(t3lib_div::linkThisScript(array_merge(array('CMD[dumpTables]' => implode(',', array_keys($tables)), 'CMD[showExt]' => $extKey), $additionalLinkParameter))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_dump_all_tables') . '">' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_download_all_data') . '</a><br /><br />' . $label;
        } else {
            $label = $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_nothing_to_dump') . '<br /><br />' . $label;
        }
        return $label;
    }
Exemplo n.º 22
0
 /**
  * Creates open-in-window link
  *
  * @return	string
  */
 function openInNewWindowLink()
 {
     global $BE_USER, $LANG;
     if ($this->returnUrl == 'close.html') {
         return '';
     }
     $aOnClick = 'vHWin=window.open(\'' . t3lib_div::linkThisScript(array('returnUrl' => 'close.html')) . '\',\'' . md5($this->R_URI) . '\',\'width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
     return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.openInNewWindow', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-window-open') . '</a>';
 }
Exemplo n.º 23
0
 /**
  * Initialization of the class
  *
  * @return	void
  */
 function init()
 {
     // Setting GPvars:
     $this->P = t3lib_div::_GP('P');
     $this->popView = t3lib_div::_GP('popView');
     $this->R_URI = t3lib_div::linkThisScript(array('popView' => ''));
     // "Module name":
     $this->MCONF['name'] = 'xMOD_wizard_rte.php';
     // Starting the document template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setModuleTemplate('templates/wizard_rte.html');
     $this->doc->divClass = '';
     // Need to NOT have the page wrapped in DIV since if we do that we destroy the feature that the RTE spans the whole height of the page!!!
     $this->doc->form = '<form action="tce_db.php" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
 }
    /**
     * Create the selector box for selecting fields to display from a table:
     *
     * @param	string		Table name
     * @param	array		all fields
     * @param	array		selected fields
     * @param	boolean		If true, form-fields will be wrapped around
     * @return	string		HTML table with the selector box (name: displayFields['.$table.'][])
     */
    function fieldSelectBox($table, $allFields, $selectedFields, $formFields = true)
    {
        global $TCA, $LANG;
        t3lib_div::loadTCA($table);
        $formElements = array('', '');
        if ($formFields) {
            $formElements = array('<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">', '</form>');
        }
        // Create an option for each field:
        $opt = array();
        $opt[] = '<option value=""></option>';
        foreach ($allFields as $fN) {
            // Field label
            $fL = is_array($TCA[$table]['columns'][$fN]) ? preg_replace('#:$#', '', $LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '[' . $fN . ']';
            $opt[] = '
						<option value="' . $fN . '"' . (in_array($fN, $selectedFields) ? ' selected="selected"' : '') . '>' . htmlspecialchars($fL) . '</option>';
        }
        // Compile the options into a multiple selector box:
        $lMenu = '
					<select size="' . t3lib_div::intInRange(count($allFields) + 1, 3, 8) . '" multiple="multiple" name="tx_dam_list_list_displayFields[]">' . implode('', $opt) . '
					</select>
						';
        // Table with the select box:
        $content .= '
				' . $formElements[0] . '
						<!--
							Field selector for extended table view:
						-->
						<table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
							<tr>
								<td>' . $lMenu . '</td>
								<td><input type="submit" name="search" value="&gt;&gt;"></td>
							</tr>
						</table>
					' . $formElements[1] . '
				';
        return $content;
    }
Exemplo n.º 25
0
 /**
  * Creating the module output.
  *
  * @return	void
  */
 function main()
 {
     global $LANG, $BACK_PATH, $BE_USER;
     if ($this->page_id) {
         // Get record for element:
         $elRow = t3lib_BEfunc::getRecordWSOL($this->table, $this->moveUid);
         // Headerline: Icon, record title:
         $hline = t3lib_iconWorks::getSpriteIconForRecord($this->table, $elRow, array('id' => "c-recIcon", 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow, $this->table))));
         $hline .= t3lib_BEfunc::getRecordTitle($this->table, $elRow, TRUE);
         // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
         $onClick = 'window.location.href=\'' . t3lib_div::linkThisScript(array('makeCopy' => !$this->makeCopy)) . '\';';
         $hline .= '<br /><input type="hidden" name="makeCopy" value="0" /><input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy">' . $LANG->getLL('makeCopy', 1) . '</label>';
         // Add the header-content to the module content:
         $this->content .= $this->doc->section($LANG->getLL('moveElement') . ':', $hline, 0, 1);
         $this->content .= $this->doc->spacer(20);
         // Reset variable to pick up the module content in:
         $code = '';
         // IF the table is "pages":
         if ((string) $this->table == 'pages') {
             // Get page record (if accessible):
             $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = t3lib_div::makeInstance('ext_posMap_pages');
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 if ($pageinfo['pid']) {
                     $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree:
                 $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
             }
         }
         // IF the table is "tt_content":
         if ((string) $this->table == 'tt_content') {
             // First, get the record:
             $tt_content_rec = t3lib_BEfunc::getRecord('tt_content', $this->moveUid);
             // ?
             if (!$this->input_moveUid) {
                 $this->page_id = $tt_content_rec['pid'];
             }
             // Checking if the parent page is readable:
             $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = t3lib_div::makeInstance('ext_posMap_tt_content');
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 $posMap->cur_sys_language = $this->sys_language;
                 // Headerline for the parent page: Icon, record title:
                 $hline = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageinfo, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($pageinfo, 'pages'))));
                 $hline .= t3lib_BEfunc::getRecordTitle('pages', $pageinfo, TRUE);
                 // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->page_id, 'mod.SHARED');
                 // SHARED page-TSconfig settings.
                 $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                 $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList)));
                 // Removing duplicates, if any
                 // Adding parent page-header and the content element columns from position-map:
                 $code = $hline . '<br />';
                 $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI);
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 $code .= '<br />';
                 $code .= '<br />';
                 if ($pageinfo['pid']) {
                     $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree (for pages):
                 $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
             }
         }
         // Add the $code content as a new section to the module:
         $this->content .= $this->doc->section($LANG->getLL('selectPositionOfElement') . ':', $code, 0, 1);
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($LANG->getLL('movingElement'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
    /**
     * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
     * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
     *
     * @param	string		The folder path to expand
     * @param	string		List of fileextensions to show
     * @return	string		HTML output
     */
    function TBE_dragNDrop($expandFolder = 0, $extensionList = '')
    {
        global $BACK_PATH;
        $extensionList = $extensionList == '*' ? '' : $extensionList;
        $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
        $out = '';
        if ($expandFolder && $this->checkFolder($expandFolder)) {
            if ($this->isWebFolder($expandFolder)) {
                // Read files from directory:
                $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1);
                // $extensionList="",$prependPath=0,$order='')
                if (is_array($files)) {
                    $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', count($files)));
                    $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
                    $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
                    $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
                    $out .= $picon . '<br />';
                    // Init row-array:
                    $lines = array();
                    // Add "drag-n-drop" message:
                    $lines[] = '
						<tr>
							<td colspan="2">' . $this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')) . '</td>
						</tr>';
                    // Traverse files:
                    foreach ($files as $filepath) {
                        $fI = pathinfo($filepath);
                        // URL of image:
                        $iurl = $this->siteURL . t3lib_div::rawurlencodeFP(substr($filepath, strlen(PATH_site)));
                        // Show only web-images
                        if (t3lib_div::inList('gif,jpeg,jpg,png', strtolower($fI['extension']))) {
                            $imgInfo = @getimagesize($filepath);
                            $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                            $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                            $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
                            $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $ficon, 'width="18" height="16"') . ' class="absmiddle" title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                            $filenameAndIcon = $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen));
                            if (t3lib_div::_GP('noLimit')) {
                                $maxW = 10000;
                                $maxH = 10000;
                            } else {
                                $maxW = 380;
                                $maxH = 500;
                            }
                            $IW = $imgInfo[0];
                            $IH = $imgInfo[1];
                            if ($IW > $maxW) {
                                $IH = ceil($IH / $IW * $maxW);
                                $IW = $maxW;
                            }
                            if ($IH > $maxH) {
                                $IW = ceil($IW / $IH * $maxH);
                                $IH = $maxH;
                            }
                            // Make row:
                            $lines[] = '
								<tr class="bgColor4">
									<td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
									<td nowrap="nowrap">' . ($imgInfo[0] != $IW ? '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('noLimit' => '1'))) . '">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/icon_warning2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('clickToRedrawFullSize', 1) . '" alt="" />' . '</a>' : '') . $pDim . '&nbsp;</td>
								</tr>';
                            $lines[] = '
								<tr>
									<td colspan="2"><img src="' . $iurl . '" width="' . $IW . '" height="' . $IH . '" border="1" alt="" /></td>
								</tr>';
                            $lines[] = '
								<tr>
									<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
								</tr>';
                        }
                    }
                    // Finally, wrap all rows in a table tag:
                    $out .= '


			<!--
				File listing / Drag-n-drop
			-->
						<table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
							' . implode('', $lines) . '
						</table>';
                }
            } else {
                // Print this warning if the folder is NOT a web folder:
                $out .= $this->barheader($GLOBALS['LANG']->getLL('files'));
                $out .= $this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'), 'icon_warning2');
            }
        }
        return $out;
    }
    /**
     *
     */
    function indexing_getProgessTable()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TYPO3_CONF_VARS;
        // JavaScript
        $this->pObj->doc->JScode = $this->pObj->doc->wrapScriptTags('
			function progress_bar_update(intCurrentPercent) {
				document.getElementById("progress_bar_left").style.width = intCurrentPercent+"%";
				document.getElementById("progress_bar_left").innerHTML = intCurrentPercent+"&nbsp;%";

				document.getElementById("progress_bar_left").style.background = "#448e44";
				if(intCurrentPercent >= 100) {
					document.getElementById("progress_bar_right").style.background = "#448e44";
				}
			}


			function addTableRow(cells) {

				document.getElementById("progressTable").style.visibility = "visible";

				var tbody = document.getElementById("progressTable").getElementsByTagName("tbody")[0];
				var row = document.createElement("TR");

				row.style.backgroundColor = "#D9D5C9";

				for (var cellId in cells) {
					var tdCell = document.createElement("TD");
					tdCell.innerHTML = cells[cellId];
					row.appendChild(tdCell);
				}
				var header = document.getElementById("progressTableheader");
				var headerParent = header.parentNode;
				headerParent.insertBefore(row,header.nextSibling);

				// tbody.appendChild(row);
				// tbody.insertBefore(row,document.getElementById("progressTableheader"));
			}

			function setMessage(msg) {
				var messageCnt = document.getElementById("message");
				messageCnt.innerHTML = msg;
			}

			function finished() {
				progress_bar_update(100);
				document.getElementById("progress_bar_left").innerHTML = "' . $LANG->getLL('tx_dam_tools_indexupdate.finished', 1) . '";
				// document.getElementById("btn_back").style.visibility = "visible";
			}
		');
        if (tx_dam::config_getValue('setup.devel')) {
            $iframeSize = 'width="100%" height="300" border="1" scrolling="yes" frameborder="1"';
        } else {
            $iframeSize = 'width="0" height="0" border="0" scrolling="no" frameborder="0"';
        }
        $code = '';
        $code .= '
			<table width="300px" border="0" cellpadding="0" cellspacing="0" id="progress_bar" summary="progress_bar" align="center" style="border:1px solid #888">
			<tbody>
			<tr>
			<td id="progress_bar_left" width="0%" align="center" style="background:#eee; color:#fff">&nbsp;</td>
			<td id="progress_bar_right" style="background:#eee;">&nbsp;</td>
			</tr>
			</tbody>
			</table>

			<iframe src="' . htmlspecialchars(t3lib_div::linkThisScript($this->pObj->addParams)) . '" name="indexiframe" ' . $iframeSize . '>
			Error!
			</iframe>
			<br />
		';
        $code .= '
			 <div id="message"></div>
			 <table id="progressTable" style="visibility:hidden" cellpadding="1" cellspacing="1" border="0" width="100%">
			 <tr id="progressTableheader" bgcolor="' . $this->pObj->doc->bgColor5 . '">
				 <th></th>
				 <th>' . $LANG->sL('LLL:EXT:dam/locallang_db.xml:tx_dam_item.file_name', 1) . '</th>
				 <th>' . $LANG->sL('LLL:EXT:dam/locallang_db.xml:tx_dam_item.file_path', 1) . '</th>
			</tr>
			</table>
		';
        return $code;
    }
    /**
     * Main function, rendering the browsable page tree
     *
     * @return	void
     */
    function main()
    {
        global $LANG, $TYPO3_CONF_VARS;
        $this->content = '';
        //$this->content.= $this->doc->startPage('Navigation');
        // the trees
        $this->browseTrees = t3lib_div::makeInstance('tx_dam_browseTrees');
        $this->browseTrees->init(t3lib_div::getIndpEnv('SCRIPT_NAME'));
        $this->content .= $this->browseTrees->getTrees();
        $this->markers['REFRESH'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('unique' => uniqid('tx_dam_navframe')))) . '">' . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="14" height="14"') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.refresh', 1) . '" alt="" /></a>';
        // Adding highlight - JavaScript
        if ($this->doHighlight) {
            $this->content .= $this->doc->wrapScriptTags('
			hilight_row("",top.fsMod.navFrameHighlightedID["web"]);
		');
        }
    }
Exemplo n.º 29
0
    function displayDiffs($diffPath, $descKey)
    {
        $diffFiles = t3lib_div::getFilesInDir($diffPath, 'diff', 0, '1');
        if (!count($diffFiles)) {
            return false;
        }
        $content = '';
        foreach ($diffFiles as $diffFile) {
            $diffData = @file_get_contents($diffPath . $diffFile);
            if (!$diffData) {
                continue;
            }
            $diffArray = pmkpatcher::parseDiff($diffData, $this->filePath);
            if (!is_array($diffArray)) {
                return false;
            }
            $name = htmlspecialchars(pathinfo($diffPath . $diffFile, PATHINFO_FILENAME));
            $content .= '<dl class="typo3-tstemplate-ceditor-constant">
	<dt class="typo3-tstemplate-ceditor-label">' . implode('<br />', $diffArray[0]['comment']) . '</dt>
	<dt class="typo3-dimmed">[' . $name . ']</dt>';
            $files = array();
            foreach ($diffArray as $diffParts) {
                $files[] = $diffParts['destinationfile'];
            }
            $content .= '
	<dd>The following file' . (count($files) > 1 ? 's' : '') . ' will be modified:<br />' . implode('<br />', $files) . '</dd>';
            $content .= '
	<dd>
		<div class="typo3-tstemplate-ceditor-row">
			<select name="' . $descKey . 'patch[' . $name . ']">
				<option value="0" selected="selected">Do nothing</option>
				<option value="1">Patch file</option>
				<option value="2">Unpatch file</option>
			</select>
		</div>
	</dd>
</dl>';
        }
        if (!$content) {
            return false;
        }
        $content = '<div style="padding-top: 10px;"></div><h2 class="typo3-tstemplate-ceditor-subcat bgColor5">' . $this->desc[$descKey]['title'] . '</h2>' . '<div style="padding-bottom: 10px;">' . $this->desc[$descKey]['desc'] . '</div>' . $content . '<input type="button" name="patchall" value="Select Patch all" onclick="return difftoggle(1,\'' . $descKey . '\')" /> ' . '<input type="button" name="unpatchall" value="Select Unpatch all" onclick="return difftoggle(2,\'' . $descKey . '\')" /> ' . '<input type="button" name="resetall" value="Reset all" onclick="return difftoggle(0,\'' . $descKey . '\')" /> ' . '<input name="update" value="Update" type="submit" style="font-weight: bold;"/>
			<input type="hidden" name="desckey" value="' . $descKey . '" />';
        return '<form name="' . $descKey . '_form" action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">' . $content . '</form>';
    }
 /**
  * Adding various standard options to the context menu.
  * This includes both first and second level.
  *
  * @param	object		The calling object. Value by reference.
  * @param	array		Array with the currently collected menu items to show.
  * @param	string		Table name of clicked item.
  * @param	integer		UID of clicked item.
  * @return	array		Modified $menuItems array
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     global $BE_USER, $TCA, $LANG;
     $localItems = array();
     // Accumulation of local items.
     $subname = t3lib_div::_GP('subname');
     // Detecting menu level
     // LEVEL: Primary menu.
     if (!in_array('moreoptions', $backRef->disabledItems) && !$backRef->cmLevel) {
         // Creating menu items here:
         if ($backRef->editOK) {
             $LL = $this->includeLL();
             $localItems[] = 'spacer';
             $localItems['moreoptions'] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($LANG->getLLL('label', $LL)), $backRef->excludeIcon(''), "top.loadTopMenu('" . t3lib_div::linkThisScript() . "&cmLevel=1&subname=moreoptions');return false;", 0, 1);
             if (!in_array('hide', $backRef->disabledItems) && is_array($TCA[$table]['ctrl']['enablecolumns']) && $TCA[$table]['ctrl']['enablecolumns']['disabled']) {
                 $localItems['hide'] = $backRef->DB_hideUnhide($table, $backRef->rec, $TCA[$table]['ctrl']['enablecolumns']['disabled']);
             }
             if (!in_array('edit_access', $backRef->disabledItems) && is_array($TCA[$table]['ctrl']['enablecolumns'])) {
                 $localItems['edit_access'] = $backRef->DB_editAccess($table, $uid);
             }
             if (!in_array('edit_pageproperties', $backRef->disabledItems) && $table == 'pages' && $backRef->editPageIconSet) {
                 $localItems['edit_pageproperties'] = $backRef->DB_editPageProperties($uid);
             }
         }
         // Find delete element among the input menu items and insert the local items just before that:
         $c = 0;
         $deleteFound = FALSE;
         foreach ($menuItems as $k => $value) {
             $c++;
             if (!strcmp($k, 'delete')) {
                 $deleteFound = TRUE;
                 break;
             }
         }
         if ($deleteFound) {
             // .. subtract two... (delete item + its spacer element...)
             $c -= 2;
             // and insert the items just before the delete element.
             array_splice($menuItems, $c, 0, $localItems);
         } else {
             // If no delete item was found, then just merge in the items:
             $menuItems = array_merge($menuItems, $localItems);
         }
     } elseif ($subname === 'moreoptions') {
         // LEVEL: Secondary level of menus (activated by an item on the first level).
         if ($backRef->editOK) {
             // If the page can be edited, then show this:
             if (!in_array('move_wizard', $backRef->disabledItems) && ($table == 'pages' || $table == 'tt_content')) {
                 $localItems['move_wizard'] = $backRef->DB_moveWizard($table, $uid, $backRef->rec);
             }
             if (!in_array('new_wizard', $backRef->disabledItems) && ($table == 'pages' || $table == 'tt_content')) {
                 $localItems['new_wizard'] = $backRef->DB_newWizard($table, $uid, $backRef->rec);
             }
             if (!in_array('perms', $backRef->disabledItems) && $table == 'pages' && $BE_USER->check('modules', 'web_perm')) {
                 $localItems['perms'] = $backRef->DB_perms($table, $uid, $backRef->rec);
             }
             if (!in_array('db_list', $backRef->disabledItems) && $BE_USER->check('modules', 'web_list')) {
                 $localItems['db_list'] = $backRef->DB_db_list($table, $uid, $backRef->rec);
             }
         }
         // Temporary mount point item:
         if ($table == 'pages') {
             $localItems['temp_mount_point'] = $backRef->DB_tempMountPoint($uid);
         }
         // Merge the locally made items into the current menu items passed to this function.
         $menuItems = array_merge($menuItems, $localItems);
     }
     return $menuItems;
 }