MOJO::Widgets::Admin_Menu

- NAME MOJO::Widgets::Admin_Menu
- SYNOPSIS
- DESCRIPTION
- SUBROUTINES
- COPYRIGHT

# NAME MOJO::Widgets::Admin_Menu

# SYNOPSIS

            use MOJO:Widgets::Admin_Menu

# DESCRIPTION

This module creates the Admin Menu for the List Control Panel. It also packs data so it can be saved

# SUBROUTINES

make_nav_hashes
  a pretty private sub, returns 2 references to hashes from saved information and defaults

check_function_permissions

              my $function_permissions = check_function_permissions(-List_Ref => \%list_info,
                                                                                                                        -Function => $args{-Function});
                      if ($function_permissions < 1){
                              $problems++;
                      }

make_admin_menu

                      $ADMIN_MENU = MOJO::Widgets::Admin_Menu::make_admin_menu('superuser');

                      $ADMIN_MENU = MOJO::Widgets::Admin_Menu::make_admin_menu('user',\%list_info);

      If the superuse is specified, all menu items will be active, if not, what will be
      active will be determined by the \%list_info (the settings)

  this returns an html menu

      =cut

  sub make_admin_menu {

              my $permissions = shift;
              my $list_info_ref = shift;

              my ($NAVS, $SUBNAVS) = make_nav_hashes($list_info_ref);
              my $menu;
              #walk through the complex data structures..
              foreach my $nav(@$ADMIN_MENU){
                      my $nav_entry;
                      if($nav->{-Title}){
                              if(exists($NAVS->{$nav->{-Title}})){$nav->{-Activated} = $NAVS->{$nav->{-Title}}}
                              $nav->{-Activated} = 1 if($permissions eq 'superuser');
                              if($nav->{-Activated} == 1){
                                      if($nav->{-Title_URL}){
                                              $nav_entry = "<p><b><a href='$nav->{-Title_URL}'>$nav->{-Title}</a></b>\n";
                                      }else{
                                              $nav_entry = "<p><b>$nav->{-Title}</b>\n";
                                      }
                                      $menu .= $nav_entry;
                                      foreach my $subnav(@{$nav->{-Submenu}}){
                                              my $subnav_entry;
                                              if($subnav->{-Title}){
                                                      if(exists($SUBNAVS->{$subnav->{-Title}})){$subnav->{-Activated} = $SUBNAVS->{$subnav->{-Title}}}
                                                              $subnav->{-Activated} = 1 if($permissions eq 'superuser');
                                                      if($subnav->{-Activated} == 1){
                                                              if($subnav->{-Title_URL}){
                                                              $subnav_entry = "<br>&nbsp;<a href='$subnav->{-Title_URL}'>$subnav->{-Title}</a>\n";
                                                              }else{
                                                              $subnav_entry = "<br>&nbsp;$subnav->{-Title}\n";
                                                              }
                                                      $menu .= $subnav_entry
                                                      }
                                              }
                                      }
                              $menu .= '</p>';
                              }
                      }
              }

              return $menu;
      }

make_feature_menu
  print make_feature_menu(\%list_info);

  creates a form to allow you to turn on and off features of the admin menu

              foreach(@params){$param_hash{$_} = $q->param($_);}
              my $save_set = create_save_set(\%param_hash);
              my %new_info = (list => $list, admin_menu => $save_set);
              setup_list(\%new_info);

  creates a packed string to save admin menu information, The format is really weird,

  take mi word for it.

# COPYRIGHT

Copyright (c) 1999 - 2002 Justin Simoni (justin@skazat.com) http://skazat.com All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.