Project

General

Profile

Feature #18148 » filelist-1.3.diff

Administrator Admin, 2008-02-27 19:16

View differences:

typo3/file_list.php (working copy)
require_once (PATH_t3lib.'class.t3lib_extfilefunc.php');
require_once (PATH_t3lib.'class.t3lib_recordlist.php');
require_once (PATH_t3lib.'class.t3lib_clipboard.php');
require_once (PATH_t3lib.'class.t3lib_parsehtml.php');
require_once ('class.file_list.inc');
$BE_USER->modAccess($MCONF,1);
......
// Initialize the template object
$this->doc = t3lib_div::makeInstance('template');
$this->doc->backPath = $BACK_PATH;
$this->doc->setModuleTemplate('templates/file_list.html');
$this->doc->docType = 'xhtml_trans';
// Validating the input "id" (the path, directory!) and checking it against the mounts of the user.
......
if ($access) {
// Create filelisting object
$filelist = t3lib_div::makeInstance('fileList');
$filelist->backPath = $BACK_PATH;
$filelist->thumbs = $this->MOD_SETTINGS['displayThumbs']?1:$BE_USER->uc['thumbnailsByDefault'];
$this->filelist = t3lib_div::makeInstance('fileList');
$this->filelist->backPath = $BACK_PATH;
$this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs']?1:$BE_USER->uc['thumbnailsByDefault'];
// Create clipboard object and initialize that
$filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
$filelist->clipObj->fileMode=1;
$filelist->clipObj->initializeClipboard();
$this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
$this->filelist->clipObj->fileMode=1;
$this->filelist->clipObj->initializeClipboard();
$CB = t3lib_div::_GET('CB');
if ($this->cmd=='setCB') $CB['el'] = $filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'),t3lib_div::_POST('CBC')),'_FILE');
if ($this->cmd=='setCB') $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'),t3lib_div::_POST('CBC')),'_FILE');
if (!$this->MOD_SETTINGS['clipBoard']) $CB['setP']='normal';
$filelist->clipObj->setCmd($CB);
$filelist->clipObj->cleanCurrent();
$filelist->clipObj->endClipboard(); // Saves
$this->filelist->clipObj->setCmd($CB);
$this->filelist->clipObj->cleanCurrent();
$this->filelist->clipObj->endClipboard(); // Saves
// If the "cmd" was to delete files from the list (clipboard thing), do that:
if ($this->cmd=='delete') {
$items = $filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'),'_FILE',1);
$items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'),'_FILE',1);
if (count($items)) {
// Make command array:
$FILE=array();
......
// Start up filelisting object, include settings.
$this->pointer = t3lib_div::intInRange($this->pointer,0,100000);
$filelist->start($this->id,$this->pointer,$this->MOD_SETTINGS['sort'],$this->MOD_SETTINGS['reverse'],$this->MOD_SETTINGS['clipBoard']);
$this->filelist->start($this->id,$this->pointer,$this->MOD_SETTINGS['sort'],$this->MOD_SETTINGS['reverse'],$this->MOD_SETTINGS['clipBoard']);
// Write the header
$filelist->writeTop($this->id);
// Generate the list
$filelist->generateList();
$this->filelist->generateList();
// Write the footer
$filelist->writeBottom();
$this->filelist->writeBottom();
// Set top JavaScript:
$this->doc->JScode=$this->doc->wrapScriptTags('
......
window.location.href = URL;
}
'.$filelist->CBfunctions() // ... and add clipboard JavaScript functions
'.$this->filelist->CBfunctions() // ... and add clipboard JavaScript functions
);
// This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
$this->doc->getContextMenuCode();
// Setting up the buttons and markers for docheader
list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->id);
// add the folder info to the marker array
$otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo();
$docHeaderButtons = array_merge($this->getButtons(), $buttons);
// Build the <body> for the module
$this->content = $this->doc->startPage('Template Tools');
// Create output
$this->content='';
$this->content.=$this->doc->startPage($LANG->getLL('files'));
$this->content.= '<form action="'.htmlspecialchars($filelist->listURL()).'" method="post" name="dblistForm">';
$this->content.= $filelist->HTMLcode;
$this->content.= '<input type="hidden" name="cmd" /></form>';
// FileList Module CSH:
$this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'],'<br/>|');
$this->content.='
<!--
"Upload" and "New" buttons
-->
<div id="typo3-filelist-buttons">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td>
<form name="upload" action="'.$BACK_PATH.'file_upload.php">
<input type="hidden" name="target" value="'.htmlspecialchars($this->id).'" />
<input type="hidden" name="returnUrl" value="'.htmlspecialchars($filelist->listURL()).'" />
<input type="submit" value="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.upload',1)).'" />
</form>
</td>
<td>
<form name="new" action="'.$BACK_PATH.'file_newfolder.php">
<input type="hidden" name="target" value="'.htmlspecialchars($this->id).'" />
<input type="hidden" name="returnUrl" value="'.htmlspecialchars($filelist->listURL()).'" />
<input type="submit" value="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new',1)).'" />
</form>
</td>
</tr>
</table>
</div>
';
if ($filelist->HTMLcode) { // Making listing options:
$this->content.='
$pageContent='';
$pageContent.=$this->doc->startPage($LANG->getLL('files'));
$pageContent.= '<form action="'.htmlspecialchars($this->filelist->listURL()).'" method="post" name="dblistForm">';
$pageContent.= $this->filelist->HTMLcode;
$pageContent.= '<input type="hidden" name="cmd" /></form>';
if ($this->filelist->HTMLcode) { // Making listing options:
$pageContent.='
<!--
Listing options for clipboard and thumbnails
-->
<div id="typo3-listOptions">
';
// Add "display thumbnails" checkbox:
$this->content.=t3lib_BEfunc::getFuncCheck($this->id,'SET[displayThumbs]',$this->MOD_SETTINGS['displayThumbs'],'file_list.php','','id="checkDisplayThumbs"').' <label for="checkDisplayThumbs">'.$LANG->getLL('displayThumbs',1).'</label><br />';
$pageContent.=t3lib_BEfunc::getFuncCheck($this->id,'SET[displayThumbs]',$this->MOD_SETTINGS['displayThumbs'],'file_list.php','','id="checkDisplayThumbs"').' <label for="checkDisplayThumbs">'.$LANG->getLL('displayThumbs',1).'</label><br />';
// Add clipboard button
$this->content.=t3lib_BEfunc::getFuncCheck($this->id,'SET[clipBoard]',$this->MOD_SETTINGS['clipBoard'],'file_list.php','','id="checkClipBoard"').' <label for="checkClipBoard">'.$LANG->getLL('clipBoard',1).'</label>';
$this->content.='
$pageContent.=t3lib_BEfunc::getFuncCheck($this->id,'SET[clipBoard]',$this->MOD_SETTINGS['clipBoard'],'file_list.php','','id="checkClipBoard"').' <label for="checkClipBoard">'.$LANG->getLL('clipBoard',1).'</label>';
$pageContent.='
</div>
';
$this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_options', $GLOBALS['BACK_PATH']);
// Set clipboard:
if ($this->MOD_SETTINGS['clipBoard']) {
$this->content.=$filelist->clipObj->printClipboard();
$this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']);
$pageContent.=$this->filelist->clipObj->printClipboard();
$pageContent.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']);
}
}
$markerArray = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
'CONTENT' => $pageContent
);
// Add shortcut
if ($BE_USER->mayMakeShortcut()) {
$this->content.='<br /><br />'.$this->doc->makeShortcutIcon('pointer,id,target,table',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']);
}
$this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
} else {
// Create output - no access (no warning though)
$this->content='';
$this->content.=$this->doc->startPage($LANG->getLL('files'));
$this->content = '';
$this->content .= $this->doc->startPage($LANG->getLL('files'));
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
}
/**
......
* @return void
*/
function printContent() {
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
}
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*
* @return array all available buttons as an assoc. array
*/
function getButtons() {
global $TCA, $LANG, $BACK_PATH, $BE_USER;
$buttons = array(
'csh' => '',
'shortcut' => '',
'upload' => '',
'new' => '',
);
// Add shortcut
if ($BE_USER->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']);
}
// FileList Module CSH:
$buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH']);
// upload button
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/upload.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.upload',1)).'" alt="" />';
$buttons['upload'] = '<a href="'.$BACK_PATH.'file_upload.php?target='.htmlspecialchars($this->id).'&returnUrl='.htmlspecialchars($this->filelist->listURL()).'">'.$theIcon.'</a>';
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_file.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new',1)).'" alt="" />';
$buttons['new'] = '<a href="'.$BACK_PATH.'file_newfolder.php?target='.htmlspecialchars($this->id).'&returnUrl='.htmlspecialchars($this->filelist->listURL()).'">'.$theIcon.'</a>';
return $buttons;
}
}
// Include extension?
typo3/class.file_list.inc (working copy)
}
/**
* Make the top of the list
* Return the buttons used by the file list to include in the top header
*
* @param string The path to list.
* @return void
* @return array
*/
function writeTop($path) {
function getButtonsAndOtherMarkers($path) {
// Makes the code for the foldericon in the top
$path = $GLOBALS['SOBE']->basicFF->is_directory($path); // Cleaning name...
if ($path) {
$out='';
$otherMarkers = array(
'PAGE_ICON' => '',
'TITLE' => '',
);
$buttons = array(
'level_up' => '',
'refresh' => '',
'title' => '',
'page_icon' => '',
);
$theFile = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($path);
$root = $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($theFile['path']);
$titleCol='path';
$this->fieldArray = Array($titleCol,'up');
list($title,$icon,$path) = $this->dirData($theFile);
// Start compiling the HTML
$theData = Array();
$theData[$titleCol] = $this->widthGif;
$title = $GLOBALS['SOBE']->basicFF->blindPath($path);
$theData['up']='<a href="'.htmlspecialchars($this->listURL()).'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/refresh_n.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload',1).'" alt="" />'.
'</a>';
if ($root) {
// if this is some subpage under the mount root....
if ($GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($theFile['path'])) {
// The icon with link
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$path);
$otherMarkers['PAGE_ICON'] = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
if ($this->clickMenus) $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'],$path);
$theData[$titleCol].='<br />'.t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)); // No HTML specialchars here - HTML like <b> </b> is allowed
$theData['up'].=$this->linkWrapDir('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/folder_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" />',$theFile['path']);
$buttons['level_up'] .= $this->linkWrapDir('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/folder_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" />',$theFile['path']);
$otherMarkers['TITLE'] .= t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)); // No HTML specialchars here - HTML like <b> </b> is allowed
// this is the root page
} else {
// root:0
$theIcon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_ftp.gif','width="18" height="16"').' alt="" />';
$theData[$titleCol].='<br />'.htmlspecialchars(t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)));
$otherMarkers['PAGE_ICON'] = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_ftp.gif','width="18" height="16"').' alt="" />';
if ($this->clickMenus) $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'],$path);
$otherMarkers['TITLE'] .= htmlspecialchars(t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)));
}
// Adding top element
$out.=$this->addelement(1,'',$theData,'','',$theIcon);
$this->HTMLcode.='
<!--
Page header for file list
-->
<table border="0" cellpadding="0" cellspacing="0" id="typo3-filelist-top">
'.$out.'
</table>';
}
$buttons['refresh'] = '<a href="'.htmlspecialchars($this->listURL()).'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/refresh_n.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload',1).'" alt="" />'.
'</a>';
return array($buttons, $otherMarkers);
}
/**
......
$out.=$iOut;
// half line is drawn
$theData = Array();
$theData[$titleCol] = $this->counter.' File(s), '.t3lib_div::formatSize($this->totalbytes).'bytes';
$out.=$this->addelement(1,'',$theData);
// finish
return '
......
}
/**
* Gets the number of files and total size of a folder
*
* @return string
**/
function getFolderInfo() {
if($this->counter == 1) {
$fileLabel = 'File';
} else {
$fileLabel = 'Files';
}
return $this->counter.' '.$fileLabel.', '.t3lib_div::formatSize($this->totalbytes).'bytes';
}
/**
* This returns tablerows for the directories in the array $items['sorting'].
*
* @param array Directory items
typo3/file_rename.php (working copy)
require('init.php');
require('template.php');
require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
......
/**
* Script Class for the rename-file form.
*
......
default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
}
$this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
// Relative path to filemount, $key:
$this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
// Setting title:
$this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
$this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
// Setting template object
$this->doc = t3lib_div::makeInstance('smallDoc');
$this->doc = t3lib_div::makeInstance('template');
$this->doc->docType = 'xhtml_trans';
$this->doc->setModuleTemplate('templates/file_rename.html');
$this->doc->backPath = $BACK_PATH;
$this->doc->form='<form action="tce_file.php" method="post" name="editform">';
$this->doc->JScode=$this->doc->wrapScriptTags('
function backToList() { //
top.goToModule("file_list");
......
global $LANG;
// Make page header:
$this->content='';
$this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
$this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
$this->content.=$this->doc->spacer(5);
$this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
$this->content.=$this->doc->divider(5);
$this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
$pageContent = $this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
$pageContent .= $this->doc->spacer(5);
$pageContent .= $this->doc->divider(5);
$code = '<form action="tce_file.php" method="post" name="editform">';
// Making the formfields for renaming:
$code='
$code .= '
<div id="c-rename">
<input type="text" name="file[rename][0][data]" value="'.htmlspecialchars(basename($this->shortPath)).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />
......
</div>
';
// CSH:
$code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH'],'<br/>');
// Add the HTML as a section:
$this->content.= $this->doc->section('',$code);
$pageContent .= $code;
$docHeaderButtons = array();
$docHeaderButtons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']);
// Add the HTML as a section:
$markerArray = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
'CONTENT' => $pageContent,
'PATH' => $this->title,
);
$this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
......
* @return void
*/
function printContent() {
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
}
}
typo3/file_newfolder.php (working copy)
require('init.php');
require('template.php');
require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
......
/**
* Script Class for the create-new script; Displays a form for creating up to 10 folders or one new text file
*
......
default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
}
$this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
// Relative path to filemount, $key:
$this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
// Setting title:
$this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
$this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
// Setting template object
$this->doc = t3lib_div::makeInstance('smallDoc');
$this->doc = t3lib_div::makeInstance('template');
$this->doc->docType = 'xhtml_trans';
$this->doc->setModuleTemplate('templates/file_newfolder.html');
$this->doc->backPath = $BACK_PATH;
$this->doc->form='<form action="tce_file.php" method="post" name="editform">';
$this->doc->JScode=$this->doc->wrapScriptTags('
var path = "'.$this->target.'";
......
*/
function main() {
global $LANG;
// start content compilation
$this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
// Make page header:
$this->content='';
$this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
$this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
$this->content.=$this->doc->spacer(5);
$this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
$this->content.=$this->doc->divider(5);
$pageContent='';
$pageContent.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
$pageContent.=$this->doc->spacer(5);
$pageContent.=$this->doc->divider(5);
$code = '<form action="tce_file.php" method="post" name="editform">';
// Making the selector box for the number of concurrent folder-creations
$this->number = t3lib_div::intInRange($this->number,1,10);
$code='
$code .= '
<div id="c-select">
<select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
for ($a=1;$a<=$this->folderNumber;$a++) {
......
// CSH:
$code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'],'<br/>');
$this->content.= $this->doc->section('',$code);
$pageContent.= $code;
// Add spacer:
$this->content.= $this->doc->spacer(10);
$pageContent.= $this->doc->spacer(10);
// Switching form tags:
$this->content.= $this->doc->sectionEnd();
$this->content.= '</form><form action="tce_file.php" method="post" name="editform2">';
$pageContent.= $this->doc->sectionEnd();
$pageContent.= '</form><form action="tce_file.php" method="post" name="editform2">';
// Add form fields for creation of a new, blank text file:
$code='
......
// CSH:
$code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'],'<br/>');
$pageContent.= $this->doc->section($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.newfile'),$code);
$docHeaderButtons = array();
// Add the HTML as a section:
$this->content.= $this->doc->section($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.newfile'),$code);
$markerArray = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
'CONTENT' => $pageContent,
'PATH' => $this->title,
);
$this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
......
* @return void
*/
function printContent() {
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
}
}
typo3/file_edit.php (working copy)
require('init.php');
require('template.php');
require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
......
/**
* Script Class for rendering the file editing screen
*
......
case 'group': $this->icon = 'gfx/i/_icon_ftp_group.gif'; break;
default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
}
$this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
// Relative path to filemount, $key:
$this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
$this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
// Setting title:
$this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
// ***************************
// Setting template object
// ***************************
$this->doc = t3lib_div::makeInstance('template');
$this->doc->docType = 'xhtml_trans';
$this->doc->setModuleTemplate('templates/file_edit.html');
$this->doc->backPath = $BACK_PATH;
$this->doc->JScode=$this->doc->wrapScriptTags('
function backToList() { //
......
*/
function main() {
global $BE_USER, $LANG, $TYPO3_CONF_VARS;
$docHeaderButtons = $this->getButtons();
$this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
$this->content='';
$this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
$this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
$this->content.=$this->doc->spacer(5);
$this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
$this->content.=$this->doc->divider(5);
$pageContent = $this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
$pageContent .= $this->doc->spacer(2);
$fI = pathinfo($this->target);
$extList=$TYPO3_CONF_VARS['SYS']['textfile_ext'];
......
// making the formfields
$hValue = 'file_edit.php?target='.rawurlencode($this->origTarget).'&returnUrl='.rawurlencode($this->returnUrl);
$code = '';
$code.='
<div id="c-submit">
<input type="hidden" name="redirect" value="'.htmlspecialchars($hValue).'" />
<input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.submit',1).'" />
<input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.saveAndClose',1).'" onclick="document.editform.redirect.value=\''.htmlspecialchars($this->returnUrl).'\';" />
<input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
</div>
';
// Edit textarea:
$code.='
......
t3lib_div::formatForTextarea($fileContent).
'</textarea>
<input type="hidden" name="file[editfile][0][target]" value="'.$this->target.'" />
<input type="hidden" name="redirect" value="'.htmlspecialchars($hValue).'" />
</div>
<br />';
// CSH:
$code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_edit', $GLOBALS['BACK_PATH'],'|<br/>');
// Make shortcut:
if ($BE_USER->mayMakeShortcut()) {
$this->MCONF['name']='xMOD_file_edit.php';
$code.= '<br />'.$this->doc->makeShortcutIcon('target','',$this->MCONF['name'],1);
$docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target','',$this->MCONF['name'],1);
}
} else {
$code.=sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.coundNot'), $extList);
}
// Ending of section and outputting editing form:
$this->content.= $this->doc->sectionEnd();
$this->content.=$code;
$pageContent.= $this->doc->sectionEnd();
$pageContent.=$code;
// Add the HTML as a section:
$markerArray = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
'BUTTONS' => $docHeaderButtons,
'CONTENT' => $pageContent,
'PATH' => $this->title,
);
$this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
......
* @return void
*/
function printContent() {
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
}
/**
* Builds the buttons for the docheader and returns them as an array
*
* @return array
**/
function getButtons() {
$buttons = array();
// CSH button
$buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_edit', $GLOBALS['BACK_PATH']);
// Save button
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/savedok.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.submit',1)).'" alt="" />';
$buttons['SAVE'] = '<a href="#" onclick="document.editform.submit();">'.$theIcon.'</a>';
// Save and Close button
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/saveandclosedok.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.saveAndClose',1)).'" alt="" />';
$buttons['SAVE_CLOSE'] = '<a href="#" onclick="document.editform.redirect.value=\''.htmlspecialchars($this->returnUrl).'\'; document.editform.submit();">'.$theIcon.'</a>';
// Cancel button
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/closedok.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1)).'" alt="" />';
$buttons['CANCEL'] = '<a href="#" onclick="backToList(); return false;">'.$theIcon.'</a>';
return $buttons;
}
}
// Include extension?
typo3/stylesheet.css (working copy)
body#typo3-alt-doc-php, body#typo3-db-list-php, body#ext-cms-layout-db-layout-php, body#ext-tstemplate-ts-index-php, body#typo3-mod-web-perm-index-php, body#typo3-mod-web-info-index-php, body#typo3-mod-web-func-index-php, body#ext-version-cm1-index-php, body#ext-setup-mod-index-php, body#typo3-mod-user-ws-index-php, body#typo3-mod-user-ws-workspaceforms-php, body#typo3-mod-php, body#ext-tsconfig-help-mod1-index-php, body#typo3-mod-tools-em-index-php, body#ext-lowlevel-dbint-index-php, body#ext-lowlevel-config-index-php { padding: 0; margin: 0; overflow: hidden; height: 100%; }
/* Set body styles for Filelist module */
BODY#typo3-file-newfolder-php, BODY#typo3-file-list-php, BODY#typo3-file-edit-php, BODY#typo3-file-rename-php, BODY#typo3-file-upload-php { margin: 0;}
/****************************************
* SPECIFIC WRAPPERS
typo3/templates/file_upload.html (revision 0)
<!-- ###FULLDOC### begin -->
<div class="typo3-fullDoc">
<!-- Page header with buttons, path details and csh -->
<div id="typo3-docheader">
<div id="typo3-docheader-row1">
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
<div class="buttonsright">###BUTTONLIST_RIGHT######FUNC_MENU###</div>
</div>
<div id="typo3-docheader-row2">
<div class="pagepath">###PATH###</div>
<div class="infooptions"></div>
</div>
</div>
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
###CONTENT###
</div>
</div>
<!-- ###FULLDOC### end -->
<!-- Grouping the icons on top -->
<!-- ###BUTTON_GROUP_WRAP### -->
<div class="buttongroup">###BUTTONS###</div>
<!-- ###BUTTON_GROUP_WRAP### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUP4### --><!-- ###BUTTON_GROUP4### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
<!-- ###BUTTON_GROUP1### --><!-- ###BUTTON_GROUP1### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
typo3/templates/file_edit.html (revision 0)
<!-- ###FULLDOC### begin -->
<div class="typo3-fullDoc">
<!-- Page header with buttons, path details and csh -->
<div id="typo3-docheader">
<div id="typo3-docheader-row1">
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
<div class="buttonsright">###BUTTONLIST_RIGHT######FUNC_MENU###</div>
</div>
<div id="typo3-docheader-row2">
<div class="pagepath">###CSH###&nbsp;###PATH###</div>
<div class="infooptions"></div>
</div>
</div>
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
###CONTENT###
</div>
</div>
<!-- ###FULLDOC### end -->
<!-- Grouping the icons on top -->
<!-- ###BUTTON_GROUP_WRAP### -->
<div class="buttongroup">###BUTTONS###</div>
<!-- ###BUTTON_GROUP_WRAP### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUP4### -->###SAVE######SAVE_CLOSE######CANCEL###<!-- ###BUTTON_GROUP4### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
<!-- ###BUTTON_GROUP1### -->###SHORTCUT###<!-- ###BUTTON_GROUP1### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
typo3/templates/file_newfolder.html (revision 0)
<!-- ###FULLDOC### begin -->
<div class="typo3-fullDoc">
<!-- Page header with buttons, path details and csh -->
<div id="typo3-docheader">
<div id="typo3-docheader-row1">
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
<div class="buttonsright">###BUTTONLIST_RIGHT######FUNC_MENU###</div>
</div>
<div id="typo3-docheader-row2">
<div class="pagepath">###PATH###</div>
<div class="infooptions"></div>
</div>
</div>
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
###CONTENT###
</div>
</div>
<!-- ###FULLDOC### end -->
<!-- Grouping the icons on top -->
<!-- ###BUTTON_GROUP_WRAP### -->
<div class="buttongroup">###BUTTONS###</div>
<!-- ###BUTTON_GROUP_WRAP### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUP4### --><!-- ###BUTTON_GROUP4### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
<!-- ###BUTTON_GROUP1### --><!-- ###BUTTON_GROUP1### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
typo3/templates/file_rename.html (revision 0)
<!-- ###FULLDOC### begin -->
<div class="typo3-fullDoc">
<!-- Page header with buttons, path details and csh -->
<div id="typo3-docheader">
<div id="typo3-docheader-row1">
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
<div class="buttonsright">###BUTTONLIST_RIGHT######FUNC_MENU###</div>
</div>
<div id="typo3-docheader-row2">
<div class="pagepath">###CSH###&nbsp;###PATH###</div>
<div class="infooptions"></div>
</div>
</div>
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
###CONTENT###
</div>
</div>
<!-- ###FULLDOC### end -->
<!-- Grouping the icons on top -->
<!-- ###BUTTON_GROUP_WRAP### -->
<div class="buttongroup">###BUTTONS###</div>
<!-- ###BUTTON_GROUP_WRAP### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUP4### --><!-- ###BUTTON_GROUP4### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
<!-- ###BUTTON_GROUP1### --><!-- ###BUTTON_GROUP1### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
typo3/templates/file_list.html (revision 0)
<!-- ###FULLDOC### begin -->
<div class="typo3-fullDoc">
<!-- Page header with buttons, path details and csh -->
<div id="typo3-docheader">
<div id="typo3-docheader-row1">
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
<div class="buttonsright">###BUTTONLIST_RIGHT######FUNC_MENU###</div>
</div>
<div id="typo3-docheader-row2">
<div class="pagepath">###CSH######TITLE###</div>
<div class="infooptions">###FOLDER_INFO###&nbsp;###PAGE_ICON###</div>
</div>
</div>
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
###CONTENT###
</div>
</div>
<!-- ###FULLDOC### end -->
<!-- Grouping the icons on top -->
<!-- ###BUTTON_GROUP_WRAP### -->
<div class="buttongroup">###BUTTONS###</div>
<!-- ###BUTTON_GROUP_WRAP### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUP4### -->###UPLOAD######NEW###<!-- ###BUTTON_GROUP4### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
<!-- ###BUTTON_GROUP1### -->###REFRESH######LEVEL_UP######SHORTCUT###<!-- ###BUTTON_GROUP1### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
typo3/file_upload.php (working copy)
require('template.php');
$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
......
/**
* Script Class for display up to 10 upload fields
*
......
default: $this->icon = 'gfx/i/_icon_ftp.gif'; break;
}
$this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
// Relative path to filemount, $key:
$this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
// Setting title:
$this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
$this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
// Setting template object
$this->doc = t3lib_div::makeInstance('smallDoc');
$this->doc = t3lib_div::makeInstance('template');
$this->doc->docType = 'xhtml_trans';
$this->doc->setModuleTemplate('templates/file_upload.html');
$this->doc->backPath = $BACK_PATH;
$this->doc->form='<form action="tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">';
if($GLOBALS['BE_USER']->jsConfirmation(1)) {
$confirm = ' && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).')';
......
global $LANG;
// Make page header:
$this->content='';
$this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
$this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
$this->content.=$this->doc->spacer(5);
$this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
$this->content.=$this->doc->divider(5);
$this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
$pageContent.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
$pageContent.=$this->doc->spacer(5);
$pageContent.=$this->doc->divider(5);
$code = '<form action="tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">';
// Making the selector box for the number of concurrent uploads
$this->number = t3lib_div::intInRange($this->number,1,10);
$code='
$code .= '
<div id="c-select">
<select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
for ($a=1;$a<=$this->uploadNumber;$a++) {
......
$code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_upload', $GLOBALS['BACK_PATH'],'<br/>');
// Add the HTML as a section:
$this->content.= $this->doc->section('',$code);
$pageContent.= $this->doc->section('',$code);
$docHeaderButtons = array();
// Add the HTML as a section:
$markerArray = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
'CONTENT' => $pageContent,
'PATH' => $this->title,
);
$this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
......
* @return void
*/
function printContent() {
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
}
}
(5-5/5)