{'thumb'} eq 'ARRAY') { push @thumb_schemes, $_; } else { push @text_schemes, $_; } } # saving changes if (LJ::did_post()) { my $remote = LJ::get_remote(); # was a scheme change posted? my $scheme; if (exists $POST{'action:setscheme'}) { foreach (@text_schemes) { $scheme = $_->{'scheme'} if $POST{'scheme'} eq $_->{'scheme'}; } } else { foreach (@thumb_schemes) { $scheme = $_->{'scheme'} if exists $POST{"action:setscheme:$_->{'scheme'}.x"}; } } # set scheme if ($scheme) { my $cval = $scheme; # don't set cookie for default scheme if ($scheme eq $LJ::SCHEMES[0]->{'scheme'}) { $cval = ''; delete $COOKIE{'BMLschemepref'}; } # logged in? if ($remote) { # set a userprop to remember their schemepref LJ::set_userprop($remote, 'schemepref', $cval); # cookie expires when session expires if ($remote->{'_session'}->{'exptype'} eq 'long') { $cval = [ $scheme, $remote->{'_session'}->{'timeexpire'} ]; } } # set cookie $COOKIE{'BMLschemepref'} = $cval if $cval; # redirect to refresh cookie settings return $redir->(); } # set language if (exists $POST{'action:setlang'} && $POST{'lang'}) { my $l = LJ::Lang::get_lang($POST{'lang'}); return $redir->() unless $l; # default cookie value to set my $cval = $l->{'lncode'} . "/" . time(); # if logged in, change userprop and make cookie expiration # the same as their login expiration my $remote = LJ::get_remote(); if ($remote) { LJ::set_userprop($remote, "browselang", $l->{'lncode'}); if ($remote->{'_session'}->{'exptype'} eq 'long') { $cval = [ $cval, $remote->{'_session'}->{'timeexpire'} ]; } } # set cookie $COOKIE{'langpref'} = $cval; # set language through BML so it will apply immediately BML::set_language($l->{'lncode'}); } } # set title now that we have the correct language $title = $ML{'.title'}; # preferences page output # wrapper box to to keep tables from scrolling horizontally $body .= "
"; # scheme selector if (@LJ::SCHEMES) { $body .= ""; $body .= "
"; my $scheme = $BML::COOKIE{'BMLschemepref'}; $scheme = $LJ::SCHEMES[0]->{'scheme'} unless $scheme; if (@thumb_schemes) { my $ct = 0; my $cols = 3; my $width = int(100 / $cols +.5) . "%"; my $switch = @thumb_schemes / $cols; $body .= ""; $body .= ""; foreach my $sh (@thumb_schemes) { if ($ct == 0) { $body .= ""; $ct = 0; } } $body .= "
"; } my $th = $sh->{'thumb'}; $body .= "
{'title'} h2?> [1]; $body .= " height='$th->[2]'" if $th->[2]; if ($sh->{'scheme'} eq $scheme) { $body .= "style='border: solid 2px blue;' "; } else { $body .= "style='border: solid 1px black;' "; } my $alt = BML::ml('.scheme.preview', {'title' => $sh->{'title'},}); $body .= " alt='$alt' title='$sh->{'title'}'/>
"; if (++$ct >= $switch) { $body .= "
"; } if (@text_schemes) { my $ct = 0; my $cols = 3; my $width = int(100 / $cols +.5) . "%"; my $switch = @text_schemes / $cols; $body .= ""; $body .= ""; foreach my $sh (@text_schemes) { if ($ct == 0) { $body .= ""; $ct = 0; } } $body .= "
"; } $body .= "

" . LJ::html_check({ 'type' => 'radio', 'name' => 'scheme', 'value' => $sh->{'scheme'}, 'id' => "scheme-$sh->{'scheme'}", 'selected' => $scheme eq $sh->{'scheme'} }); $body .= "

"; if (++$ct >= $switch) { $body .= "
"; $body .= LJ::html_submit('action:setscheme', $ML{'.btn.scheme'}); $body .= "
"; } $body .= "
"; } # language selector $body .= ""; $body .= "
"; my $ct = 0; my $cols = 3; my $width = int(100 / $cols +.5) . "%"; my $switch = @LJ::LANGS / $cols; my $curr = BML::get_language(); $body .= ""; $body .= ""; my @inc; push @inc, $GET{'addlang'} if $GET{'addlang'}; foreach my $code (@LJ::LANGS, @inc) { my $l = LJ::Lang::get_lang($code); next unless $l; my $item = "langname.$code"; my $namethislang = BML::ml($item); my $namenative = LJ::Lang::get_text($l->{'lncode'}, $item); if ($ct == 0) { $body .= ""; $ct = 0; } } $body .= ""; $body .= "
"; } $body .= "

" . LJ::html_check({ 'type' => 'radio', 'name' => 'lang', 'value' => $code, 'id' => "sel_$code", 'selected' => $code eq $curr }); $body .= "

\n"; if (++$ct >= $switch) { $body .= "
"; $body .= LJ::html_submit('action:setlang', $ML{'.btn.lang'}); $body .= "
"; $body .= "
"; return; } _code?> body=> page?>