Index: HTML/Default/slimserver.css =================================================================== --- HTML/Default/slimserver.css (revision 12275) +++ HTML/Default/slimserver.css (working copy) @@ -587,3 +587,34 @@ padding: 0px 5px 1px 5px; } +div.autocomplete { + position: absolute; + width: 250px; + height: 100px; + overflow: auto; + background-color: white; + border: 1px solid #888; + margin: 0px; + padding: 0px; +} + +div.autocomplete ul { + list-style-type: none; + margin: 0px; + padding: 0px; +} + +div.autocomplete ul li.selected { + background-color: navy; + color: white; +} + +div.autocomplete ul li { + list-style-type: none; + display: block; + margin: 0; + padding: 2px; + height: 12px; + cursor: pointer; + white-space: nowrap +} Index: HTML/EN/html/settings.js =================================================================== --- HTML/EN/html/settings.js (revision 12275) +++ HTML/EN/html/settings.js (working copy) @@ -166,3 +166,29 @@ field.setStyle({backgroundColor: '#ffcccc'}); } } + +function addFolderSelector(field) { + addSelector(field, true); +} + +function addFileSelector(field) { + addSelector(field, false); +} + +function addSelector(field, foldersOnly) { + field = $(field); + new Ajax.Autocompleter( + field, + 'autocomplete', + '/settings/server/fileselector.html', + { + paramName: 'currDir', + parameters: (foldersOnly ? 'foldersonly=1' : ''), + updateElement: function(item) { + field.value = item.innerHTML; + field.setStyle({backgroundColor: bgColors[field]}); + field.focus(); + } + } + ); +} Index: HTML/EN/settings/header.html =================================================================== --- HTML/EN/settings/header.html (revision 12275) +++ HTML/EN/settings/header.html (working copy) @@ -10,7 +10,7 @@ [% pageHeaderScripts = BLOCK %] [% pageHeaderScripts %] - + [% END %] @@ -32,6 +32,8 @@
+ +
[% END %] Index: HTML/EN/settings/server/basic.html =================================================================== --- HTML/EN/settings/server/basic.html (revision 12275) +++ HTML/EN/settings/server/basic.html (working copy) @@ -20,7 +20,6 @@ -
[% "SETUP_PLAYLISTDIR" | string | upper %]
[% "SETUP_PLAYLISTDIR_DESC" | string %]
@@ -79,4 +78,9 @@
[% END %] + + [% PROCESS settings/footer.html %] Index: HTML/EN/settings/server/fileselector.html =================================================================== --- HTML/EN/settings/server/fileselector.html (revision 0) +++ HTML/EN/settings/server/fileselector.html (revision 0) @@ -0,0 +1,5 @@ + Index: HTML/EN/settings/server/interface.html =================================================================== --- HTML/EN/settings/server/interface.html (revision 12275) +++ HTML/EN/settings/server/interface.html (working copy) @@ -42,5 +42,8 @@ + [% PROCESS settings/footer.html %] Index: HTML/EN/slimserver.css =================================================================== --- HTML/EN/slimserver.css (revision 12275) +++ HTML/EN/slimserver.css (working copy) @@ -269,3 +269,35 @@ cursor: pointer; padding: 0px 5px 1px 5px; } + +div.autocomplete { + position: absolute; + width: 250px; + height: 100px; + overflow: auto; + background-color: white; + border: 1px solid #888; + margin: 0px; + padding: 0px; +} + +div.autocomplete ul { + list-style-type: none; + margin: 0px; + padding: 0px; +} + +div.autocomplete ul li.selected { + background-color: navy; + color: white; +} + +div.autocomplete ul li { + list-style-type: none; + display: block; + margin: 0; + padding: 2px; + height: 12px; + cursor: pointer; + white-space: nowrap +} Index: HTML/Fishbone/skin.css =================================================================== --- HTML/Fishbone/skin.css (revision 12275) +++ HTML/Fishbone/skin.css (working copy) @@ -917,3 +917,17 @@ cursor: pointer; padding: 0px 5px 1px 5px; } + +div.autocomplete { + background:#ddd; + color:#444; +} + +div.autocomplete ul li.selected { + background: navy; + color: white; +} + +div.autocomplete ul li { + height: 11px; +} Index: Slim/Plugin/iTunes/HTML/EN/plugins/iTunes/settings/itunes.html =================================================================== --- Slim/Plugin/iTunes/HTML/EN/plugins/iTunes/settings/itunes.html (revision 12275) +++ Slim/Plugin/iTunes/HTML/EN/plugins/iTunes/settings/itunes.html (working copy) @@ -57,4 +57,9 @@ [% "SETUP_PLAYLISTSUFFIX_CHOOSE" | string %] + + [% PROCESS settings/footer.html %] Index: Slim/Web/Settings/Server/FileSelector.pm =================================================================== --- Slim/Web/Settings/Server/FileSelector.pm (revision 0) +++ Slim/Web/Settings/Server/FileSelector.pm (revision 0) @@ -0,0 +1,55 @@ +package Slim::Web::Settings::Server::FileSelector; + +# SlimServer Copyright (c) 2001-2007 Logitech. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License, +# version 2. + +use strict; +use base qw(Slim::Web::Settings); + +use Slim::Utils::Prefs; +use File::Basename qw(dirname); + +sub page { + return 'settings/server/fileselector.html'; +} + +sub handler { + my ($class, $client, $paramRef, $pageSetup) = @_; + + my @subdirs; + + my $currDir = $paramRef->{'currDir'}; + + if (Slim::Utils::OSDetect::OS() eq 'win') { + $currDir =~ s/\\/\\\\/g; + } + + if (-d $currDir) { + my $dir = Path::Class::Dir->new($currDir); + @subdirs = map { $_->stringify() } $dir->children(); + } + else { + # partial file/foldernames - filter the list of the parent folder + my $parent = dirname($currDir); + if ($parent && $parent ne '.' && -d $parent) { + my $dir = Path::Class::Dir->new($parent); + @subdirs = grep { /$currDir/i } $dir->children(); + } + } + + if ($paramRef->{'foldersonly'}) { + @subdirs = grep { -d } @subdirs; + } + +# push @subdirs, Slim::Utils::Strings::string('SETUP_BAD_DIRECTORY') if (!@subdirs); + + $paramRef->{'folders'} = \@subdirs; + + return Slim::Web::HTTP::filltemplatefile($class->page, $paramRef); +} + +1; + +__END__