Project

General

Profile

Actions

Feature #16942

closed

provide new inputfield "directorypicker" in BE

Added by Typoheads - Web Engineering about 17 years ago. Updated over 13 years ago.

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

0%

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

Description

Extend TCA-types with the possibilty to select a directory instead of only picking a file. Could be used for e.g. Galleries, Filelists etc.

(issue imported from #M4923)


Files

4923_trunk.patch (15.4 KB) 4923_trunk.patch Administrator Admin, 2008-01-23 00:04
T3X_dirpicker_demo-0_0_1-z-200801261056.t3x (9.62 KB) T3X_dirpicker_demo-0_0_1-z-200801261056.t3x Administrator Admin, 2008-01-26 10:55
directory_picker.diff (16.9 KB) directory_picker.diff Administrator Admin, 2008-03-03 20:08

Related issues 1 (0 open1 closed)

Blocks TYPO3 Core - Feature #18595: Apply link wizard for folder selection to tt_content, CType uploadsClosed2008-04-09

Actions
Actions #1

Updated by Oliver Hader about 17 years ago

Indeed, this could be useful (+1).

Actions #2

Updated by Typoheads - Web Engineering about 17 years ago

hi oliver,
could you provide some technical details howto achieve a directorypicker... maybe others are interested then to help out with programming/realising this

Actions #3

Updated by Andreas Wolf about 17 years ago

+1

Actions #4

Updated by Andreas Wolf about 17 years ago

Well, I have made a solution and attached a diff-file. It has not been tested extensively so far, but it should work. The directory-picker is called via browse_links.php?mode=folder. The rest of the configuration is the same as for mode=file. There is also one label missing, I will add this later on (or tomorrow).

Please test it and give feedback if it works as intended.

What I'm unsure about is whether to use clicks on the tree-items to a) return the value to the form and close the window or b) open the sub-folders on the right side of the window (as it is now). b) is the behaviour as TYPO3 shows it with the file-browser, so it would be consistent to have it here, but a) on the other hand is more logical in this special case. Please tell me what you think about this...

Actions #5

Updated by Andreas Wolf about 17 years ago

Hi Boris,
hi Oliver

did you have a look at the patch I provided?

Greets,

Andreas

Actions #6

Updated by Oliver Hader about 17 years ago

Andreas, what is the real revision you created a patch file of? I couldn't apply your patch file. Furthermore please make sure a patch doesn't contain unnecessary space changes (e.g. adding tabs on a blank line etc.).

Why do you move the $P2=array() outside of the if ($this->mode=='wizard') block? $P2 and $addPassOnParams are not used in your patch. Thus, this change is not necessary.

Could you please attach an example how to use the new "folder" property in TCA?

Actions #7

Updated by Andreas Wolf about 17 years ago

The patch was created against TYPO3 4.0.4. The extra whitespace was created by debug-instructions I inserted and removed (and I forgot to delete the additional whitespace I had inserted - shame on me...).

Moving the $P2 outside of the if is neccessary because in the JS-code for jumpToUrl the var $addPassOnParams is used - without moving, this var is only set if the page is in wizard mode. But this is not the case with the directory-picker, so it is neccessary to make this var generally available.

The configuration is quite simple, just take a normal configuration for a file-picker and change mode from "file" to "folder". That's it. Perhaps I will add a demo-extension later on.

Actions #8

Updated by Reinhard F¼hricht about 17 years ago

hi andreas,

i patched the files using the patch file you have provided. after creating a file.picker with the new mode 'folder', typo3 doesn't create the field like it should, but showing only the little yellow image that states that the field must be filled out.

does this patch only work with version 4.0.4? i'm using 4.0.1.

Actions #9

Updated by Andreas Wolf about 17 years ago

Hello Reinhard,

could you please post the whole configuration for that field? I have to look at my configuration again, but as far as I remember, you just need to change "file" into "folder"... But I'll have a look at it again.

Edit: Reinhard, you are right - it doesn't work the way I suggested... I didn't test it with a select-box (= multiple folders), only with an input-field (= one folder to pick). I'm sure there's additional programming neccessary. Perhaps I can test it more thouroughly this evening.

Actions #10

Updated by Reinhard F¼hricht about 17 years ago

hi andreas,
the configuration should be exactly as you mentioned in your note.

$temp_tca['columns']['subheader'] = Array (
'label' => 'LLL:{elementPath}{elementName}/locallang.php:directory',
'config' => Array (
'type' => 'group',
'internal_type' => 'folder',
)
);

i only substituted the usual "file" to the new mode "folder".

Actions #11

Updated by Andreas Wolf about 17 years ago

Ok, this is the configuration that works for me - as I said, only for a single folder, not for many:

'config' => Array (
'type' => 'input',
'size' => 40,
'wizards' => Array(
'_PADDING' => 2,
'link' => Array(
'type' => 'popup',
'title' => 'Ordner auswählen',
'icon' => 'link_popup.gif',
'script' => 'browse_links.php?mode=folder',
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
),
),
)

And I realized that my patches break the file-picker. This patch definitely needs some work - but first I would like to have some comments a) about the way the directory-picker works for single input-fields and b) whether we need a directory-picker for picking directories into a select-box. I would say yes, but perhaps the majority doesn't think so ;)

