package Labyrinth::Support; use warnings; use strict; use vars qw($VERSION @ISA %EXPORT_TAGS @EXPORT @EXPORT_OK); $VERSION = '5.32'; =head1 NAME Labyrinth::Support - Common Function Library for Labyrinth. =head1 SYNOPSIS use Labyrinth::Support; =head1 DESCRIPTION The functions contain herein are commonly used throughout Labyrinth and plugins. =head1 EXPORT AlignName AlignClass AlignSelect PublishState PublishSelect PublishAction FieldCheck ParamCheck AuthorCheck MasterCheck AccessName AccessID AccessUser AccessGroup AccessSelect AccessAllFolders AccessAllAreas RealmCheck RealmSelect RealmName RealmID ProfileSelect FolderName FolderID FolderSelect AreaSelect =cut # ------------------------------------- # Export Details require Exporter; @ISA = qw(Exporter); %EXPORT_TAGS = ( 'all' => [ qw( AlignName AlignClass AlignSelect PublishState PublishSelect PublishAction FieldCheck ParamCheck AuthorCheck MasterCheck AccessName AccessID AccessUser AccessGroup AccessSelect AccessAllFolders AccessAllAreas RealmCheck RealmSelect RealmName RealmID ProfileSelect FolderName FolderID FolderSelect AreaSelect ) ] ); @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); @EXPORT = ( @{ $EXPORT_TAGS{'all'} } ); # ------------------------------------- # Library Modules use Time::Local; use Labyrinth::Audit; use Labyrinth::Globals; use Labyrinth::Groups; use Labyrinth::MLUtils; use Labyrinth::Session; use Labyrinth::Writer; use Labyrinth::Variables; # ------------------------------------- # The Subs =head1 FUNCTIONS =over 4 =item PublishState Returns the name of the current publish state, given the numeric state. =item PublishSelect Provides a dropdown selection box, as a XHTML code snippet, of the currently available publishing states. =item PublishAction Provides a dropdown selection box, as a XHTML code snippet, of the currently accessible publishing states. =cut my %publishstates = ( 1 => {Action => 'Draft', State => 'Draft' }, 2 => {Action => 'Submit', State => 'Submitted' }, 3 => {Action => 'Publish', State => 'Published' }, 4 => {Action => 'Archive', State => 'Archived' }, ); my @states = map {{'id'=>$_,'value'=> $publishstates{$_}->{State}}} sort keys %publishstates; sub PublishState { my $state = shift; return '' unless($state); return $publishstates{$state}->{State}; } sub PublishSelect { my ($opt,$blank) = @_; my @list = @states; unshift @list, {id=>0,value=>'Select Status'} if(defined $blank && $blank == 1); DropDownRows($opt,'publish','id','value',@list); } sub PublishAction { my $opt = shift || 1; my $ack = shift || -1; my $html = qq{