Feature #16323

Implement file_reference for TCA "group" type. Files can be referenced instead of copied to upload folder

Added by Martin Borer about 14 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2007-07-27
Due date:
% Done:

0%

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

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

6039.patch (1.78 KB) 6039.patch Administrator Admin, 2008-02-27 01:48
6039_v2.patch (2.72 KB) 6039_v2.patch Administrator Admin, 2008-02-27 22:46
6039_v3.patch (2.77 KB) 6039_v3.patch Administrator Admin, 2008-02-28 00:32
6039_v4_new_internal_type.patch (10.1 KB) 6039_v4_new_internal_type.patch Administrator Admin, 2008-03-12 21:51
6039_v5_with_impexp.patch (17 KB) 6039_v5_with_impexp.patch Administrator Admin, 2008-08-02 13:47
6039_v5.diff (12.1 KB) 6039_v5.diff Administrator Admin, 2008-08-19 12:06
6039_v6.diff (18.3 KB) 6039_v6.diff Administrator Admin, 2008-08-19 21:48
typo3_fileIntegrityCheckWithSupportOfDirectReferences.patch (2.06 KB) typo3_fileIntegrityCheckWithSupportOfDirectReferences.patch Administrator Admin, 2008-10-29 15:47
6039_v7.patch (19.8 KB) 6039_v7.patch Administrator Admin, 2009-01-21 14:46
6039_v8.diff (19.7 KB) 6039_v8.diff Administrator Admin, 2009-03-27 23:01
6039_v9.diff (21.5 KB) 6039_v9.diff Administrator Admin, 2009-05-25 21:50
T3X_6039-0_0_0-z-200906261532.t3x (10.4 KB) T3X_6039-0_0_0-z-200906261532.t3x Administrator Admin, 2009-07-31 14:10
6039_v14.diff (20.6 KB) 6039_v14.diff Administrator Admin, 2009-07-31 14:10
6039_v14_doku.txt (371 Bytes) 6039_v14_doku.txt Administrator Admin, 2009-07-31 14:10
6039_v15.diff (20.4 KB) 6039_v15.diff Administrator Admin, 2009-08-01 20:17
#1

Updated by Typoheads GmbH about 14 years ago

+1

#2

Updated by Yannick Pavard over 13 years ago

+1 ;)

But I prefer to do not store absolute path, but only fileadmin/mytemplate/news.html

Thank You

#3

Updated by Peter Wechtersbach over 13 years ago

+1

Also prefer only fileadmin/mytemplate/...

Thank you :)

#4

Updated by Oliver Hader over 13 years ago

Could some please add a patch then? Thanks! ;-)

#5

Updated by Martin Borer over 13 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?

#6

Updated by Martin Borer over 13 years ago

PS: Adding references to selected files is missing in my patch!

#7

Updated by Martin Borer over 13 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

#8

Updated by Benni Mack over 13 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!

#9

Updated by Benni Mack over 13 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));
}
}
}

#10

Updated by Martin Borer over 13 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.

#12

Updated by Martin Borer over 13 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'.

#13

Updated by Martin Borer over 13 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 ?

#14

Updated by Michiel Roos over 13 years ago

.-(michiel@Food:1,28 0,94 0,77)---[...s/alien42/typo3]
`-$ grep ril t3d *
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
.
(michiel@Food:1,28 0,94 0,77)---[...s/alien42/typo3]
`-$

#15

Updated by Benni Mack about 13 years ago

what's the status here?

#16

Updated by Martin Borer about 13 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.

#17

Updated by Dmitry Dulepov about 13 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).

#18

Updated by Martin Borer about 13 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!

#19

Updated by Michael Miousse about 13 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

#20

Updated by Stefan Galinski almost 13 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.

#21

Updated by Stefan Galinski almost 13 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.

#22

Updated by Stefan Galinski over 12 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

#23

Updated by Stefan Galinski over 12 years ago

Latest patch is against 4.2.4 and includes my file integrity patch.

#24

Updated by Martin Borer over 12 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

#25

Updated by Daniel Schmitzer over 12 years ago

The Patch works fine and fix the problems in 4.2.1

#26

Updated by Steffen Kamper over 12 years ago

I attached a patch that fits to latest trunk.

#27

Updated by Martin Borer over 12 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!'

#28

Updated by Christian Kuhn about 12 years ago

Committed attached v15 to trunk, rev. 5744.

Also available in: Atom PDF