2 /***************************************************************
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
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.
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.
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.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Contains class for "Sort pages" wizard
30 * Revised for TYPO3 3.6 July/2003 by Kasper Skårhøj
33 * @author Kasper Skårhøj <kasper@typo3.com>
36 * [CLASS/FUNCTION INDEX of SCRIPT]
40 * 67: class tx_wizardsortpages_webfunc_2 extends t3lib_extobjbase
41 * 77: function modMenu()
43 * 173: function wiz_linkOrder($title,$order)
46 * (This index is automatically created/updated by the extension "extdeveval")
50 require_once(PATH_t3lib
.'class.t3lib_page.php');
51 require_once(PATH_t3lib
.'class.t3lib_tcemain.php');
52 require_once(PATH_t3lib
.'class.t3lib_extobjbase.php');
61 * Creates the "Sort pages" wizard
63 * @author Kasper Skaarhoj <kasper@typo3.com>
65 * @subpackage tx_wizardsortpages
67 class tx_wizardsortpages_webfunc_2
extends t3lib_extobjbase
{
70 * Adds menu items... but I think this is not used at all. Looks very much like some testing code. If anyone cares to check it we can remove it some day...
79 'sort_blablabla' => array(
88 * Main function creating the content for the module.
90 * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
97 // check if user has modify permissions to
98 $sys_pages = t3lib_div
::makeInstance('t3lib_pageSelect');
99 $sortByField = t3lib_div
::_GP('sortByField');
102 if (t3lib_div
::inList('title,subtitle,crdate,tstamp',$sortByField)) {
103 $menuItems = $sys_pages->getMenu($this->pObj
->id
,'uid,pid,title',$sortByField);
104 } elseif ($sortByField=='REV') {
105 $menuItems = $sys_pages->getMenu($this->pObj
->id
,'uid,pid,title');
106 $menuItems = array_reverse($menuItems);
108 if (count($menuItems)) {
109 $tce = t3lib_div
::makeInstance('t3lib_TCEmain');
110 $tce->stripslashes_values
=0;
111 $menuItems = array_reverse($menuItems);
114 while(list(,$r)=each($menuItems)) {
115 $cmd['pages'][$r['uid']]['move']=$this->pObj
->id
;
117 $tce->start(array(),$cmd);
118 $tce->process_cmdmap();
119 t3lib_BEfunc
::getSetUpdateSignal('updatePageTree');
124 $menuItems = $sys_pages->getMenu($this->pObj
->id
);
128 <td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'),'title').'</b></td>
129 '.(t3lib_extMgm
::isLoaded('cms')?
'<td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'),'subtitle').'</b></td>':'').'
130 <td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'),'tstamp').'</b></td>
131 <td class="bgColor5"><b>'.$this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'),'crdate').'</b></td>
133 while(list(,$rec)=each($menuItems)) {
134 $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2); // edit permissions for that page!
135 $pRec = t3lib_BEfunc
::getRecord ('pages',$rec['uid'],'uid',' AND '.$m_perms_clause);
136 $lines[]= '<tr><td nowrap="nowrap">'.t3lib_iconWorks
::getIconImage('pages',$rec,$GLOBALS['BACK_PATH'],'align="top" '.t3lib_BEfunc
::titleAttribForPages($rec)).
137 (!is_array($pRec)?
$GLOBALS['TBE_TEMPLATE']->rfw('<b>'.$LANG->getLL('wiz_W',1).'</b> '):'').
138 htmlspecialchars(t3lib_div
::fixed_lgd_cs($rec['title'],$GLOBALS['BE_USER']->uc
['titleLen'])).' </td>
139 '.(t3lib_extMgm
::isLoaded('cms')?
'<td nowrap="nowrap">'.htmlspecialchars(t3lib_div
::fixed_lgd_cs($rec['subtitle'],$GLOBALS['BE_USER']->uc
['titleLen'])).' </td>':'').'
140 <td nowrap="nowrap">'.t3lib_Befunc
::datetime($rec['tstamp']).' </td>
141 <td nowrap="nowrap">'.t3lib_Befunc
::datetime($rec['crdate']).' </td>
145 $theCode.= '<b>'.$LANG->getLL('wiz_currentPageOrder',1).':</b><br /><br />
146 <table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table><br />';
148 if (count($menuItems)) {
151 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_title'),'title');
152 if (t3lib_extMgm
::isLoaded('cms')) $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_subtitle'),'subtitle');
153 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tChange'),'tstamp');
154 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_tCreate'),'crdate');
156 $lines[] = $this->wiz_linkOrder($LANG->getLL('wiz_changeOrder_REVERSE'),'REV');
157 $theCode.= '<b>'.$LANG->getLL('wiz_changeOrder').':</b><br /><br />'.implode('<br />',$lines);
161 $theCode.= t3lib_BEfunc
::cshItem('_MOD_web_func', 'tx_wizardsortpages', $GLOBALS['BACK_PATH'],'<br/>|');
163 $out=$this->pObj
->doc
->section($LANG->getLL('wiz_sort'),$theCode,0,1);
168 * Creates a link for the sorting order
170 * @param string Title of the link
171 * @param string Field to sort by
172 * @return string HTML string
174 function wiz_linkOrder($title,$order) {
175 return ' <a href="'.htmlspecialchars('index.php?id='.$GLOBALS['SOBE']->id
.'&sortByField='.$order).'" onclick="return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_changeOrder_msg1')).')">'.htmlspecialchars($title).'</a>';
179 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/wizard_sortpages/class.tx_wizardsortpages_webfunc_2.php']) {
180 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/wizard_sortpages/class.tx_wizardsortpages_webfunc_2.php']);