I find it very useful to restrict the list of files based on a pattern, which I pass via a parameter call regexp:
my $regexp = $params->{'regexp'};
This pattern is used to drop out of the main loop. I currently force case-insensitivity, but maybe this should be parameterized.
if (defined $regexp){
next unless ($filename=~/$regexp/i );
}
Could this, or something similar, be added to the standard plugin?
--
TWiki:Main/JohnFitzpatrick
- 20 Feb 2008
Implemented with version 1.2, but without case-insensitive attribute, because people might want to search on case (for instance all files starting with an uppercase).
Changes: Added parameter
includefilepattern
and formatting parameter
$fileExtension
. When using parameter
sort
the files are now secondary sorted on filename. Added decoding of format tokens.
--
TWiki:Main.ArthurClemens
- 20 Feb 2008
Thanks Arthur!
A quick google search has taught me how to specify case-insensitivity within the regular expression: I just have to add a
(?i)
to the start of the expression. Perhaps you could add this as an example: very useful for people like me who work in a Windows environment!
--
TWiki:Main.JohnFitzpatrick
- 21 Feb 2008
Hmm, I'm getting this error:
Undefined subroutine &TWiki::Plugins::AttachmentListPlugin::_expandStandardEscapes called
Do I need to be using TWiki 4.2?
--
TWiki:Main.JohnFitzpatrick
- 21 Feb 2008
Thanks for the regex tip. I have included it in an example and fixed the bug.
--
TWiki:Main.ArthurClemens
- 21 Feb 2008
Arthur,
I'm getting the following error on 4.1.2 and on 4.2. Any ideas what I'm doing wrong?
Bad index while coercing array into hash at /compnew/lib/TWiki/Plugins/AttachmentListPlugin.pm line 154.
at /compnew/lib/TWiki/Plugins/AttachmentListPlugin.pm line 154
TWiki::Plugins::AttachmentListPlugin::handleFileList('TWiki=HASH(0x10030e4c)', 'TWiki::Attrs=HASH(0x113f89b4)', 'AutolivIcons', 'Main', 'TWiki::Meta=HASH(0x1103f10c)') called at /compnew/lib/TWiki/Func.pm line 2231
TWiki::Func::__ANON__('TWiki=HASH(0x10030e4c)', 'TWiki::Attrs=HASH(0x113f89b4)', 'AutolivIcons', 'Main', 'TWiki::Meta=HASH(0x1103f10c)') called at /compnew/lib/TWiki.pm line 2661
TWiki::_expandTagOnTopicRendering('TWiki=HASH(0x10030e4c)', 'FILELIST', ..., 'AutolivIcons', 'Main', 'TWiki::Meta=HASH(0x1103f10c)') called at /compnew/lib/TWiki.pm line 2582
TWiki::_processTags('TWiki=HASH(0x10030e4c)', ' * CompOrg-16.gif: <br />\x{a} <img src="%ATTACHURLPATH%/Co...', 'CODE(0x102e4e00)', 16, 'AutolivIcons', 'Main', 'TWiki::Meta=HASH(0x1103f10c)') called at /compnew/lib/TWiki.pm line 2506
TWiki::expandAllTags('TWiki=HASH(0x10030e4c)', 'SCALAR(0x102f56ac)', 'AutolivIcons', 'Main', 'TWiki::Meta=HASH(0x1103f10c)') called at /compnew/lib/TWiki.pm line 2858
TWiki::handleCommonTags('TWiki=HASH(0x10030e4c)', ' * CompOrg-16.gif: <br />\x{a} <img src="%ATTACHURLPATH%/Co...', 'Main', 'AutolivIcons', 'TWiki::Meta=HASH(0x1103f10c)') called at /compnew/lib/TWiki/UI/View.pm line 396
TWiki::UI::View::_prepare(' * CompOrg-16.gif: <br />\x{a} <img src="%ATTACHURLPATH%/Co...', 'TWiki=HASH(0x10030e4c)', 'Main', 'AutolivIcons', 'TWiki::Meta=HASH(0x1103f10c)', 0) called at /compnew/lib/TWiki/UI/View.pm line 377
TWiki::UI::View::view('TWiki=HASH(0x10030e4c)') called at /compnew/lib/TWiki/UI.pm line 159
TWiki::UI::__ANON__() called at /usr/lib/perl5/5.8/Error.pm line 387
eval {...} called at /usr/lib/perl5/5.8/Error.pm line 379
Error::subs::try('CODE(0x10030e1c)', 'HASH(0x11090e68)') called at /compnew/lib/TWiki/UI.pm line 197
TWiki::UI::run('CODE(0x1036d1d4)', 'view', 1) called
I can't reproduce this error, but I will change back the way the array of FileData objects is referenced.
--
TWiki:Main.ArthurClemens
- 21 Feb 2008
Another try, version 1.2.3.
--
TWiki:Main.ArthurClemens
- 21 Feb 2008
Thanks Arthur!
I've opened another enhancement request, due to some problems putting ATTACHMENTLIST in a table. I think I know why: see Item5378
--
TWiki:Main.JohnFitzpatrick
- 22 Feb 2008