summaryrefslogtreecommitdiff
path: root/cgi-bin/settings.plx
diff options
context:
space:
mode:
authorunknown <andrew@.cern.ch>2011-06-21 16:33:26 +0200
committerunknown <andrew@.cern.ch>2011-06-21 16:33:26 +0200
commitfa170afd817648f306e322802ca85b6abbd37f74 (patch)
tree44a68e68859429bc5f6bcb164111bcb8df1ee165 /cgi-bin/settings.plx
Initial commit
Diffstat (limited to 'cgi-bin/settings.plx')
-rw-r--r--cgi-bin/settings.plx92
1 files changed, 92 insertions, 0 deletions
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.="<tr valign=\"top\"><td><input type=\"radio\" name=\"playlist\" value=\"ext$thisformat\" ".
+ "onClick=\"setCookie('format', 'ext$thisformat'); \">".
+ "</td><td><b>$thisformat</b></td><td>$desc</td></tr>\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.= '<input type="checkbox" name="'.$THISSERVER[0].'" onClick="setServers()" '.$CHECKED.'><a href="search.plx?searchFor=artist&inv='.$THISSERVER[0].
+ '&output=artistlist"><b><i>'.$THISSERVER[0].'</i></b></a><br>';
+}
+
+# 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 = "<br><strong>$TITLE:</strong>";
+ my $ext;
+ foreach $ext ( @EXTS ) {
+ my $CHECKED = ' checked';
+ $CHECKED = '' if ($CURR =~ /$ext,/);
+ $FORM.='&nbsp;<input type="checkbox" name="'.$ext.'" onClick="setExts()"'.$CHECKED."><b><i>$ext</i></b>&nbsp;\n";
+ }
+ return $FORM."\n";
+} \ No newline at end of file