Skip to content
Snippets Groups Projects
Commit 73cf12c0 authored by Sergiu-Lucian Petrica's avatar Sergiu-Lucian Petrica
Browse files

Fixed file upload + multiple files at once

Also fixed issue where it wouldn't save jobs from the jobs module
parent db4bff21
No related branches found
No related tags found
1 merge request!1Feature/multi upload
......@@ -36,6 +36,7 @@ use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
......@@ -78,10 +79,6 @@ class BackendController extends ActionController {
try {
$pageUid = (int) GeneralUtility::_GP('id');
if ($pageUid) {
$this->rootPageUid = BackendService::getRootUidByPageUid($pageUid);
}
// create docheader + buttons
$pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1));
$this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);
......@@ -113,7 +110,6 @@ class BackendController extends ActionController {
$this->view->assign('locationOptions', $locationOptions);
$this->view->assign('filters', $filters);
$this->view->assign('pageUid', $pageUid);
$this->view->assign('rootPageUid', $this->rootPageUid);
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
} else {
$this->view->assign('noRecords', 1);
......
......@@ -29,6 +29,7 @@ namespace SGalinski\SgJobs\Controller;
use SGalinski\SgJobs\Service\BackendService;
use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Resource\DuplicationBehavior;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
......@@ -65,12 +66,14 @@ class JoblistController extends ActionController {
*/
public function indexAction() {
$pageUid = (int) GeneralUtility::_GP('id');
$rootPageId = BackendService::getRootUidByPageUid($pageUid);
$recordPageId = $this->configurationManager->getConfiguration(
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
)['persistence']['storagePid'];
$this->assignFilterValues($rootPageId);
$this->assignFilterValues($recordPageId);
// get all jobs for the next root page
$jobs = $this->jobRepository->findJobs($rootPageId);
$jobs = $this->jobRepository->findJobs($recordPageId);
$this->view->assign('jobs', $jobs);
}
......@@ -172,7 +175,7 @@ class JoblistController extends ActionController {
$keys = array_keys($_FILES[$namespace]);
foreach ($keys as $key) {
$_FILES['upload_' . $counter][$key] = $_FILES[$namespace][$key][$fieldName];
$_FILES['upload_' . $counter][$key] = $_FILES[$namespace][$key]['applyData'][$fieldName];
}
$data['upload'][$counter] = [
'data' => $counter,
......@@ -211,6 +214,7 @@ class JoblistController extends ActionController {
// Actual upload
$fileProcessor->start($data);
$fileProcessor->setExistingFilesConflictMode(DuplicationBehavior::CANCEL); // This was previously passed as empty string, why and from where? It breaks the upload if it's not set.
$result = $fileProcessor->processData();
// Do whatever you want with $result (array of File objects)
......
{namespace sg=SGalinski\SgJobs\ViewHelpers}
<div class="form-group">
<a href="#" class="btn btn-default" onclick="{sg:backend.editOnClick(table: 'tx_sgjobs_domain_model_job', uid: rootPageUid, new: 1)}">
<a href="#" class="btn btn-default" onclick="{sg:backend.editOnClick(table: 'tx_sgjobs_domain_model_job', uid: pageUid, new: 1)}">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-document-new">
<span class="icon-markup">
<img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/actions/actions-document-new.svg" width="16" height="16">
......
......@@ -19,11 +19,11 @@
<p>
</p>
<f:render partial="CreateJob" arguments="{rootPageUid:rootPageUid}" />
<f:render partial="CreateJob" arguments="{pageUid:pageUid}" />
</f:then>
<f:else>
<f:render partial="Filter" arguments="{filters: filters, locationOptions: locationOptions}" />
<f:render partial="CreateJob" arguments="{rootPageUid:rootPageUid}" />
<f:render partial="CreateJob" arguments="{pageUid:pageUid}" />
<f:if condition="{jobs}">
<f:then>
<f:render partial="JobList" arguments="{jobs: jobs}" />
......
......@@ -36,10 +36,10 @@
<f:form.textfield property="email" id="apply-email" data="{}" class="" />
<br />
<label for="apply-cover-letter"><f:translate key="frontend.apply.cover_letter" /></label>
<f:form.upload property="coverLetter" id="apply-cover-letter" />
<f:form.upload multiple="true" property="coverLetter" id="apply-cover-letter" />
<br />
<label for="apply-cv"><f:translate key="frontend.apply.cv" /></label>
<f:form.upload property="cv" id="apply-cv" />
<f:form.upload multiple="true" property="cv" id="apply-cv" />
<br />
<label for="apply-certificates"><f:translate key="frontend.apply.certificates" /></label>
<input id="apply-certificates" type="file" name="tx_sgjobs_joblist[applyData][certificates]" multiple />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment