Feature #18836 » 8499_tstemplate_index.php.diff
typo3/sysext/tstemplate/ts/index.php 2008-05-25 12:42:07.000000000 +0200 | ||
---|---|---|
require ("conf.php");
|
||
require ($BACK_PATH."init.php");
|
||
require ($BACK_PATH."template.php");
|
||
$LANG->includeLLFile('EXT:tstemplate/ts/locallang.xml');
|
||
$LANG->includeLLFile('EXT:cms/locallang_tca.xml');
|
||
require_once (PATH_t3lib."class.t3lib_page.php");
|
||
require_once (PATH_t3lib."class.t3lib_tstemplate.php");
|
||
require_once (PATH_t3lib."class.t3lib_tsparser_ext.php");
|
||
... | ... | |
// Setting up the context sensitive menu:
|
||
$this->doc->getContextMenuCode();
|
||
// Build the modulle content
|
||
$this->content = $this->doc->header("Template Tools");
|
||
// Build the module content
|
||
$this->content = $this->doc->header($LANG->getLL('sys_template.moduleTitle', 1));
|
||
$this->extObjContent();
|
||
$this->content.=$this->doc->spacer(10);
|
||
... | ... | |
$lines = array();
|
||
$lines[] = '<tr class="bgColor5">
|
||
<td nowrap><strong>Page name</strong></td>
|
||
<td nowrap><strong># Templates</strong></td>
|
||
<td nowrap><strong>Is Root?</strong></td>
|
||
<td nowrap><strong>Is Ext?</strong></td>
|
||
<td nowrap><strong>'.$LANG->getLL('sys_template.pageName').'</strong></td>
|
||
<td nowrap><strong>'.$LANG->getLL('sys_template.templates').'</strong></td>
|
||
<td nowrap><strong>'.$LANG->getLL('sys_template.isRoot').'</strong></td>
|
||
<td nowrap><strong>'.$LANG->getLL('sys_template.isExt').'</strong></td>
|
||
</tr>';
|
||
$lines = array_merge($lines,$this->renderList($pArray));
|
||
$table = '<table border=0 cellpadding=0 cellspacing=1>'.implode("",$lines).'</table>';
|
||
$this->content = $this->doc->section($LANG->getLL('moduleTitle', 1), '
|
||
<br />
|
||
This is an overview of the pages in the database containing one or more template records. Click a page title to go to the page.
|
||
<br /><br />
|
||
'.$table);
|
||
$this->content = $this->doc->section($LANG->getLL('sys_template.moduleTitle', 1), $LANG->getLL('sys_template.recordsOverview').$table);
|
||
|
||
// ********************************************
|
||
// RENDER LIST of pages with templates, END
|
||
// ********************************************
|
||
... | ... | |
if ($this->id && $this->access) {
|
||
// View page
|
||
$buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" hspace="3" alt="" />' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" hspace="3" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" />' .
|
||
'</a>';
|
||
// If access to Web>List for user, then link to that module.
|
||
if ($BE_USER->check('modules','web_list')) {
|
||
$href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
|
||
$buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/list.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" />' .
|
||
'</a>';
|
||
}
|
||
... | ... | |
if(!empty($this->sObj)) {
|
||
// BACK
|
||
$buttons['back'] = '<a href="index.php?id=' . $this->id . '" class="typo3-goBack">' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/goback.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', 1) . '" alt="" />' .
|
||
'<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/goback.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', 1) . '" alt="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', 1) . '" />' .
|
||
'</a>';
|
||
}
|
||
}
|
||
... | ... | |
return $title;
|
||
}
|
||
function noTemplate($newStandardTemplate=0) {
|
||
global $SOBE;
|
||
global $SOBE, $LANG;
|
||
$tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global here!
|
||
$tmpl->tt_track = 0; // Do not log time-performance information
|
||
$tmpl->init();
|
||
$confirm = ' onClick="return confirm(\'Are you sure you want to do this?\');"';
|
||
|
||
$areSure = $LANG->getLL('sys_template.areSure');
|
||
$confirm = ' onClick="return confirm(\''.$areSure.'\');"';
|
||
// No template
|
||
$noTemplateTitle = $LANG->getLL('sys_template.noTemplateTitle');
|
||
$noTemplateDesc = $LANG->getLL('sys_template.createTemplateRecord');
|
||
|
||
$theOutput.=$this->doc->spacer(10);
|
||
$theOutput.=$this->doc->section('<span class="typo3-red">No template</span>',"There was no template on this page!<BR>Create a template record first in order to edit constants!",0,0,0,1);
|
||
$theOutput.=$this->doc->section('<span class="typo3-red">'.$noTemplateTitle.'</span>',$noTemplateDesc,0,0,0,1);
|
||
// New standard?
|
||
if ($newStandardTemplate) {
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('title,uid', 'static_template', '', '', 'title');
|
||
... | ... | |
}
|
||
}
|
||
$selector = '<select name="createStandard"><option></option>'.$opt.'</select>';
|
||
|
||
$createWebsiteTitle = $LANG->getLL('sys_template.createWebsiteTitle');
|
||
$createWebsiteDesc = $LANG->getLL('sys_template.createWebsiteDesc');
|
||
$createTemplateSubmit = $LANG->getLL('sys_template.createTemplateSubmit');
|
||
// Extension?
|
||
$theOutput.=$this->doc->spacer(10);
|
||
$theOutput.=$this->doc->section("Create new website",'If you want this page to be the root of a new website, optionally based on one of the standard templates, then press the button below:<BR>
|
||
<BR>
|
||
'.$selector.'<BR>
|
||
<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_warning.gif','width="18" height="16"') . ' hspace="5" align="top"><input type="Submit" name="newWebsite" value="Create template for a new site"'.$confirm.'>',0,1);
|
||
$theOutput.=$this->doc->section($createWebsiteTitle,$createWebsiteDesc.$selector.'<br /><img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_warning.gif','width="18" height="16"') . ' hspace="5" align="top"><input type="Submit" name="newWebsite" value="'.$createTemplateSubmit.'"'.$confirm.'>',0,1);
|
||
}
|
||
|
||
$createExtTemplateTitle = $LANG->getLL('sys_template.createExtTemplateTitle');
|
||
$createExtTemplateDesc = $LANG->getLL('sys_template.createExtTemplateDesc');
|
||
$createExtTemplateSubmit = $LANG->getLL('sys_template.createExtTemplateSubmit');
|
||
// Extension?
|
||
$theOutput.=$this->doc->spacer(10);
|
||
$theOutput.=$this->doc->section("Create extension template",'An extension template allows you to enter TypoScript values that will affect only this page and subpages.<BR><BR><img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_warning.gif','width="18" height="16"') . ' hspace="5" align="top"><input type="submit" name="createExtension" value="Click here to create an extension template."'.$confirm.'>',0,1);
|
||
$theOutput.=$this->doc->section($createExtTemplateTitle,$createExtTemplateDesc.'<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_warning.gif','width="18" height="16"') . ' hspace="5" align="top"><input type="submit" name="createExtension" value="'.$createExtTemplateSubmit.'"'.$confirm.'>',0,1);
|
||
|
||
// Go to first appearing...
|
||
$closestPageTitle = $LANG->getLL('sys_template.closestPageTitle');
|
||
$closestPageDesc = $LANG->getLL('sys_template.closestPageDesc');
|
||
|
||
$first = $tmpl->ext_prevPageWithTemplate($this->id,$this->perms_clause);
|
||
if ($first) {
|
||
$theOutput.=$this->doc->spacer(10);
|
||
$theOutput.=$this->doc->section("Go to closest page with template",sprintf("Closest template is on page '%s' (uid %s).<BR><BR>%s<strong>Click here to go.</strong>%s",$first["title"],$first["uid"],'<a href="index.php?id='.$first["uid"].'">','</a>'),0,1);
|
||
$theOutput.=$this->doc->section($closestPageTitle,sprintf($closestPageDesc,$first["title"],$first["uid"],'<a href="index.php?id='.$first["uid"].'">','</a>'),0,1);
|
||
}
|
||
return $theOutput;
|
||
}
|