Feature #16323
closedImplement file_reference for TCA "group" type. Files can be referenced instead of copied to upload folder
0%
Description
If you let "uploadfolder" empty in your TCA Settings. Like:
"movie" => Array (
"exclude" => 1,
"label" => "LLL:EXT:ext_collect/locallang_db.xml:tx_extcollect_movies.movie",
"config" => Array (
"type" => "group",
"internal_type" => "file",
"allowed" => "flv",
"max_size" => 500000,
"uploadfolder" => "",
"size" => 1,
"minitems" => 1,
"maxitems" => 1,
)
),
The selected File will not be copied. It stores only the absolute Path of the file (great!).
But after saving the record, the selector box shows the whole "long" path. The Filename isn't identifiable anymore. It would be great if the Filename apears insted of the "Upload" Fild, witch isn't used anymore.
This Feature is used by MailformPlus and some of my privat extensions... ;)
(issue imported from #M6039)
Files
Updated by Yannick Pavard almost 17 years ago
+1 ;)
But I prefer to do not store absolute path, but only fileadmin/mytemplate/news.html
Thank You
Updated by Peter Wechtersbach almost 17 years ago
+1
Also prefer only fileadmin/mytemplate/...
Thank you :)
Updated by Oliver Hader almost 17 years ago
Could some please add a patch then? Thanks! ;-)
Updated by Martin Borer almost 17 years ago
Uploaded a Patch: 6039.patch
If "uploadfolder" is emty, the Upload Field will be dropped and the stored path is relative to site root.
I'm not sure if the line:
$valueArray[$key] = substr($theFile, strpos($theFile, "fileadmin/"));
is a god solution... Is there a T3-Function for this issue?
Updated by Martin Borer almost 17 years ago
PS: Adding references to selected files is missing in my patch!
Updated by Martin Borer almost 17 years ago
Uploaded new patch: 6039_v2.patch
New:
- with file references support.
- replaced line
$valueArray[$key] = substr($theFile, strpos($theFile, "fileadmin/"));
with a better solution
Updated by Benni Mack almost 17 years ago
Is this is a bug or a feature?
If it's a bug, please submit it to the core list so it can go to in the 4.2 release!
Updated by Benni Mack almost 17 years ago
I also read through your patch (v2). Quite cool.
A couple of things to fix:
- Please create the patch located to the base directory of the SVN branch.
- Hunk #2: Please use curly braces around if statements
- Hunk #3: Curly braces here too would be nice. Also use single quotes : && $config['uploadfolder']!='')
- Hunk #5: could be written as
if (count($valueArray)) {
foreach ($valueArray as &$theFile) {
if (t3lib_div::isFirstPartOfStr($theFile,PATH_site)) {
$theFile = substr($theFile,strlen(PATH_site));
}
}
}
Updated by Martin Borer almost 17 years ago
Uploaded clean patch: 6039_v3.patch
@Benjamin Fischer
Thanks for your hints. Liked the "foreach" one! ;)
I will report this "bug" to the list. It's e mix between a bug and a feature.
thumbnails and file references were not working with an emty "uploadfolder" option.
Updated by Martin Borer almost 17 years ago
Submitted to the list:
http://lists.netfielders.de/pipermail/typo3-team-core/2008-February/014293.html
news://news.netfielders.de:119/mailman.1.1204159369.29536.typo3-team-core@lists.netfielders.de
Updated by Martin Borer over 16 years ago
Uploaded new patch: 6039_v4_new_internal_type.patch
There are now 2 ways to have direct file references.
1st and better way
There is now a new internal_type for TCA->group called 'file_reference' it's almost a alias for 'file' with the difference that the option 'uploadfolder' is always ignored, so it's always a file reference.
2nd way (not so good)
internal_type 'file' with empty 'uploadfolder' Option. With this config the behavior is exactly the same like the internal_type 'file_reference'.
Updated by Martin Borer over 16 years ago
There is something missing in my patch!
Import data from a *.t3d file with TCA->group->internal_type 'file_reference' records or 'file' with empty 'uploadfolder' records is not working.
Import message (example):
[red]
fileadmin/user_upload/castTest/rechner.jpg, fileadmin/user_upload/castTest/verwaltung.jpg
[/red]
[green]
typo3temp/\imp9C.tmp, typo3temp/\imp9D.tmp
[/green]
which core files are responsible for import / export *.t3d ?
Updated by Michiel Roos over 16 years ago
.-(michiel@Food:1,28 0,94 0,77)---[...s/alien42/typo3]
`-$ grep ril t3d *(michiel@Food:1,28 0,94 0,77)---[...s/alien42/typo3]
sysext/adodb/datasource_flexform_ds.xml
sysext/cms/cshimages/pagetree_overview_4.png
sysext/cms/ext_emconf.php
sysext/cms/tbl_tt_content.php
sysext/css_styled_content/flexform_ds.xml
sysext/felogin/flexform.xml
sysext/impexp/app/index.php
sysext/impexp/app/locallang.xml
sysext/impexp/class.tx_impexp.php
sysext/impexp/doc/TODO.txt
sysext/impexp/ext_emconf.php
sysext/impexp/locallang_csh.xml
.
`-$
Updated by Martin Borer over 16 years ago
New patch: 6039_v5_with_impexp.patch
New with import / export support of group->file_reference fields.
Could someone of the core 'gurus' review this patch? ;)
There are still some minor flaws. The relative path for example, the path to the file is only identifiable if thumbnails are active for the file_reference field.
Updated by Dmitry Dulepov over 16 years ago
I took the version from the core list and updated it a bit. Only then I saw that you already made another here :( Please, inform core list next time if you do...
I attached my version 96039_v5.diff).
Updated by Martin Borer over 16 years ago
New patch: 6039_v6.diff
(Typo3 4.2-Branch Revision 4005)
Merged 6039_v5.diff from Dimitry with 6039_v5_with_impexp.patch.
I've made also a BUGFIX! In 6039_v5_with_impexp.patch, some lines were outside a foreach loop. (only last selected file was converted to a relative path.)
Please don't use 6039_v5_with_impexp.patch!
Updated by Michael Miousse about 16 years ago
will it be integrated in futur version of typo3?
because i made an extension from the patch and i want to know if it would be useful to put it on the ter
Updated by Stefan Galinski about 16 years ago
I have tested the latest patch and it works like expected. IMHO it's really an important patch to get rid of the endless copying stuff in TYPO3.
Updated by Stefan Galinski about 16 years ago
I have uploaded the file "typo3_fileIntegrityCheckWithSupportOfDirectReferences.patch" which is a followup of the last patch. It contains a workaround for the database<->file references functions. This one has always reported any direct references to fileadmin files in the "missing files" section. You can find the corresponding backend function here: DB Check->Database Relations.
BTW: It's just a workaround, because the whole code of the file must be refactored.
Updated by Stefan Galinski almost 16 years ago
Any news?
BTW: The following two typoscript lines are important to render images of tt_content elements in the frontend (if css_styed_content is used).
tt_content.image.20.imgPath =
tt_content.textpic.20.imgPath < tt_content.image.20.imgPath
Updated by Stefan Galinski almost 16 years ago
Latest patch is against 4.2.4 and includes my file integrity patch.
Updated by Martin Borer almost 16 years ago
@Stefan,
Thanks for your merged patch. I've reported your new patch to the typo3 core list:
http://lists.netfielders.de/pipermail/typo3-team-core/2009-January/022835.html
Updated by Daniel Schmitzer almost 16 years ago
The Patch works fine and fix the problems in 4.2.1
Updated by Steffen Kamper over 15 years ago
I attached a patch that fits to latest trunk.
Updated by Martin Borer over 15 years ago
New patch: 6039_v9.diff
(Typo3 4.2-Branch Revision 5493)
- Bugfix 1: internal_type 'folder' shows now the path and not only the folder name.
- Bugfix 2: image title attribute of thumbnails (internal_type -> file_reference) now displays the filesize instead of 'FILE NOT FOUND!'
Updated by Christian Kuhn over 15 years ago
Committed attached v15 to trunk, rev. 5744.