Actions #12

Updated by Andreas Wolf about 17 years ago

Well, I have added a directory-picker for select-boxes now, and the single-dir-picker doesn't interfere with the file-picker-wizard.

Please test and give feedback...

Edit: I have uploaded a demo-extension which does nothing but provide three input-fields (file-picker, dir-picker and dir-picker [single]). Just install, and insert a new record via list-view.

Actions #13

Updated by Stefano Cecere about 17 years ago

i could sponsor other 50 EUR if the file browser could be configured to open from a (by TSConfig or TCA ) defined directory, so that i can easy the editor showing him the right directory (and not all his filemounts).

what do you think?

Actions #14

Updated by Andreas Wolf about 17 years ago

Ok, so you mean to define a folder in the 'config'-array and only this folder is shown? Or should the browser start in this folder and also show all others on the left side?

Actions #15

Updated by Stefano Cecere about 17 years ago

i would make it a "temporary mountpoint", showing only from this folder down.

Actions #16

Updated by Andreas Wolf about 17 years ago

Hm, ok, I think this is possible, but I don't know how hard it is - at least not now, without having had a look at the code. Perhaps I have got time to do it this evening.

Actions #17

Updated by Reinhard F¼hricht about 17 years ago

i have tried out your configuration for a dir picker selectiing a single dir using your new provided patch. with the old one the changes made selecting a dir where discarded when saving. The new one works fine.
Thanks

Actions #18

Updated by Andreas Wolf about 17 years ago

Reinhard, I have noticed the same as you did, but I thought it was due to a change I had made during development between the first and the second patch. Anyways, it seems to be fixed now :-)

Actions #19

Updated by Ralf Hettinger about 17 years ago

Very neat feature (+1).

Additionally, attaching a diff (4923_4.1.1.patch) against TYPO3 4.1.1 since the old diff wouldn't work without manual adjustments (new comments added in class.browse_links.php 4.1.1).

The attached patch also
- avoids JavaScript errors that occured when browsing different mount points and empty directories,
- avoids some redundant code,
- has correct (folder instead of file) source code comments,
- has a slightly different code for removing the TYPO3's PATH_site,
- changes call to a loop var by reference, since this will not work for every environment.

Actions #20

Updated by Oliver Hader about 17 years ago

keyword:t3dd07

Actions #21

Updated by Typoheads GmbH over 16 years ago

keyword:4.1.3

Actions #23

Updated by Ralf Hettinger about 16 years ago

Added a new dirpicker demo extension, that uses type group only.

Actions #24

Updated by Ralf Hettinger about 16 years ago

Work on hold - feel free to continue ;)

ToDo for integration into 4.2:
Solve handling of link in TCEForm to wizard from single input fields properly. The link should be built by appending ?mode=wizard&act=folder or similar to that. Currently it uses mode=folder and results in JavaScript-Errors.

For testing the wizard with an input field, you can simply use Andreas dirpicker demo extension attached here as well) at http://bugs.typo3.org/file_download.php?file_id=2455&type=bug

Actions #25

Updated by Ingo Renner about 16 years ago

committed the last patch to SVN

Actions #26

Updated by Ingo Renner about 16 years ago

About the sponsoring: I would not like to demand the 100€, just 20€ probably. However I can not judge how much work each of Andreas and Ralf have done. Therefore I'd suggest both getting 40€ if they do not get up with something else...

Actions #27

Updated by Typoheads Dev Team about 16 years ago

sure, feel free to contact me and/or send your receipt(s):
thx for your enthusiasm and good work!!!

Actions

Also available in: Atom PDF