/** * 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; }