Project

General

Profile

Bug #19346 » class.tx_tstemplateanalyzer.php.v1.diff

Administrator Admin, 2008-09-17 19:57

View differences:

typo3/sysext/tstemplate_analyzer/class.tx_tstemplateanalyzer.php (working copy)
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
*/
require_once(PATH_t3lib."class.t3lib_extobjbase.php");
require_once(PATH_t3lib . "class.t3lib_extobjbase.php");
class tx_tstemplateanalyzer extends t3lib_extobjbase {
function init(&$pObj,$conf) {
parent::init($pObj,$conf);
function init(&$pObj, $conf) {
parent::init($pObj, $conf);
$this->pObj->modMenu_setDefaultList.= ',ts_analyzer_checkLinenum,ts_analyzer_checkSyntax,ts_analyzer_checkSyntaxBlockmode';
$this->pObj->modMenu_setDefaultList .= ',ts_analyzer_checkLinenum,ts_analyzer_checkSyntax,ts_analyzer_checkSyntaxBlockmode';
}
function modMenu() {
global $LANG;
return array (
'ts_analyzer_checkSetup' => '1',
......
);
}
function initialize_editor($pageId,$template_uid=0) {
function initialize_editor($pageId, $template_uid = 0) {
// Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
global $tmpl,$tplRow,$theConstants,$rootLine;
global $tmpl, $tplRow, $theConstants, $rootLine;
$tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global here!
$tmpl->tt_track = 0; // Do not log time-performance information
$tmpl->tt_track = false; // Do not log time-performance information
$tmpl->init();
// Gets the rootLine
......
// Gets the rootLine
$sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
$rootLine = $sys_page->getRootLine($pageId);
$tmpl->runThroughTemplates($rootLine,$template_uid); // This generates the constants/config + hierarchy info for the template.
$tmpl->runThroughTemplates($rootLine, $template_uid); // This generates the constants/config + hierarchy info for the template.
$tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid); // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
$tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid); // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
if (is_array($tplRow)) { // IF there was a template...
return 1;
return true;
}
}
function main() {
......
}
function main() {
// Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
global $tmpl,$tplRow,$theConstants,$rootLine;
global $SOBE, $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
global $tmpl, $tplRow, $theConstants, $rootLine;
// **************************
// Checking for more than one template an if, set a menu...
......
// **************************
// BUGBUG: Should we check if the uset may at all read and write template-records???
$existTemplate = $this->initialize_editor($this->pObj->id,$template_uid); // initialize
$existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize
if ($existTemplate) {
$theOutput.=$this->pObj->doc->divider(5);
$theOutput.=$this->pObj->doc->section("Current template:",'<img '.t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)).' align="top" /> <b>'.$this->pObj->linkWrapTemplateTitle($tplRow["title"]).'</b>'.htmlspecialchars(trim($tplRow["sitetitle"])?' - ('.$tplRow["sitetitle"].')':''));
$theOutput .= $this->pObj->doc->divider(5);
$theOutput .= $this->pObj->doc->section("Current template:", '<img ' . t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <b>' . $this->pObj->linkWrapTemplateTitle($tplRow["title"]) . '</b>' . htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : ''));
}
if ($manyTemplatesMenu) {
$theOutput.=$this->pObj->doc->section("",$manyTemplatesMenu);
$theOutput .= $this->pObj->doc->section("", $manyTemplatesMenu);
}
// debug($tmpl->hierarchyInfo);
......
$hierarArr = array();
$head = '<tr class="c-headLineTable">';
$head.= '<td>Title</td>';
$head.= '<td>Rootlevel</td>';
$head.= '<td>Clear Setup</td>';
$head.= '<td>Clear Constants</td>';
$head.= '<td>PID</td>';
$head.= '<td>Rootline</td>';
$head.= '<td>Next Level</td>';
$head.= '</tr>';
$hierar = implode(array_reverse($tmpl->ext_getTemplateHierarchyArr($tmpl->hierarchyInfoArr, "", array(), 1)), "");
$hierar= '<table id="ts-analyzer" border="0"" cellpadding="0"" cellspacing="1">' . $head . $hierar . '</table>';
$head .= '<td>Title</td>';
$head .= '<td>Rootlevel</td>';
$head .= '<td>Clear Setup</td>';
$head .= '<td>Clear Constants</td>';
$head .= '<td>PID</td>';
$head .= '<td>Rootline</td>';
$head .= '<td>Next Level</td>';
$head .= '</tr>';
$hierar = implode(array_reverse($tmpl->ext_getTemplateHierarchyArr($tmpl->hierarchyInfoArr, '', array(), 1)), '');
$hierar = '<table id="ts-analyzer" border="0"" cellpadding="0"" cellspacing="1">' . $head . $hierar . '</table>';
$theOutput.=$this->pObj->doc->spacer(5);
$theOutput.=$this->pObj->doc->section("Template hierarchy:", $hierar, 0, 1);
$theOutput .= $this->pObj->doc->spacer(5);
$theOutput .= $this->pObj->doc->section("Template hierarchy:", $hierar, 0, 1);
// Output options
$theOutput.=$this->pObj->doc->spacer(25);
$theOutput.=$this->pObj->doc->divider(0);
$theOutput.=$this->pObj->doc->section("Display Options", '', 1, 1);
$theOutput .= $this->pObj->doc->spacer(25);
$theOutput .= $this->pObj->doc->divider(0);
$theOutput .= $this->pObj->doc->section("Display Options", '', 1, 1);
$addParams = t3lib_div::_GET('template') ? '&template=' . t3lib_div::_GET('template') : '';
$theOutput .= '<div class="tst-analyzer-options">' .
t3lib_BEfunc::getFuncCheck($this->pObj->id, "SET[ts_analyzer_checkLinenum]", $this->pObj->MOD_SETTINGS["ts_analyzer_checkLinenum"], '', $addParams, 'id="checkTs_analyzer_checkLinenum"') .
......
<td><img src="clear.gif" width="3" height="1" /></td><td class="bgColor2"><b>' . $tmpl->templateTitles[current($tmpl->clearList_setup)] . '</b></td></tr>
<tr>
<td><img src="clear.gif" width="3" height="1" /></td>
<td class="bgColor2"><table border=0 cellpadding=0 cellspacing=0 class="bgColor0" width="100%"><tr><td nowrap>'.$tmpl->ext_outputTS(array($val),$this->pObj->MOD_SETTINGS["ts_analyzer_checkLinenum"],$this->pObj->MOD_SETTINGS["ts_analyzer_checkComments"],$this->pObj->MOD_SETTINGS["ts_analyzer_checkCrop"],$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntax"],$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntaxBlockmode"]).'</td></tr></table>
<td class="bgColor2"><table border=0 cellpadding=0 cellspacing=0 class="bgColor0" width="100%"><tr><td nowrap>' . $tmpl->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS["ts_analyzer_checkLinenum"], $this->pObj->MOD_SETTINGS["ts_analyzer_checkComments"], $this->pObj->MOD_SETTINGS["ts_analyzer_checkCrop"], $this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntax"], $this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntaxBlockmode"]) . '</td></tr></table>
</td>
</tr>
';
......
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_analyzer/class.tx_tstemplateanalyzer.php"]) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_analyzer/class.tx_tstemplateanalyzer.php"]);
}
?>
}
(1-1/2)