/**
  * generates output for general informations
  *
  * Structure of $infos:
  * $infos[$langKey]['origin'] == (array) language origins (relTypo3File)
  * $infos[$langKey]['meta'] == (array) meta informations (only default needed)
  * $infos[$langKey]['type'] == (string) location type (translated string)
  * $infos[$langKey]['type2'] == (string) language type (merged|l10n|splitted)
  * $infos[$langKey]['numTranslated'] == (integer) translated constants
  * $infos[$langKey]['numUntranslated'] == (integer) untranslated constants
  * $infos[$langKey]['numUnknown'] == (integer) unknown constants
  * $infos[$langKey]['email'] == (boolean) mailIt pre selection
  *
  * @param array see above
  * @param string reference language
  * @param integer amount of rows in textarea
  * @param boolean set to true if you want some special options (splitting dialog, meta edit)
  * @return string output (HTML code)
  */
 public static function outputGeneral($infos, $refLang, $textAreaRows, $flagSpecial = false)
 {
     $summary = $GLOBALS['LANG']->getLL('table.fileInfo');
     $content = '<table id="tx-lfeditor-table" summary="' . $summary . '">';
     // table header
     $content .= '<thead><tr>';
     $content .= '<th class="bgColor5">' . $GLOBALS['LANG']->getLL('lang.shortcut') . '</th>';
     $content .= '<th class="bgColor5">' . $GLOBALS['LANG']->getLL('lang.state') . '</th>';
     $content .= '<th class="bgColor5">' . $GLOBALS['LANG']->getLL('ext.type') . '</th>';
     $content .= '<th class="bgColor5">' . $GLOBALS['LANG']->getLL('lang.origin') . '</th>';
     if ($flagSpecial) {
         $content .= '<th id="tx-lfeditor-table-markup4"><img src="../res/images/mail.gif" alt="' . $GLOBALS['LANG']->getLL('function.backupMgr.delete') . '" /></th>';
         $char = substr($GLOBALS['LANG']->getLL('function.general.split.splitNormal'), 0, 1);
         $content .= '<th id="tx-lfeditor-table-markup1">' . strtoupper($char) . '</th>';
         $char = substr($GLOBALS['LANG']->getLL('function.general.split.splitL10n'), 0, 1);
         $content .= '<th id="tx-lfeditor-table-markup2">' . strtoupper($char) . '</th>';
         $char = substr($GLOBALS['LANG']->getLL('function.general.split.merge'), 0, 1);
         $content .= '<th id="tx-lfeditor-table-markup3">' . strtoupper($char) . '</th>';
     }
     $content .= '</tr></thead>';
     // table data
     $content .= '<tbody>';
     foreach ($infos as $langKey => $info) {
         // language shortcut
         $content .= '<tr><td class="bgColor4"><a href="#" title="' . $langKey . '" ' . 'onclick="submitRedirectForm(\'language\',\'' . $langKey . '\');">' . $langKey . '</a></td>';
         // state and constant information
         $constInfo = '(<span class="tx-lfeditor-goodMarkup">' . $info['numTranslated'] . '</span>-<span class="tx-lfeditor-specialMarkup">' . $info['numUnknown'] . '</span>-<span class="tx-lfeditor-badMarkup">' . $info['numUntranslated'] . '</span>)';
         if ($info['numTranslated'] >= $infos[$refLang]['numTranslated']) {
             $content .= '<td class="bgColor4"><span class="tx-lfeditor-goodMarkup">' . $GLOBALS['LANG']->getLL('lang.complete') . '</span><br />' . $constInfo . '</td>';
         } else {
             $content .= '<td class="bgColor4"><span class="tx-lfeditor-badMarkup">' . $GLOBALS['LANG']->getLL('lang.incomplete') . '</span><br />' . $constInfo . '</td>';
         }
         // type and origin
         $content .= '<td class="bgColor4">' . $info['type'] . '</td>';
         $content .= '<td class="bgColor4">' . $info['origin'] . '</td>';
         // zip mail, merge, normal split and l10n split options
         if ($flagSpecial) {
             // pre selection
             $checked = '';
             if ($info['email']) {
                 $checked = 'checked="checked"';
             }
             $set = '-';
             if ($langKey == 'default' || $info['type2'] != 'merged') {
                 $set = '<input type="checkbox" ' . $checked . ' name="mailIt[' . $langKey . ']" value="1" />';
             }
             $content .= '<td class="bgColor4">' . $set . '</td>';
             $set = '-';
             if ($langKey != 'default' && $info['type2'] != 'splitted') {
                 $set = '<input type="radio" name="langModes[' . $langKey . ']" value="1" />';
             }
             $content .= '<td class="bgColor4">' . $set . '</td>';
             $set = '-';
             if ($langKey != 'default' && $info['type2'] != 'l10n') {
                 $set = '<input type="radio" name="langModes[' . $langKey . ']" value="2" />';
             }
             $content .= '<td class="bgColor4">' . $set . '</td>';
             $set = '-';
             if ($langKey != 'default' && $info['type2'] != 'merged') {
                 $set = '<input type="radio" name="langModes[' . $langKey . ']" value="3" />';
             }
             $content .= '<td class="bgColor4">' . $set . '</td>';
         }
         $content .= '</tr>';
     }
     $content .= '</tbody></table>';
     // generate meta handling fieldset dialog
     $header = $GLOBALS['LANG']->getLL('function.general.metaInfo.metaInfo');
     $content .= '<fieldset class="tx-lfeditor-fieldset bgColor5 tx-lfeditor-fleft">';
     $content .= '<legend class="bgColor3">' . $header . '</legend>';
     // type and csh table
     $header = $GLOBALS['LANG']->getLL('function.general.metaInfo.type');
     $content .= '<fieldset class="bgColor4"> <legend class="bgColor3">' . $header . '</legend>';
     $content .= '<select id="metaType" name="meta[type]" onchange="metaTypeCheck();">';
     $options = array('', 'module', 'database', 'CSH');
     foreach ($options as $option) {
         $selected = '';
         if ($option == $infos['default']['meta']['type']) {
             $selected = 'selected="selected"';
         }
         $content .= '<option value="' . $option . '" ' . $selected . '>' . (empty($option) ? '--' : $option) . '</option>';
     }
     $content .= '</select>';
     $content .= $GLOBALS['LANG']->getLL('function.general.metaInfo.cshTable') . '&nbsp;';
     $disabled = $infos['default']['meta']['type'] == 'CSH' ? '' : 'disabled="disabled"';
     $content .= '<input type="text" ' . $disabled . ' id="metaCSHTable" name="meta[csh_table]"' . 'value="' . $infos['default']['meta']['csh_table'] . '" />';
     $content .= '</fieldset>';
     // author
     $header = $GLOBALS['LANG']->getLL('function.general.metaInfo.author');
     $content .= '<fieldset class="bgColor4"> <legend class="bgColor3">' . $header . '</legend>';
     $label = $GLOBALS['LANG']->getLL('function.general.metaInfo.author.name');
     $value = $infos['default']['meta']['authorName'];
     $content .= '<label for="name" class="tx-lfeditor-label">' . $label . '</label>';
     $content .= '<input type="text" id="name" class="tx-lfeditor-input" ' . 'name="meta[authorName]" value="' . $value . '" />';
     $label = $GLOBALS['LANG']->getLL('function.general.metaInfo.author.email');
     $value = $infos['default']['meta']['authorEmail'];
     $content .= '<label for="email" class="tx-lfeditor-label">' . $label . '</label>';
     $content .= '<input type="text" id="email" class="tx-lfeditor-input" ' . 'name="meta[authorEmail]" value="' . $value . '" />';
     $content .= '</fieldset>';
     // description
     $header = $GLOBALS['LANG']->getLL('function.general.metaInfo.desc');
     $content .= '<fieldset class="bgColor4"> <legend class="bgColor3">' . $header . '</legend>';
     $desc = $infos['default']['meta']['description'];
     $content .= '<textarea class="tx-lfeditor-textarea ' . ($GLOBALS['PMKTEXTAREA'] ? 'enable-tab' : '') . '" rows="' . $textAreaRows . '" ' . 'name="meta[description]">' . preg_replace('/<br.*>/U', "\n", $desc) . '</textarea>';
     $content .= '</fieldset> </fieldset>';
     // options dialog
     $header = $GLOBALS['LANG']->getLL('function.general.options');
     $content .= '<fieldset class="tx-lfeditor-fieldset bgColor5 tx-lfeditor-fright">';
     $content .= '<legend class="bgColor3">' . $header . '</legend>';
     // split/merge options
     if ($flagSpecial) {
         $content .= '<fieldset class="bgColor4"> <legend class="bgColor3">' . $GLOBALS['LANG']->getLL('function.general.split.split') . '</legend>';
         $value = $GLOBALS['LANG']->getLL('function.general.split.splitNormal');
         $content .= '<p> <input type="radio" name="splitFile" id="splitNormal" value="1" /> ' . '<label for="splitNormal">' . $value . '</label></p>';
         $value = $GLOBALS['LANG']->getLL('function.general.split.splitL10n');
         $content .= '<p> <input type="radio" name="splitFile" id="splitL10n" value="2" /> ' . '<label for="splitL10n">' . $value . '</label></p>';
         $value = $GLOBALS['LANG']->getLL('function.general.split.merge');
         $content .= '<p> <input type="radio" name="splitFile" id="merge" value="3" /> ' . '<label for="merge">' . $value . '</label></p>';
         $content .= '</fieldset>';
     }
     // transform options
     $header = $GLOBALS['LANG']->getLL('function.general.transform.transform');
     $content .= '<fieldset class="bgColor4"><legend class="bgColor3">' . $header . '</legend>';
     $value = $GLOBALS['LANG']->getLL('function.general.transform.xml');
     $content .= '<p> <input type="radio" name="transFile" id="xml" value="xml" /> ' . '<label for="xml">' . $value . '</label></p>';
     $value = $GLOBALS['LANG']->getLL('function.general.transform.php');
     $content .= '<p> <input type="radio" name="transFile" id="php" value="php" /> ' . '<label for="php">' . $value . '</label></p>';
     $content .= '</fieldset> </fieldset>';
     // submit and reset
     $buttons = array('submit' => array('css' => 'tx-lfeditor-buttonSubmit', 'value' => $GLOBALS['LANG']->getLL('button.save'), 'type' => 'submit'), 'reset' => array('css' => 'tx-lfeditor-buttonReset', 'value' => $GLOBALS['LANG']->getLL('button.reset'), 'type' => 'reset'));
     $content .= tx_lfeditor_mod1_template::outputAddButtons($buttons);
     // hidden fields
     $content .= '<input type="hidden" name="submitted" value="1" />';
     $content .= '<input type="hidden" name="language" value="" />';
     return $content;
 }
