Project

General

Profile

Actions

Bug #15170

closed

Selector box which selects more than one file from file folder looses data on reload

Added by old_posimis over 18 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2005-11-02
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

If you configure a selector box to get its items from a folder and maxitems is greater than 1, the stored files are lost, when the form is reloaded.

example for field configuration:
$TCA["tx_testselect_test"] = Array (
"columns" => Array (
"test" => Array (
"exclude" => 1,
"label" => "test",
"config" => Array (
"type" => "select",
"fileFolder" => "fileadmin/",
"fileFolder_extList" => "",
"size" => 1,
"minitems" => 0,
"maxitems" => 5,
)
),
),
"types" => Array (
"0" => Array("showitem" => "hidden;;1;;1-1-1, test, test2")
),
);

With this example it is possible to select one ore more files, they are also stored in the database table, when you save the record. But when the record is reopened, the selection of the files is lost, no files are selected. The stored values are not interpreted.

I'm not sure sure, but I think the bug is found in t3lib_transferdata::renderRecord_selectProc()

If the data comes from an item array, some special methods or from a foreign table, then the code works. But data from a file folder is ignored:
[snip]
if (intval($fieldConfig['config']['maxitems'])>1) {

// Add regular elements:
if (is_array($fieldConfig['config']['items'])) {
$fieldConfig['config']['items'] = $this->procesItemArray($fieldConfig['config']['items'], $fieldConfig['config'], $TSconfig[$field], $table, $row, $field);
foreach($fieldConfig['config']['items'] as $pvpv) {
foreach($elements as $eKey => $value) {
if (!strcmp($value,$pvpv[1])) {
$dataAcc[$eKey]=rawurlencode($pvpv[1]).'|'.rawurlencode($pvpv[0]);
}
}
}
}
// Add "special" 
if ($fieldConfig['config']['special']) {
$dataAcc = $this->selectAddSpecial($dataAcc, $elements, $fieldConfig['config']['special']);
}
// Add "foreign table" stuff:
if ($TCA[$fieldConfig['config']['foreign_table']]) {
$dataAcc = $this->selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row);
}
// Always keep the native order for display in interface:
ksort($dataAcc);
}
[/snip]
(issue imported from #M1767)

Files

Actions #1

Updated by Sebastian Kurfuerst over 18 years ago

Hi,
can you please upload a dummy extension T3X file here for testing?
Thanks,
Sebastian

Actions #2

Updated by old_posimis over 18 years ago

Sure I can. The extension is a simple database table with one field, which is a select field to select files from the fileadmin folder.

Behavior as I described above.

Greets,
Martin

Actions #3

Updated by old_posimis over 18 years ago

The select box also doesn't work, if the values come from an itemProcFunc and no item array is given in the TCA. Then it'S the same behaviour as if the items come from fileFolder.

To make the selection work, at least one item has to be added manually to the item array, or else the if statement with is_array($fieldConfig['config']['items'] won't be executed and no other items are added.

Actions #4

Updated by Sebastian Kurfuerst over 18 years ago

currently, I cannot fix this issue, but I can confirm it and a patch is always welcome.
Greets, Sebastian

Actions #5

Updated by Johannes Bornhold about 16 years ago

Currently, i am having the same problem.

I added the following code-snippet to the method t3lib_transferdata::renderRecord_selectProc(), directly above "Add special":

[snip]
// Add "fileFolder"
if ($fieldConfig['config']['fileFolder']) {
foreach($elements as $eValue) {
$dataAcc[] = rawurlencode($eValue) . '|' . rawurlencode($eValue);
}
}
[/snip]

This worked for me, but i am not really sure if it is correct to rawurlencode the value and the label.

I think that this works only if there are no static or other items.

Actions #6

Updated by Frank Roeske over 14 years ago

well, I did put it in the method t3lib_transferdata::renderRecord_selectProc(), so you have to set in addition the 'special' => 'files' Value in the config-Array, e.g.:

[...]
"dateien" => Array (
"exclude" => 1,
"label" => "label",
"config" => Array (
"type" => "select",
"fileFolder" => 'fileadmin/user_upload/,
"selicon_cols" => 8,
"size" => 10,
"minitems" => 0,
"maxitems" => 10,
"multiple" => 0,
"allowNonIdValues" => 1,
"special" => 'files',
)
),
[...]

Patch will come to trunc (rev 5948).

Actions #7

Updated by Alexander Opitz over 10 years ago

  • Status changed from Accepted to Needs Feedback
  • Target version deleted (0)
  • TYPO3 Version changed from 3.7.0 to 3.7
  • PHP Version deleted (4)
  • Is Regression set to No

Hi,

as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #8

Updated by Alexander Opitz over 10 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this ticket.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions

Also available in: Atom PDF