<?_code
 
 my $styleid = $FORM{'styleid'}+0;
 my $remote = LJ::get_remote();

 my $sty = LJ::S1::get_style($styleid); 
 my $styu = LJ::load_user($sty->{user}) if $sty; # if $sty so we don't auto-vivify!
 return "Style $styleid does not exist or is not public."
    unless $sty && 
          ($sty->{is_public} eq 'Y' ||       # straight up public
           LJ::u_equals($remote, $styu) ||   # is this your account?
           LJ::can_manage($remote, $styu) || # how about your community?
           LJ::check_priv($remote, 'canview', 'styles') || # can you see private styles?
           LJ::check_priv($remote, 'canview', '*'));       # or maybe you can see everything

 my $ret = "";
 $ret .= "<H1>Style Info</H1>\n";

 $ret .= "<DL>\n";
 $ret .= "<DT><B>Author</B><DD><A TARGET=_top HREF=\"$LJ::SITEROOT/userinfo.bml?user=$sty->{'user'}\">$sty->{'user'}</A>\n";
 $ret .= "<DT><B>Style Description</B><DD>$sty->{'styledes'}<BR>\n";
 $ret .= "<DT><B>Last Updated</B><DD>$sty->{'lastupdate'}<BR>\n";
 $ret .= "<DT><B>View Type</B><DD>$sty->{'type'}<BR>\n";
 $ret .= "<DT><B>Public?</B><DD>$sty->{'is_public'}<BR>\n";
 $ret .= "<DT><B>Embeddable?</B><DD>$sty->{'is_embedded'}<BR>\n";
 $ret .= "<DT><B>Color-free? (only uses color themes, not fixed colors)</B><DD>$sty->{'is_colorfree'}<BR>\n";
 $ret .= "</DL>";

 my %vars;
 LJ::parse_vars(\$sty->{'formatdata'}, \%vars);

 $ret .= "<H1>Style Variables</H1>\n";

 foreach my $v (sort keys %vars) {
     $ret .= "<H2>$v</H2>\n";
     my $val = LJ::ehtml($vars{$v});
     $val =~ s/\n/<BR>\n/g;
     $ret .= $val;     
 }

 return $ret; 

_code?><?_c <LJDEP>
link: htdocs/userinfo.bml
</LJDEP> _c?>
