21 use TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException;
82 parent::__construct();
103 if ($this->uid > 0) {
105 ->retrieveFileOrFolderObject(
'file:' . $this->uid);
107 if (!$this->fileOrFolderObject) {
108 $title =
$lang->sL(
'LLL:EXT:lang/locallang_mod_file_list.xlf:paramError',
true);
109 $message =
$lang->sL(
'LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir',
true);
110 throw new \RuntimeException(
$title .
': ' . $message, 1436895930);
112 if ($this->fileOrFolderObject->getStorage()->getUid() === 0) {
114 'You are not allowed to access files outside your storages',
123 if ($this->fileOrFolderObject instanceof
Folder) {
124 $parsedUrl = parse_url($this->returnUrl);
126 if ($queryParts[
'id'] === $this->fileOrFolderObject->getCombinedIdentifier()) {
127 $this->returnUrl = str_replace(
128 urlencode($queryParts[
'id']),
129 urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()),
136 'combined_identifier' => $this->fileOrFolderObject->getCombinedIdentifier(),
138 $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
139 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ClickMenu');
140 $this->moduleTemplate->addJavaScriptCode(
141 'ReplaceFileOnlineJavaScript',
142 'function backToList() {top.goToModule("file_FilelistList");}'
154 $code =
'<form action="'
155 . htmlspecialchars(BackendUtility::getModuleUrl(
'tce_file'))
156 .
'" role="form" method="post" name="editform" enctype="multipart/form-data">';
160 <div class="form-group">
161 <input type="checkbox" value="1" id="keepFilename" name="file[replace][1][keepFilename]"> <label for="keepFilename">'
162 .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:file_replace.php.keepfiletitle')
166 <div class="form-group">
167 <label for="file_replace">' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:file_replace.php.selectfile') .
'</label>
168 <div class="input-group col-xs-6">
169 <input type="text" name="fakefile" id="fakefile" class="form-control input-xlarge" readonly>
170 <a class="input-group-addon btn btn-primary" onclick="TYPO3.jQuery(\'#file_replace\').click();">'
171 .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:file_replace.php.browse')
174 <input class="form-control" type="file" id="file_replace" name="replace_1" style="visibility: hidden;" />
178 TYPO3.jQuery(\'#file_replace\').change(function(){
179 TYPO3.jQuery(\'#fakefile\').val(TYPO3.jQuery(this).val());
183 <input type="hidden" name="overwriteExistingFiles" value="replace" />
184 <input type="hidden" name="file[replace][1][data]" value="1" />
185 <input type="hidden" name="file[replace][1][uid]" value="' . $this->uid .
'" />
189 <div class="form-group">
190 <input class="btn btn-primary" type="submit" value="'
191 .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:file_replace.php.submit',
true) .
'" />
192 <input class="btn btn-danger" type="submit" value="'
193 .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.cancel',
true)
194 .
'" onclick="backToList(); return false;" />
195 <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) .
'" />
200 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
202 $cshButton = $buttonBar->makeHelpButton()
203 ->setModuleName(
'xMOD_csh_corebe')
204 ->setFieldName(
'file_rename');
205 $buttonBar->addButton($cshButton);
208 if ($this->returnUrl) {
209 $returnButton = $buttonBar->makeLinkButton()
211 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.goBack',
true))
212 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-view-go-back',
Icon::SIZE_SMALL));
213 $buttonBar->addButton($returnButton);
216 $this->content .=
'<h1>' .
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:file_replace.php.pagetitle') .
'</h1>';
218 $this->content .=
'<div>' . $code .
'</div>';
220 $this->moduleTemplate->setContent($this->content);
234 $response->
getBody()->write($this->moduleTemplate->renderContent());