From fa170afd817648f306e322802ca85b6abbd37f74 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jun 2011 16:33:26 +0200 Subject: Initial commit --- cgi-bin/settings.plx | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 cgi-bin/settings.plx (limited to 'cgi-bin/settings.plx') diff --git a/cgi-bin/settings.plx b/cgi-bin/settings.plx new file mode 100644 index 0000000..dffc8cb --- /dev/null +++ b/cgi-bin/settings.plx @@ -0,0 +1,92 @@ +#!c:/perl/bin/perl + +use strict; +use Globals; +use CGI; +use playlists::playlist; +use Globals qw(%ALLPLATTERS @MUSIC @VIDEO @SHORTCUT $bgcolour); + +# Scripting variables +# +my $WEBPAGE = openTemplate("settings"); +my $FORMATS; +my $SERVERS; +my $QUERY = CGI::new(); +my $exclude = $QUERY->cookie("exclude"); +my @AVAILABLE; + +# Playlist formats form +opendir(DIR, "./playlists/"); +while (my $file = readdir(DIR)) { + if ($file =~ /^ext(.*)\.(pm)$/) { + push (@AVAILABLE, $1); + } + } +closedir DIR; + +my $thisformat; +my $desc; +foreach ( @AVAILABLE ) { + if (/playlist/) { next } + $thisformat = $_; + $desc = playlist->new("ext$thisformat")->desc(); + $FORMATS.="". + "$thisformat$desc\n"; +} + +$WEBPAGE =~ s/%FORMATS%/$FORMATS/; +$WEBPAGE =~ s/%BGCOLOUR%/$bgcolour/g; + +# filetype form + +my $query = CGI::new(); +my $currExts = $query->cookie('exclTypes'); +my $EXTS = createExtForm("Audio", $currExts, @MUSIC).createExtForm("Video", $currExts, @VIDEO).createExtForm("Shortcut", $currExts, @SHORTCUT); + +$WEBPAGE =~ s/%EXTS%/$EXTS/; + +# server exclusion form +# + +foreach( keys %ALLPLATTERS ) +{ + chomp; + my @THISSERVER = split; + my $CHECKED = 'checked'; + if ($SERVERS =~ /"$THISSERVER[0]"/) { next;} + if ($exclude =~ /$THISSERVER[0]/) + { + $CHECKED = ''; + } + + $SERVERS.= ''.$THISSERVER[0].'
'; +} + +# Put in what we know +# +$WEBPAGE =~ s/%SERVERS%/$SERVERS/g; + + +# Display the finished Web page +# + +print $WEBPAGE; + +# Fin +# +close TEMPLATE; +exit; + +sub createExtForm() { + my ($TITLE, $CURR, @EXTS) = @_; + my $FORM = "
$TITLE:"; + my $ext; + foreach $ext ( @EXTS ) { + my $CHECKED = ' checked'; + $CHECKED = '' if ($CURR =~ /$ext,/); + $FORM.=' $ext \n"; + } + return $FORM."\n"; +} \ No newline at end of file -- cgit v1.2.3