Project

General

Profile

Actions

Feature #20203

closed

Make tce_file usable via AJAX

Added by Benni Mack over 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2009-03-18
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.2
Tags:
Complexity:
Sprint Focus:

Description

Right now, the tce_file "gateway" is a small script in typo3/tce_file.php that handles all file operations, including the upload function in the file list and the main backend. It is not possible right now to call this file via AJAX in a clean way due to some restrictions:

  • typo3/tce_file.php includes the main class for handling the Get/post data from outside as well as the output of error messages and the execution of each task (e.g. a redirect after the execution of the file operations). To properly access the functions without executing them all, the class should be extracted in a separate file (typo3/classes/class.typo3_tcefile.php). We loose the XCLASSes but I don't care so much in this case (it's not a main function, I don't know a single extension that XCLASSes this class).
  • Error messages that the "extfilefunctions" class writes to the DB cannot be properly extracted currently, so I added a new function to only fetch the errors from the DB and moved that part from the template generation
  • It is not possible to fetch the results from each processData() call, therefore I introduced an array that summons these values and returns them at the end of the "processData" call. This way the AJAX call can e.g. return the final filename of the uploaded file.
  • When using AJAX calls, we deal with Javascript (which always sends UTF-8 requests and for us, also file names), so there is the need for a charset conversion of the file uploads in extfilefunctions, which is now done via a separate array key in the $cmd array of the uploading file (currently we have "data" and "target").
  • I also introduced an AJAX call (tcefile::process) that makes use of the new method in the class that does the same as the tce_file.php

(issue imported from #M10718)


Files

10718_tcefile_ajax.patch (22 KB) 10718_tcefile_ajax.patch Administrator Admin, 2009-03-18 12:32
10718_v3.patch (20.7 KB) 10718_v3.patch Administrator Admin, 2009-03-18 22:50
Actions

Also available in: Atom PDF