[TYPO3-core] RFC #10718: Make tce_file usable via AJAX
Benjamin Mack
benni at typo3.org
Wed Mar 18 12:41:32 CET 2009
Hello everybody,
this is a SVN patch request.
Branches: trunk only
BT reference: http://bugs.typo3.org/view.php?id=10718
Problem:
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 execution of each task and the output
of error messages and a redirect after the execution of the file operations.
Solution: To properly access the functions without executing the
whole process, the class should be put 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 fetches (it's all in one method call, fetching and
HTML generation)
Solution: I added a new function to only fetch the errors from the DB
and moved that part out of the template generation part in extfilefunctions
* It is not possible to fetch the positive results from each
processData() call.
Solution: 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
Solution: This is now done via an additional key in the $cmdData
array of the uploading file (currently we have "data" and "target", now
we add "charset").
* 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
Notes:
All in all, the patch should allow everything to behave as before, only
with some additions that are useful for alternative access of files
(yes, the mass uploader of course).
Same goes for this patch as the one before: I want to deal with these
issues separately before I send the mass uploader so we can separate the
new feature from the general modifications that are needed.
All the best,
Benni.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 10718_tcefile_ajax.patch
Type: text/x-diff
Size: 22485 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090318/878ad3b7/attachment-0001.patch
More information about the TYPO3-team-core
mailing list