Ejemplo n.º 2
0
 /**
  * generates the module content
  *
  * @throws LFException raised if any output failure occured
  * @return void at failure
  */
 private function moduleContent()
 {
     // generate menus
     try {
         // generate extension and workspace list
         $name = 'select.extensionAndWorkspace';
         $name = tx_lfeditor_mod1_functions::prepareSectionName($name);
         $this->content .= $this->doc->section($name, '', 0, 1);
         $this->menuExtList();
         $extList = $this->getFuncMenu('extList');
         $this->menuWorkspaceList();
         $this->content .= $this->doc->funcMenu($extList, $this->getFuncMenu('wsList'));
         // generate language file list
         if ($this->MOD_SETTINGS['function'] != 'backupMgr') {
             $name = tx_lfeditor_mod1_functions::prepareSectionName('select.langfile');
             $this->content .= $this->doc->section($name, '', 0, 1);
             $this->menuLangFileList();
             $this->content .= $this->doc->funcMenu($this->getFuncMenu('langFileList'), '');
         }
     } catch (LFException $e) {
         throw $e;
     }
     // init language file object
     try {
         if ($this->MOD_SETTINGS['function'] != 'backupMgr') {
             $this->initFileObject($this->MOD_SETTINGS['langFileList'], $this->MOD_SETTINGS['extList'], $this->MOD_SETTINGS['wsList']);
         }
     } catch (LFException $e) {
         throw $e;
     }
     // init backup object
     try {
         if ($this->MOD_SETTINGS['function'] == 'backupMgr') {
             $informations = array('extPath' => sgLib::trimPath(PATH_site, $this->MOD_SETTINGS['extList']), 'langFile' => t3lib_div::_POST('langFile'));
             $this->initBackupObject($this->MOD_SETTINGS['wsList'], $informations);
         }
     } catch (LFException $e) {
         throw $e;
     }
     // generate general output
     switch ($this->MOD_SETTINGS['function']) {
         case 'general':
             // exec action specific part of function
             try {
                 $submit = t3lib_div::_POST('submitted');
                 $sendMail = t3lib_div::_POST('sendMail');
                 if ($submit) {
                     if ($this->actionFuncGeneral()) {
                         if (!$sendMail) {
                             $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('lang.file.write.success') . '</p>';
                         } else {
                             $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('function.general.mail.success') . '</p>';
                         }
                     }
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // draw the language reference list
             $this->menuLangList($langData, 'patternList');
             $refMenu = $this->doc->funcMenu($this->getFuncMenu('patternList'), '');
             $sectName = 'select.referenceLanguage';
             $name = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             $this->content .= $this->doc->section($name, $refMenu, 0, 1);
             // get main content
             $content = $this->outputFuncGeneral();
             $sectName = 'function.general.general';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'langfile.edit':
             // start session
             session_start();
             // exec action specific part of function
             try {
                 $submit = t3lib_div::_POST('submitted');
                 $session = t3lib_div::_POST('session');
                 if ($submit) {
                     $this->actionFuncLangfileEdit();
                     if (!$session) {
                         $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('lang.file.write.success') . '</p>';
                     }
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // draw the language- and patternlist
             $this->menuLangList($langData, 'langList');
             $langList = $this->getFuncMenu('langList');
             $this->menuLangList($langData, 'langfileEditPatternList', $GLOBALS['LANG']->getLL('select.nothing'));
             $patternList = $this->getFuncMenu('langfileEditPatternList');
             $languageMenu = $this->doc->funcMenu($langList, $patternList);
             $name = 'select.languageAndPattern';
             $name = tx_lfeditor_mod1_functions::prepareSectionName($name);
             $this->content .= $this->doc->section($name, $languageMenu, 0, 1);
             // draw type selector
             $this->menuConstantType();
             $typeList = $this->getFuncMenu('constTypeList');
             $typeMenu = $this->doc->funcMenu($typeList, '');
             $name = 'select.constantType';
             $name = tx_lfeditor_mod1_functions::prepareSectionName($name);
             $this->content .= $this->doc->section($name, $typeMenu, 0, 1);
             // get main content
             try {
                 $content = $this->outputFuncLangfileEdit($langData);
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.langfile.edit';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'const.edit':
             // exec action specific part of function
             try {
                 $submit = t3lib_div::_POST('submit');
                 if ($submit) {
                     $this->actionFuncConstEdit();
                     $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('lang.file.write.success') . '</p>';
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // draw the constant list menu
             $this->menuConstList($langData, $GLOBALS['LANG']->getLL('select.nothing'));
             $constList = $this->doc->funcMenu($this->getFuncMenu('constList'), '');
             $name = tx_lfeditor_mod1_functions::prepareSectionName('select.constant');
             $this->content .= $this->doc->section($name, $constList, 0, 1);
             // get main content
             try {
                 $content = $this->outputFuncConstEdit($langData);
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.const.edit.edit';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'const.add':
             $constant = t3lib_div::_POST('nameOfConst');
             $newLang = t3lib_div::_POST('newLang');
             $langData = $this->fileObj->getLocalLangData();
             // exec action specific part of function
             $submit = t3lib_div::_POST('submit');
             try {
                 if ($submit) {
                     $this->actionFuncConstAdd($langData, $newLang, $constant);
                     $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('lang.file.write.success') . '</p>';
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get main content
             try {
                 $content = $this->outputFuncConstAdd($constant, $newLang);
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.const.add.add';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'const.delete':
             // exec action specific part of function
             try {
                 $submit = t3lib_div::_POST('submit');
                 if ($submit) {
                     $this->actionFuncConstDelete();
                     $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('lang.file.write.success') . '</p>';
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // draw the constant list menu
             $this->menuConstList($langData, $GLOBALS['LANG']->getLL('select.nothing'));
             $constList = $this->doc->funcMenu($this->getFuncMenu('constList'), '');
             $name = tx_lfeditor_mod1_functions::prepareSectionName('select.constant');
             $this->content .= $this->doc->section($name, $constList, 0, 1);
             // get main content
             try {
                 $content = $this->outputFuncConstDelete();
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.const.delete.delete';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'const.rename':
             // exec action specific part of function
             try {
                 $submit = t3lib_div::_POST('submit');
                 if ($submit) {
                     $langData = $this->fileObj->getLocalLangData();
                     $this->actionFuncConstRename($langData);
                     $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('lang.file.write.success') . '</p>';
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // draw the constant list menu
             $this->menuConstList($langData, $GLOBALS['LANG']->getLL('select.nothing'));
             $constList = $this->doc->funcMenu($this->getFuncMenu('constList'), '');
             $name = tx_lfeditor_mod1_functions::prepareSectionName('select.constant');
             $this->content .= $this->doc->section($name, $constList, 0, 1);
             // get main content
             try {
                 $content = $this->outputFuncConstRename();
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.const.rename.rename';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'const.search':
             // exec action specific part of function
             $submit = t3lib_div::_POST('submitted');
             if ($submit) {
                 $this->actionFuncConstSearch();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // get main content
             try {
                 $content = $this->outputFuncConstSearch($langData);
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.const.search.search';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'const.treeview':
             $curToken = t3lib_div::_POST('usedToken');
             // exec action specific part of function
             $submit = t3lib_div::_POST('submitted');
             if ($submit) {
                 $this->actionFuncConstTreeview();
             }
             // get language data
             $langData = $this->fileObj->getLocalLangData();
             // draw the language and reference list
             $this->menuLangList($langData, 'langList');
             $langList = $this->getFuncMenu('langList');
             $this->menuLangList($langData, 'patternList');
             $refList = $this->getFuncMenu('patternList');
             $name = 'select.languageAndPattern';
             $name = tx_lfeditor_mod1_functions::prepareSectionName($name);
             $langMenu = $this->doc->funcMenu($langList, $refList);
             $this->content .= $this->doc->section($name, $langMenu, 0, 1);
             // draw explode token menu
             $curToken = tx_lfeditor_mod1_functions::getExplodeToken($curToken, $langData[$this->MOD_SETTINGS['patternList']]);
             $selToken = tx_lfeditor_mod1_template::fieldSetToken($curToken);
             $treeMenu = $this->doc->funcMenu($selToken, '');
             $name = 'select.explodeToken';
             $name = tx_lfeditor_mod1_functions::prepareSectionName($name);
             $this->content .= $this->doc->section($name, $treeMenu, 0, 1);
             // get main content
             try {
                 $content = $this->outputFuncConstTreeview($langData, $curToken);
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.const.treeview.treeview';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
         case 'backupMgr':
             // exec action specific part of function
             try {
                 $origDiff = t3lib_div::_POST('origDiff');
                 $submit = t3lib_div::_POST('submitted');
                 if ($submit) {
                     $this->actionFuncBackupMgr();
                     if (!$origDiff) {
                         $preContent = '<p class="tx-lfeditor-success">' . $GLOBALS['LANG']->getLL('function.backupMgr.success') . '</p>';
                     }
                 }
             } catch (LFException $e) {
                 $preContent = $e->getMessage();
             }
             // get main content
             try {
                 $content = $this->outputFuncBackupMgr();
             } catch (LFException $e) {
                 $content = $e->getMessage();
             }
             $sectName = 'function.backupMgr.backupMgr';
             $sectName = tx_lfeditor_mod1_functions::prepareSectionName($sectName);
             break;
     }
     // save generated content
     $this->content .= $this->doc->section($sectName, $preContent . $content, 0, 1);
 }