This commit was manufactured by cvs2svn to create tag
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / media / scripts / freesite_dummy_page_menu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Dummy menu of templates/dummy pages on the FreeSite Application.
29 *
30 * This displays a menu with links to each dummy page set following the uid of the base template to use. Used for preview of the base templates.
31 * Required: The Freesite Application (extension: "freesite")
32 *
33 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
34 * XHTML compliant
35 *
36 * @author Kasper Skaarhoj <kasper@typo3.com>
37 */
38
39
40 if (!is_object($this)) {
41 die ('No cObj object present. This script must be included as a PHP_SCRIPT cObject in TypoScript!');
42 }
43
44 // Template
45 $pid = intval($conf['pid_templateArchive']);
46 $content = '';
47
48 $specialComment='';
49 if ($pid) {
50 // Select templates in root
51 // Does NOT take TSFE->showHiddenRecords into account!
52 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid='.intval($pid).' AND NOT deleted AND NOT hidden AND NOT starttime AND NOT endtime', '', 'sorting');
53 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
54 if (!$firstUID) $firstUID = $row['uid'];
55 $key = $row['uid'];
56 $val = $row['title'];
57 $content.= '<a target="testTemplate" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.'index.php?id='.$GLOBALS['TSFE']->id.'&based_on_uid='.$key).'">'.$val.'</a><br />';
58 $specialComment.= '[globalVar= based_on_uid='.$key.']'.chr(10);
59 }
60 // Select subcategories of template folder.
61 $page_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($pid).' AND NOT deleted AND NOT hidden AND NOT starttime AND NOT endtime AND NOT fe_group', '', 'sorting');
62 while($page_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($page_res)) {
63 // Subcategory templates
64 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid='.intval($page_row['uid']).' AND NOT deleted AND NOT hidden AND NOT starttime AND NOT endtime', '', 'sorting');
65 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
66 if (!$firstUID) $firstUID = $row['uid'];
67 $key = $row['uid'];
68 $val = $page_row['title'].' / '.$row['title'];
69 $content.= '<a target="testTemplate" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.'index.php?id='.$GLOBALS['TSFE']->id.'&based_on_uid='.$key).'">'.$val.'</a><br />';
70 $specialComment.= '[globalVar= based_on_uid='.$key.']'.chr(10);
71 }
72 }
73 }
74
75 $content.='
76 <!--
77
78 NOTE:
79 When updating the template archive, these TypoScript conditions should replace the current conditions found in the DUMMY PAGE test template:
80
81
82 '.$specialComment.'
83
84 -->
85 ';
86
87 ?>