Пример #1
0
    /**
     * Constructor, initialize.
     *
     * @return	void
     */
    function init()
    {
        global $BACK_PATH;
        // Start the template object:
        $this->doc = t3lib_div::makeInstance('mediumDoc');
        $this->doc->bodyTagMargins['x'] = 5;
        $this->doc->bodyTagMargins['y'] = 5;
        $this->doc->backPath = $BACK_PATH;
        // Add JS
        $this->doc->JScode = $this->doc->wrapScriptTags('
		function jump(url, modName, mainModName) {
				// clear information about which entry in nav. tree that might have been highlighted.
			top.fsMod.navFrameHighlightedID = [];

			if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
				top.content.nav_frame.refresh_nav();
			}

			top.nextLoadModuleUrl = url;
			top.goToModule(modName);
		}
		');
        // Start the page:
        $this->content = '';
        $this->content .= $this->doc->startPage('TYPO3 Edit Document');
        // Loads the backend modules available for the logged in user.
        $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
        $this->loadModules->load($GLOBALS['TBE_MODULES']);
    }
Пример #2
0
 /**
  * Creates module content.
  *
  * @return	void
  */
 function main()
 {
     $this->title = $GLOBALS['LANG']->getLL($this->isSwap ? 'swap_title' : 'publish_title');
     $content = $this->getContent();
     // sets body parts to doc!
     $this->content .= $this->doc->startPage($this->title);
     $this->content .= $content;
     $this->content .= $this->doc->endPage();
 }
Пример #3
0
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // Access check...
        // The page will show only if there is a valid page and if this page may be viewed by the user
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        // Template markers
        $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/func.html');
        // **************************
        // Main
        // **************************
        if ($this->id && $access) {
            // JavaScript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				script_ended = 0;
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
				}
			');
            $this->doc->postCode = $this->doc->wrapScriptTags('
				script_ended = 1;
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
            $this->doc->form = '<form action="index.php" method="post"><input type="hidden" name="id" value="' . $this->id . '" />';
            $vContent = $this->doc->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->doc->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers['CSH'] = $docHeaderButtons['csh'];
            $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
            $markers['CONTENT'] = $this->content;
        } else {
            // If no access or if ID == zero
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('clickAPage_content'), $LANG->getLL('title'), t3lib_FlashMessage::INFO);
            $this->content = $flashMessage->render();
            // 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('title'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Пример #4
0
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // Access check...
        // The page will show only if there is a valid page and if this page may be viewed by the user
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
            if ($BE_USER->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('templates/info.html');
            $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), "defCol" => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), "defRow" => array("0" => array('<td valign="top">', '</td>'), "defCol" => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
            // JavaScript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				script_ended = 0;
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
				}
			');
            $this->doc->postCode = $this->doc->wrapScriptTags('
				script_ended = 1;
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
            $this->doc->form = '<form action="index.php" method="post" name="webinfoForm">';
            $vContent = $this->doc->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->doc->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
            // Build the <body> for the module
            $this->content = $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        } else {
            // If no access or if ID == zero
            $this->doc = t3lib_div::makeInstance('mediumDoc');
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        }
    }
 /**
  * Constructor, initialize.
  *
  * @return	void
  */
 function init()
 {
     global $BACK_PATH;
     // Start the template object:
     $this->doc = t3lib_div::makeInstance('mediumDoc');
     $this->doc->bodyTagMargins['x'] = 5;
     $this->doc->bodyTagMargins['y'] = 5;
     $this->doc->backPath = $BACK_PATH;
     // Start the page:
     $this->content = '';
     $this->content .= $this->doc->startPage('TYPO3 Edit Document');
     // Loads the backend modules available for the logged in user.
     $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
     $this->loadModules->load($GLOBALS['TBE_MODULES']);
 }
