? Earlier 2 items total Later ?

On this page:?

Improved admin_tools for Scoop

If you've ever built a site with Scoop, you know that all that messy hard-coded table-based HTML can be a pain. In the course of building several Scoop sites I've been reworking some of the common boxes to use cleaner, easily-styled, semantic markup, and this seems as good a place as any to post the code.

Here's a reworked admin_tools which outputs as an unordered list (and puts the "edit user" form in a definition list):

my $content;
my @tools = sort { $a->{pos} <=> $b->{pos} } values %{ $S->{ADMIN_TOOLS} };
foreach my $t (@tools) {
        if ( $S->have_perm($t->{perm}) ) {
                $content .= qq\|
        
  • $t->{menuname}
  • \|; } } if ($S->have_perm('edit_user')) { $content .= qq{
  • Edit User:
  • }; } return '' unless $content; return{content=>qq{
      $content
    }};

    Improved user_box for Scoop

    If you've ever built a site with Scoop, you know that all that messy hard-coded table-based HTML can be a pain. In the course of building several Scoop sites I've been reworking some of the common boxes to use cleaner, easily-styled, semantic markup, and this seems as good a place as any to post the code.

    Here's a reworked user_box which outputs the tools menu as an unordered list:

    my $content;
    if ($S->{UID} > 0) {
      if ($S->have_perm('moderate')) {
        my ($nstories, $tstories) = $S->_count_new_sub();
        my $color = '';
        my $c_end = '';
        if ($nstories) {
           $color = '';
           $c_end = '';
        }
        $content = qq\|\|;
    
        $title = $S->{NICK};
    } else {
        $content = $S->{UI}->{BLOCKS}->{login_box};
        $content =~ s/|LOGIN_ERROR|/$S->{LOGIN_ERROR}/;
    }
    return {content => $content, title => $title };

    ? Earlier 2 items total Later ?