Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00050 require_once(PATH_t3lib.'class.t3lib_page.php'); 00051 require_once(PATH_t3lib.'class.t3lib_tcemain.php'); 00052 require_once(PATH_t3lib.'class.t3lib_extobjbase.php'); 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00070 class tx_wizardcrpages_webfunc_2 extends t3lib_extobjbase { 00071 00078 function modMenu() { 00079 global $LANG; 00080 00081 $modMenuAdd = array( 00082 'cr_333' => array( 00083 '0' => 'nul', 00084 '1' => 'et' 00085 ) 00086 ); 00087 return $modMenuAdd; 00088 } 00089 00095 function main() { 00096 global $SOBE,$LANG; 00097 00098 $theCode=''; 00099 00100 $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8); // create new pages here? 00101 $pRec = t3lib_BEfunc::getRecord ('pages',$this->pObj->id,'uid',' AND '.$m_perms_clause); 00102 $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect'); 00103 $menuItems = $sys_pages->getMenu($this->pObj->id); 00104 if (is_array($pRec)) { 00105 $data = t3lib_div::_GP('data'); 00106 if (is_array($data['pages'])) { 00107 if (t3lib_div::_GP('createInListEnd')) { 00108 $endI = end($menuItems); 00109 $thePid = -intval($endI['uid']); 00110 if (!$thePid) $thePid = $this->pObj->id; 00111 } else { 00112 $thePid = $this->pObj->id; 00113 } 00114 00115 while(list($k,$dat)=each($data['pages'])) { 00116 if (!trim($dat['title'])) { 00117 unset($data['pages'][$k]); 00118 } else { 00119 $data['pages'][$k]['pid']=$thePid; 00120 $data['pages'][$k]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0; 00121 } 00122 } 00123 if (count($data['pages'])) { 00124 reset($data); 00125 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00126 $tce->stripslashes_values=0; 00127 $tce->reverseOrder=1; 00128 $tce->start($data,array()); 00129 $tce->process_datamap(); 00130 t3lib_BEfunc::getSetUpdateSignal('updatePageTree'); 00131 } else { 00132 $theCode.=$GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_noCreate').'<br /><br />'); 00133 } 00134 00135 // Display result: 00136 $menuItems = $sys_pages->getMenu($this->pObj->id); 00137 reset($menuItems); 00138 $lines=array(); 00139 while(list(,$rec)=each($menuItems)) { 00140 $lines[]= '<nobr>'.t3lib_iconWorks::getIconImage('pages',$rec,$GLOBALS['BACK_PATH'],'align="top" '.t3lib_BEfunc::titleAttribForPages($rec)). 00141 htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'],$GLOBALS['BE_USER']->uc['titleLen'])).'</nobr>'; 00142 } 00143 $theCode.= '<b>'.$LANG->getLL('wiz_newPages_currentMenu').':</b><br /><br />'.implode('<br />',$lines); 00144 } else { 00145 // Create loremIpsum code: 00146 if (t3lib_extMgm::isLoaded('lorem_ipsum')) { 00147 $loremIpsumObj = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz'); 00148 } 00149 // Display create form 00150 $lines = array(); 00151 for ($a=0;$a<9;$a++) { 00152 $lines[] = $LANG->getLL('wiz_newPages_page').' '.($a+1). 00153 ': <input type="text" name="data[pages][NEW'.$a.'][title]"'.$this->pObj->doc->formWidth(35).' />'. 00154 (is_object($loremIpsumObj) ? '<a href="#" onclick="'.htmlspecialchars($loremIpsumObj->getHeaderTitleJS('document.forms[0][\'data[pages][NEW'.$a.'][title]\'].value', 'title')).'">'.$loremIpsumObj->getIcon('',$this->pObj->doc->backPath).'</a>' : ''); 00155 } 00156 00157 $theCode.= '<b>'.$LANG->getLL('wiz_newPages').':</b><br /><br />'.implode('<br />',$lines). 00158 '<br /><br /> 00159 <input type="checkbox" name="createInListEnd" value="1" />'.$LANG->getLL('wiz_newPages_listEnd').'<br /> 00160 <input type="checkbox" name="hidePages" value="1" />'.$LANG->getLL('wiz_newPages_hidePages').'<br /> 00161 <input type="submit" name="create" value="'.$LANG->getLL('wiz_newPages_lCreate').'" onclick="return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')).')"> <input type="reset" value="'.$LANG->getLL('wiz_newPages_lReset').'" />'; 00162 } 00163 } else { 00164 $theCode.=$GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1')); 00165 } 00166 00167 // CSH 00168 $theCode.= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'],'<br/>|'); 00169 00170 $out=$this->pObj->doc->section($LANG->getLL('wiz_crMany'),$theCode,0,1); 00171 return $out; 00172 } 00173 00179 function helpBubble() { 00180 return '<img src="'.$GLOBALS['BACK_PATH'].'gfx/helpbubble.gif" width="14" height="14" hspace="2" align="top"'.$this->pObj->doc->helpStyle().' alt="" />'; 00181 } 00182 } 00183 00184 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wizard_crpages/class.tx_wizardcrpages_webfunc_2.php']) { 00185 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/wizard_crpages/class.tx_wizardcrpages_webfunc_2.php']); 00186 } 00187 ?>