Пример #6
0
 /**
  * Generate module output
  *
  * @return	void
  */
 function main()
 {
     global $LANG;
     // Start history object
     $historyObj = t3lib_div::makeInstance('recordHistory');
     // Get content:
     $this->content .= $historyObj->main();
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers['CONTENT'] = $this->content;
     $markers['CSH'] = $docHeaderButtons['csh'];
     // Build the <body> for the module
     $this->content = $this->doc->startPage($LANG->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
 }
Пример #7
0
 /**
  * Main function, rendering the table wizard
  *
  * @return	void
  */
 function main()
 {
     if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('table_title'), $this->tableWizard(), 0, 1);
     } else {
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('table_title'), '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('table_noData', 1) . '</span>', 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('Table');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Пример #8
0
 /**
  * Main
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG;
     // Content creation
     if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
         $this->menu = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
     }
     switch ($this->MOD_SETTINGS['function']) {
         case 'search':
             $this->func_search();
             break;
         case 'tree':
             $this->func_tree();
             break;
         case 'records':
             $this->func_records();
             break;
         case 'relations':
             $this->func_relations();
             break;
         case 'filesearch':
             $this->func_filesearch();
             break;
         case 'refindex':
             $this->func_refindex();
             break;
         default:
             $this->func_default();
             break;
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->content);
     // Build the <body> for the module
     $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Пример #9
0
    /**
     * Main function, rendering the document with the iframe with the RTE in.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG;
        // translate id to the workspace version:
        if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
            $this->P['uid'] = $versionRec['uid'];
        }
        // If all parameters are available:
        if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
            // Getting the raw record (we need only the pid-value from here...)
            $rawRec = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
            t3lib_BEfunc::fixVersioningPid($this->P['table'], $rawRec);
            // Setting JavaScript, including the pid value for viewing:
            $this->doc->JScode = $this->doc->wrapScriptTags('
					function jumpToUrl(URL,formEl)	{	//
						if (document.editform)	{
							if (!TBE_EDITOR.isFormChanged())	{
								window.location.href = URL;
							} else if (formEl) {
								if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
							}
						} else window.location.href = URL;
					}
				' . ($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'], '', t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '') . '
			');
            // Initialize TCeforms - for rendering the field:
            $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
            $tceforms->initDefaultBEMode();
            // Init...
            $tceforms->disableWizards = 1;
            // SPECIAL: Disables all wizards - we are NOT going to need them.
            $tceforms->colorScheme[0] = $this->doc->bgColor;
            // SPECIAL: Setting background color of the RTE to ordinary background
            // Initialize style for RTE object:
            $RTEobj = t3lib_BEfunc::RTEgetObj();
            // Getting reference to the RTE object used to render the field!
            if ($RTEobj->ID == 'rte') {
                $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
                // SPECIAL: Setting style for the RTE <DIV> layer containing the IFRAME
            }
            // Fetching content of record:
            $trData = t3lib_div::makeInstance('t3lib_transferData');
            $trData->lockRecords = 1;
            $trData->fetchRecord($this->P['table'], $this->P['uid'], '');
            // Getting the processed record content out:
            reset($trData->regTableItems_data);
            $rec = current($trData->regTableItems_data);
            $rec['uid'] = $this->P['uid'];
            $rec['pid'] = $rawRec['pid'];
            // TSconfig, setting width:
            $fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
            if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) {
                $width = $fieldTSConfig['RTEfullScreenWidth'];
            } else {
                $width = '100%';
            }
            // Get the form field and wrap it in the table with the buttons:
            $formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']);
            $formContent = '


			<!--
				RTE wizard:
			-->
				<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
					<tr>
						<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
						<td></td>
					</tr>
				</table>';
            // Adding hidden fields:
            $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
						<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . t3lib_TCEforms::getHiddenTokenField('tceAction');
            // Finally, add the whole setup:
            $this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions();
        } else {
            // ERROR:
            $this->content .= $this->doc->section($LANG->getLL('forms_title'), '<span class="typo3-red">' . $LANG->getLL('table_noData', 1) . '</span>', 0, 1);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage('');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Пример #10
0
    /**
     * Main function of the module. Write the content to $this->content
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        // Template markers
        $markers = array('CSH' => '', 'FUNC_MENU' => '', 'WS_MENU' => '', 'CONTENT' => '');
        // Setting module configuration:
        $this->MCONF = $GLOBALS['MCONF'];
        $this->REQUEST_URI = str_replace('&sendToReview=1', '', t3lib_div::getIndpEnv('REQUEST_URI'));
        // Draw the header.
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/version.html');
        // Add styles
        $this->doc->inDocStylesArray[$GLOBALS['MCONF']['name']] = '
.version-diff-1 { background-color: green; }
.version-diff-2 { background-color: red; }
';
        // Setting up the context sensitive menu:
        $this->doc->getContextMenuCode();
        // Getting input data:
        $this->id = intval(t3lib_div::_GP('id'));
        // Page id. If set, indicates activation from Web>Versioning module
        if (!$this->id) {
            $this->uid = intval(t3lib_div::_GP('uid'));
            // Record uid. Goes with table name to indicate specific record
            $this->table = t3lib_div::_GP('table');
            // Record table. Goes with uid to indicate specific record
        } else {
            $this->uid = $this->id;
            $this->table = 'pages';
        }
        $this->details = t3lib_div::_GP('details');
        // Page id. If set, indicates activation from Web>Versioning module
        $this->diffOnly = t3lib_div::_GP('diffOnly');
        // Flag. If set, shows only the offline version and with diff-view
        // Force this setting:
        $this->MOD_SETTINGS['expandSubElements'] = TRUE;
        $this->MOD_SETTINGS['diff'] = $this->details || $this->MOD_SETTINGS['diff'] ? 1 : 0;
        // Reading the record:
        $record = t3lib_BEfunc::getRecord($this->table, $this->uid);
        if ($record['pid'] == -1) {
            $record = t3lib_BEfunc::getRecord($this->table, $record['t3ver_oid']);
        }
        $this->recordFound = is_array($record);
        $pidValue = $this->table === 'pages' ? $this->uid : $record['pid'];
        // Checking access etc.
        if ($this->recordFound && $TCA[$this->table]['ctrl']['versioningWS']) {
            $this->doc->form = '<form action="" method="post">';
            $this->uid = $record['uid'];
            // Might have changed if new live record was found!
            // Access check!
            // The page will show only if there is a valid page and if this page may be viewed by the user
            $this->pageinfo = t3lib_BEfunc::readPageAccess($pidValue, $this->perms_clause);
            $access = is_array($this->pageinfo) ? 1 : 0;
            if ($pidValue && $access || $BE_USER->user['admin'] && !$pidValue) {
                // JavaScript
                $this->doc->JScode .= '
					<script language="javascript" type="text/javascript">
						script_ended = 0;
						function jumpToUrl(URL)	{
							window.location.href = URL;
						}

						function hlSubelements(origId, verId, over, diffLayer)	{	//
							if (over)	{
								document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
								document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\';
								if (diffLayer)	{
									document.getElementById(\'diff_\'+verId).style.visibility = \'visible\';
								}
							} else {
								document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
								document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\';
								if (diffLayer)	{
									document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\';
								}
							}
						}
					</script>
				';
                // If another page module was specified, replace the default Page module with the new one
                $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
                $this->pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
                // Setting publish access permission for workspace:
                $this->publishAccess = $BE_USER->workspacePublishAccess($BE_USER->workspace);
                // Render content:
                if ($this->id) {
                    $this->workspaceMgm();
                } else {
                    $this->versioningMgm();
                }
            }
            $this->content .= $this->doc->spacer(10);
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers['CSH'] = $docHeaderButtons['csh'];
            $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
            $markers['WS_MENU'] = $this->workspaceMenu();
            $markers['CONTENT'] = $this->content;
        } else {
            // If no access or id value, create empty document
            $this->content = $this->doc->section($LANG->getLL('clickAPage_header'), $LANG->getLL('clickAPage_content'), 0, 1);
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers['CONTENT'] = $this->content;
        }
        // Build the <body> for the module
        $this->content = $this->doc->startPage($LANG->getLL('title'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Пример #11
0
    /**
     * Initialization of the class
     *
     * @return	void
     */
    function init()
    {
        global $LANG, $BACK_PATH;
        // Check if the tsconfig_help extension is loaded - which is mandatory for this wizard to work.
        t3lib_extMgm::isLoaded('tsconfig_help', 1);
        // Init GPvars:
        $this->P = t3lib_div::_GP('P');
        $this->mode = t3lib_div::_GP('mode');
        $this->show = t3lib_div::_GP('show');
        $this->objString = t3lib_div::_GP('objString');
        $this->onlyProperty = t3lib_div::_GP('onlyProperty');
        // Preparing some JavaScript code:
        if (!$this->areFieldChangeFunctionsValid()) {
            $this->P['fieldChangeFunc'] = array();
        }
        unset($this->P['fieldChangeFunc']['alert']);
        $update = '';
        foreach ($this->P['fieldChangeFunc'] as $k => $v) {
            $update .= '
			window.opener.' . $v;
        }
        // Init the document table object:
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->form = '<form action="" name="editform">';
        // Adding Styles (should go into stylesheet?)
        $this->doc->inDocStylesArray[] = '
			A:link {text-decoration: bold; color: ' . $this->doc->hoverColor . ';}
			A:visited {text-decoration: bold; color: ' . $this->doc->hoverColor . ';}
			A:active {text-decoration: bold; color: ' . $this->doc->hoverColor . ';}
			A:hover {color: ' . $this->doc->bgColor2 . '}
		';
        $this->doc->JScode .= $this->doc->wrapScriptTags('
			function checkReference_name()	{	// Checks if the input field containing the name exists in the document
				if (window.opener && window.opener.document && window.opener.document.' . $this->P['formName'] . ' && window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"] )	{
					return window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"];
				}
			}
			function checkReference_value()	{	// Checks if the input field containing the value exists in the document
				if (window.opener && window.opener.document && window.opener.document.' . $this->P['formName'] . ' && window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemValue'] . '"] )	{
					return window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemValue'] . '"];
				}
			}

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$field,value: ...
	 * @return	[type]		...
	 */
			function setValue(field,value)	{
				var nameField = checkReference_name();
				var valueField = checkReference_value();
				if (nameField)	{
					if (valueField)	{	// This applies to the TS Object Browser module
						nameField.value=field;
						valueField.value=value;
					} else {		// This applies to the Info/Modify module and the Page TSconfig field
						if (value) {
							nameField.value=field+"="+value+"\\n"+nameField.value;
						} else {
							nameField.value=field+"\\n"+nameField.value;
						}
					}
					' . $update . '
					window.opener.focus();
				}
				close();
			}
			function getValue()	{	// This is never used. Remove it?
				var field = checkReference_name();
				if (field)	{
					return field.value;
				} else {
					close();
				}
			}

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$cmd,objString: ...
	 * @return	[type]		...
	 */
			function mixerField(cmd,objString)	{
				var temp;
				switch(cmd)	{
					case "Indent":
						temp = str_replace("\\n","\\n  ","\\n"+document.editform.mixer.value);
						document.editform.mixer.value = temp.substr(1);
					break;
					case "Outdent":
						temp = str_replace("\\n  ","\\n","\\n"+document.editform.mixer.value);
						document.editform.mixer.value = temp.substr(1);
					break;
					case "Transfer":
						setValue(document.editform.mixer.value);
					break;
					case "Wrap":
						document.editform.mixer.value=objString+" {\\n"+document.editform.mixer.value+"\\n}";
					break;
				}
			}

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$match,replace,string: ...
	 * @return	[type]		...
	 */
			function str_replace(match,replace,string)	{
				var input = ""+string;
				var matchStr = ""+match;
				if (!matchStr)	{return string;}
				var output = "";
				var pointer=0;
				var pos = input.indexOf(matchStr);
				while (pos!=-1)	{
					output+=""+input.substr(pointer, pos-pointer)+replace;
					pointer=pos+matchStr.length;
					pos = input.indexOf(match,pos+1);
				}
				output+=""+input.substr(pointer);
				return output;
			}

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$show,objString: ...
	 * @return	[type]		...
	 */
			function jump(show,objString)	{
				window.location.href = "' . t3lib_div::linkThisScript(array('show' => '', 'objString' => '')) . '&show="+show+"&objString="+objString;
			}
		');
        // Start the page:
        $this->content .= $this->doc->startPage($LANG->getLL('tsprop'));
    }
Пример #12
0
 /**
  * Main module operation
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG;
     // Begin edit:
     if (is_array($this->editconf)) {
         // Initialize TCEforms (rendering the forms)
         $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
         $this->tceforms->initDefaultBEMode();
         $this->tceforms->doSaveFieldName = 'doSave';
         $this->tceforms->localizationMode = t3lib_div::inList('text,media', $this->localizationMode) ? $this->localizationMode : '';
         // text,media is keywords defined in TYPO3 Core API..., see "l10n_cat"
         $this->tceforms->returnUrl = $this->R_URI;
         $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
         $this->tceforms->disableRTE = !$BE_USER->isRTE();
         $this->tceforms->enableClickMenu = TRUE;
         $this->tceforms->enableTabMenu = TRUE;
         // Clipboard is initialized:
         $this->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
         // Start clipboard
         $this->tceforms->clipObj->initializeClipboard();
         // Initialize - reads the clipboard content from the user session
         // Setting external variables:
         $this->tceforms->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp'];
         if ($this->editRegularContentFromId) {
             $this->editRegularContentFromId();
         }
         // Creating the editing form, wrap it with buttons, document selector etc.
         $editForm = $this->makeEditForm();
         if ($editForm) {
             $this->firstEl = reset($this->elementsData);
             // Checking if the currently open document is stored in the list of "open documents" - if not, then add it:
             if ((strcmp($this->docDat[1], $this->storeUrlMd5) || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
                 $this->docHandler[$this->storeUrlMd5] = array($this->storeTitle, $this->storeArray, $this->storeUrl, $this->firstEl);
                 $BE_USER->pushModuleData('alt_doc.php', array($this->docHandler, $this->storeUrlMd5));
                 t3lib_BEfunc::setUpdateSignal('tx_opendocs::updateNumber', count($this->docHandler));
             }
             // Module configuration
             $this->modTSconfig = $this->viewId ? t3lib_BEfunc::getModTSconfig($this->viewId, 'mod.xMOD_alt_doc') : array();
             $body .= $this->tceforms->printNeededJSFunctions_top();
             $body .= $this->compileForm($editForm);
             $body .= $this->tceforms->printNeededJSFunctions();
             $body .= $this->functionMenus();
             $body .= $this->tceformMessages();
         }
     }
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->viewId, $this->perms_clause);
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('LANGSELECTOR' => $this->langSelector(), 'EXTRAHEADER' => $this->extraFormHeaders(), 'CSH' => $docHeaderButtons['csh'], 'CONTENT' => $body);
     // Build the <body> for the module
     $this->content = $this->doc->startPage('TYPO3 Edit Document');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
    /**
     * Creating the module output.
     *
     * @return	void
     */
    function main()
    {
        global $LANG, $BACK_PATH;
        if ($this->id && $this->access) {
            // Init position map object:
            $posMap = t3lib_div::makeInstance('ext_posMap');
            $posMap->cur_sys_language = $this->sys_language;
            $posMap->backPath = $BACK_PATH;
            if ((string) $this->colPos != '') {
                // If a column is pre-set:
                if ($this->uid_pid < 0) {
                    $row = array();
                    $row['uid'] = abs($this->uid_pid);
                } else {
                    $row = '';
                }
                $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
            } else {
                $this->onClickEvent = '';
            }
            // ***************************
            // Creating content
            // ***************************
            // use a wrapper div
            $this->content .= '<div id="user-setup-wrapper">';
            $this->content .= $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
            // Wizard
            $code = '';
            $wizardItems = $this->getWizardItems();
            // Wrapper for wizards
            $this->elementWrapper['sectionHeader'] = array('<h3 class="divider">', '</h3>');
            $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>');
            $this->elementWrapper['wizard'] = array('<tr>', '</tr>');
            $this->elementWrapper['wizardPart'] = array('<td>', '</td>');
            // copy wrapper for tabs
            $this->elementWrapperForTabs = $this->elementWrapper;
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = t3lib_div::getUserObj($classData);
                    if (!$hookObject instanceof cms_newContentElementWizardsHook) {
                        throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
                // restore wrapper for tabs if they are overwritten in hook
                $this->elementWrapper = $this->elementWrapperForTabs;
            }
            // add document inline javascript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function goToalt_doc()	{	//
					' . $this->onClickEvent . '
				}

				if(top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a radio button and title/description and icon:
            $cc = $key = 0;
            $menuItems = array();
            foreach ($wizardItems as $k => $wInfo) {
                if ($wInfo['header']) {
                    $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]);
                    $key = count($menuItems) - 1;
                } else {
                    $content = '';
                    // Radio button:
                    $oC = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : '');
                    $content .= $this->elementWrapper['wizardPart'][0] . '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($this->doc->thisBlur() . $oC) . '" />' . $this->elementWrapper['wizardPart'][1];
                    // Onclick action for icon/title:
                    $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $this->doc->thisBlur() . $oC . 'return false;';
                    // Icon:
                    $iInfo = @getimagesize($wInfo['icon']);
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1];
                    // Title + description:
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1];
                    // Finally, put it together in a container:
                    $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1];
                    $cc++;
                }
            }
            // add closing section-tag
            foreach ($menuItems as $key => $val) {
                $menuItems[$key]['content'] .= $this->elementWrapper['section'][1];
            }
            // Add the wizard table to the content, wrapped in tabs:
            if ($this->config['renderMode'] == 'tabs') {
                $this->doc->inDocStylesArray[] = '
					.typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #adadad; width: 680px; }
					.typo3-dyntabmenu-divs table { margin: 15px; }
					.typo3-dyntabmenu-divs table td { padding: 3px; }
				';
                $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100);
            } else {
                $code = $LANG->getLL('sel1', 1) . '<br /><br />';
                foreach ($menuItems as $section) {
                    $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content'];
                }
            }
            $this->content .= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1);
            // If the user must also select a column:
            if (!$this->onClickEvent) {
                // Add anchor "sel2"
                $this->content .= $this->doc->section('', '<a name="sel2"></a>');
                $this->content .= $this->doc->spacer(20);
                // Select position
                $code = $LANG->getLL('sel2', 1) . '<br /><br />';
                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
                $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
                // Finally, add the content of the column selector to the content:
                $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI);
                $this->content .= $this->doc->section($LANG->getLL('2_selectPosition'), $code, 0, 1);
            }
            // Close wrapper div
            $this->content .= '</div>';
        } else {
            // In case of no access:
            $this->content = '';
            $this->content .= $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
        }
        // 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('newContentElement'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->sectionEnd();
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Пример #14
0
 /**
  * Main processing, creating the list of new record tables to select from
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG;
     // If there was a page - or if the user is admin (admins has access to the root) we proceed:
     if ($this->pageinfo['uid'] || $BE_USER->isAdmin()) {
         // Acquiring TSconfig for this module/current page:
         $this->web_list_modTSconfig = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
         $this->allowedNewTables = t3lib_div::trimExplode(',', $this->web_list_modTSconfig['properties']['allowedNewTables'], 1);
         $this->deniedNewTables = t3lib_div::trimExplode(',', $this->web_list_modTSconfig['properties']['deniedNewTables'], 1);
         // Acquiring TSconfig for this module/parent page:
         $this->web_list_modTSconfig_pid = t3lib_BEfunc::getModTSconfig($this->pageinfo['pid'], 'mod.web_list');
         $this->allowedNewTables_pid = t3lib_div::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], 1);
         $this->deniedNewTables_pid = t3lib_div::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['deniedNewTables'], 1);
         // More init:
         if (!$this->showNewRecLink('pages')) {
             $this->newPagesInto = 0;
         }
         if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) {
             $this->newPagesAfter = 0;
         }
         // Set header-HTML and return_url
         if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
             $iconImgTag = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
         } else {
             $iconImgTag = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
         }
         $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(t3lib_div::fixed_lgd_cs($title, 45)) . '</span><br />';
         $this->R_URI = $this->returnUrl;
         // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard)
         if (!$this->pagesOnly) {
             // Regular new element:
             $this->regularNew();
         } elseif ($this->showNewRecLink('pages')) {
             // Pages only wizard
             $this->pagesOnly();
         }
         // Add all the content to an output section
         $this->content .= $this->doc->section('', $this->code);
         // 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->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle'));
         $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
         $this->content .= $this->doc->endPage();
         $this->content = $this->doc->insertStylesAndJS($this->content);
     }
 }
Пример #15
0
    /**
     * Generate the main settings formular:
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TBE_MODULES;
        // file creation / delete
        if ($this->isAdmin) {
            if (t3lib_div::_POST('deleteInstallToolEnableFile')) {
                unlink(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                $installToolEnableFileExists = is_file(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                if ($installToolEnableFileExists) {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR);
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK);
                }
                $this->content .= $flashMessage->render();
            }
            if (t3lib_div::_POST('createInstallToolEnableFile')) {
                touch(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                t3lib_div::fixPermissions(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                $installToolEnableFileExists = is_file(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                if ($installToolEnableFileExists) {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK);
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR);
                }
                $this->content .= $flashMessage->render();
            }
        }
        if ($this->languageUpdate) {
            $this->doc->JScodeArray['languageUpdate'] .= '
				if (top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			';
        }
        // Start page:
        $this->doc->loadJavascriptLib('md5.js');
        // use a wrapper div
        $this->content .= '<div id="user-setup-wrapper">';
        // Load available backend modules
        $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
        $this->loadModules->observeWorkspaces = true;
        $this->loadModules->load($TBE_MODULES);
        $this->content .= $this->doc->header($LANG->getLL('UserSettings') . ' - ' . $BE_USER->user['realName'] . ' [' . $BE_USER->user['username'] . ']');
        // show if setup was saved
        if ($this->setupIsUpdated) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('setupWasUpdated'), $LANG->getLL('UserSettings'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->tempDataIsCleared) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('tempDataClearedFlashMessage'), $LANG->getLL('tempDataCleared'));
            $this->content .= $flashMessage->render();
        }
        // If password is updated, output whether it failed or was OK.
        if ($this->passwordIsSubmitted) {
            if ($this->passwordIsUpdated) {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_ok'), $LANG->getLL('newPassword'));
            } else {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_failed'), $LANG->getLL('newPassword'), t3lib_FlashMessage::ERROR);
            }
            $this->content .= $flashMessage->render();
        }
        // render the menu items
        $menuItems = $this->renderUserSetup();
        $this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', false, false, 100, 1, false, 1, $this->dividers2tabs);
        // Submit and reset buttons
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section('', t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $BACK_PATH) . '
			<input type="hidden" name="simUser" value="' . $this->simUser . '" />
			<input type="submit" name="data[save]" value="' . $LANG->getLL('save') . '" />
			<input type="submit" name="data[setValuesToDefault]" value="' . $LANG->getLL('resetConfiguration') . '" onclick="return confirm(\'' . $LANG->getLL('setToStandardQuestion') . '\');" />
			<input type="submit" name="data[clearSessionVars]" value="' . $LANG->getLL('clearSessionVars') . '"  onclick="return confirm(\'' . $LANG->getLL('clearSessionVarsQuestion') . '\');" />');
        // Notice
        $this->content .= $this->doc->spacer(30);
        $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('activateChanges'), '', t3lib_FlashMessage::INFO);
        $this->content .= $flashMessage->render();
        // 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('UserSettings'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // end of wrapper div
        $this->content .= '</div>';
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Пример #16
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);
 }
Пример #17
0
 /**
  * Creates module content.
  *
  * @return	void
  */
 function main()
 {
     global $LANG;
     // see what we have to do and get parameters (call before processing data!!!)
     $this->getModuleParameters();
     $hasAccess = $GLOBALS['BE_USER']->isAdmin() || 0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4) || $this->isEditAction && $this->checkWorkspaceAccess();
     if (!$hasAccess) {
         $title = $this->getTitle();
         $this->content .= $this->doc->startPage($title);
         $this->content .= $this->doc->header($title);
         $this->content .= $this->doc->spacer(5);
         $this->content .= $LANG->getLL($this->isEditAction ? 'edit_workspace_no_permission' : 'create_workspace_no_permission');
         $this->content .= $this->doc->spacer(5);
         $goBack = $GLOBALS['LANG']->getLL('edit_workspace_go_back');
         $this->content .= t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '<a href="javascript:history.back()" title="' . $goBack . '">' . $goBack . '</a>';
         $this->content .= $this->doc->endPage();
         return;
     }
     // process submission (this may override action and workspace ID!)
     if (t3lib_div::_GP('workspace_form_submited')) {
         $this->processData();
         // if 'Save&Close' was pressed, redirect to main module script
         if (t3lib_div::_GP('_saveandclosedok_x')) {
             // `n` below is to prevent caching
             t3lib_utility_Http::redirect('index.php?n=' . uniqid(''));
         }
     }
     $this->initTCEForms();
     //
     // start page
     //
     $this->content .= $this->doc->header($this->getTitle());
     $this->content .= $this->doc->spacer(5);
     //
     // page content
     //
     $this->content .= $this->tceforms->printNeededJSFunctions_top();
     $this->content .= $this->buildForm();
     $this->content .= $this->tceforms->printNeededJSFunctions();
     // 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($this->getTitle());
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Пример #18
0
    /**
     * Main function.
     * Creates some general objects and calls other functions for the main rendering of module content.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // Access check...
        // The page will show only if there is a valid page and if this page may be viewed by the user
        $access = is_array($this->pageinfo) ? 1 : 0;
        if ($this->id && $access) {
            // Initialize permission settings:
            $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
            $this->EDIT_CONTENT = $this->CALC_PERMS & 16 ? 1 : 0;
            // Start document template object:
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('templates/db_layout.html');
            // JavaScript:
            $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . t3lib_div::createVersionNumberedFilename($BACK_PATH . '../t3lib/jsfunc.updateform.js') . '">' . '</script>';
            $this->doc->JScode .= $this->doc->wrapScriptTags('
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
				if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . intval($this->id) . '_"+top.fsMod.currentBank; ' . intval($this->id) . ';
				function jumpToUrl(URL,formEl)	{	//
					if (document.editform && TBE_EDITOR.isFormChanged)	{	// Check if the function exists... (works in all browsers?)
						if (!TBE_EDITOR.isFormChanged())	{	//
							window.location.href = URL;
						} else if (formEl) {
							if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
						}
					} else window.location.href = URL;
				}
			' . ($this->popView ? t3lib_BEfunc::viewOnClick($this->id, $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->id)) : '') . '

				function deleteRecord(table,id,url)	{	//
					if (confirm(' . $LANG->JScharCode($LANG->getLL('deleteWarning')) . '))	{
						window.location.href = "' . $BACK_PATH . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $BE_USER->veriCode() . '&prErr=1&uPT=1";
					}
					return false;
				}
			');
            $this->doc->JScode .= $this->doc->wrapScriptTags('
				var DTM_array = new Array();
				var DTM_origClass = new String();

					// if tabs are used in a popup window the array might not exists
				if(!top.DTM_currentTabs) {
					top.DTM_currentTabs = new Array();
				}

				function DTM_activate(idBase,index,doToogle)	{	//
						// Hiding all:
					if (DTM_array[idBase])	{
						for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++)	{
							if (DTM_array[idBase][cnt] != idBase+"-"+index)	{
								document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
								document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
							}
						}
					}

						// Showing one:
					if (document.getElementById(idBase+"-"+index+"-DIV"))	{
						if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block")	{
							document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
							if(DTM_origClass=="") {
								document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
							} else {
								DTM_origClass = "tab";
							}
							top.DTM_currentTabs[idBase] = -1;
						} else {
							document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
							if(DTM_origClass=="") {
								document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
							} else {
								DTM_origClass = "tabact";
							}
							top.DTM_currentTabs[idBase] = index;
						}
					}
				}
				function DTM_toggle(idBase,index,isInit)	{	//
						// Showing one:
					if (document.getElementById(idBase+"-"+index+"-DIV"))	{
						if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block")	{
							document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
							if(isInit) {
								document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
							} else {
								DTM_origClass = "tab";
							}
							top.DTM_currentTabs[idBase+"-"+index] = 0;
						} else {
							document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
							if(isInit) {
								document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
							} else {
								DTM_origClass = "tabact";
							}
							top.DTM_currentTabs[idBase+"-"+index] = 1;
						}
					}
				}

				function DTM_mouseOver(obj) {	//
						DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
						obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
				}

				function DTM_mouseOut(obj) {	//
						obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
						DTM_origClass = "";
				}
			');
            // Setting doc-header
            $this->doc->form = '<form action="' . htmlspecialchars('db_layout.php?id=' . $this->id . '&imagemode=' . $this->imagemode) . '" method="post">';
            // Creating the top function menu:
            $this->topFuncMenu = t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], 'db_layout.php', '');
            $this->languageMenu = count($this->MOD_MENU['language']) > 1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language', 1) . t3lib_BEfunc::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], 'db_layout.php', '') : '';
            // Find columns
            $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
            // SHARED page-TSconfig settings.
            $this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']), '') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];
            $this->colPosList = strcmp($this->colPosList, '') ? $this->colPosList : '1,0,2,3';
            $this->colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $this->colPosList)));
            // Removing duplicates, if any
            // Render the primary module content:
            if ($this->MOD_SETTINGS['function'] == 0) {
                $body = $this->renderQuickEdit();
                // QuickEdit
            } else {
                $body = $this->renderListContent();
                // All other listings
            }
            if ($this->pageinfo['content_from_pid']) {
                //$contentPage = t3lib_BEfunc::getRecord('pages', intval($this->pageinfo['content_from_pid']));
                $title = t3lib_BEfunc::getRecordTitle('pages', $contentPage);
                $linkToPid = $this->local_linkThisScript(array('id' => $this->pageinfo['content_from_pid']));
                $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->pageinfo['content_from_pid']) . ')</a>';
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('content_from_pid_title'), $link), t3lib_FlashMessage::INFO);
                $body = $flashMessage->render() . $body;
            }
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : '');
            $markers = array('CSH' => $docHeaderButtons['csh'], 'TOP_FUNCTION_MENU' => $this->editSelect . $this->topFuncMenu, 'LANGSELECTOR' => $this->languageMenu, 'CONTENT' => $body);
            // Build the <body> for the module
            $this->content = $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        } else {
            // If no access or id value, create empty document:
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('templates/db_layout.html');
            $this->doc->JScode = $this->doc->wrapScriptTags('
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('clickAPage_content'), $LANG->getLL('clickAPage_header'), t3lib_FlashMessage::INFO);
            $body = $flashMessage->render();
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'record_list' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => '');
            $markers = array('CSH' => t3lib_BEfunc::cshItem($this->descrTable, '', $BACK_PATH, '', TRUE), 'TOP_FUNCTION_MENU' => '', 'LANGSELECTOR' => '', 'CONTENT' => $body);
            $this->content = $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        }
    }