# Blosxom Plugin: ss_selector # Author(s): mustan # Version: 2005-04-17 package ss_selector; use strict; use vars qw($header $debugMes $form); my (@styleTitle, @stylePath, @styleMedia); my $styleNum = 0; my ($form_label, $form_button, $form_accesskey, $no_styleTitle, $cookie_path, $use_xhtml, $xhtml_endTag); my (%COOKIES, %FORM); # --- Configurable variables ----- $form_label = 'Select Style'; # Character string displayed in label of form $form_accesskey = 'S'; # Key to activate selection box $form_button = 'submit'; # Character string displayed in submit button $no_styleTitle = 'No-Style'; # Character string when style is not applied $cookie_path = '/'; # Preservation path of Cookie $use_xhtml = 0; # 0: XHTML Mode is not Applied 1: XHTML Mode is Applied #&add_style('Style Title', 'Style URL', 'Media Type'); # ex)&add_style('WhiteBack', 'http://mustan.sakura.ne.jp/style/whiteback.css', 'screen,tv'); #--------------------------------- &add_style($no_styleTitle, "", ""); if($use_xhtml == 1){ $xhtml_endTag = ' /'; } &readForm(); &get_cookies(); sub start{ my $count; my $ss; my $f_findFirstStyle = 0; if($FORM{'ss'}){ for($count=0;$count<$styleNum;$count++){ if($FORM{'ss'} eq $styleTitle[$count]){ if($FORM{'ss'} ne $no_styleTitle){ $header = < OUTPUT } $f_findFirstStyle = 1; &set_cookie("ss", "$FORM{'ss'}", 30, $cookie_path); last; } } } elsif($COOKIES{'ss'}){ for($count=0;$count<$styleNum;$count++){ if($COOKIES{'ss'} eq $styleTitle[$count]){ if($COOKIES{'ss'} ne $no_styleTitle){ $header = < OUTPUT } $f_findFirstStyle = 1; &set_cookie("ss", "$styleTitle[$count]", 30, $cookie_path); last; } } } for($count=0;$count<$styleNum;$count++){ if($f_findFirstStyle == 0){ $header = < OUTPUT $f_findFirstStyle = 1; &set_cookie("ss", "$styleTitle[$count]", 30, $cookie_path); } elsif(($styleTitle[$count] ne $COOKIES{'ss'}) && ($stylePath[$count]) && ($f_findFirstStyle == 1)){ $header .= < OUTPUT } } $header =~ s/\n$//; 1; } sub filter{ my $options; my $count; $form = <

::label::

OUT if($form_label){ $form =~ s/::label::/