HTML-WWWTheme

 view release on metacpan or  search on metacpan

WWWTheme.pm  view on Meta::CPAN

    $navthingy .= "<B>Next:</B>$self->{nextlink}\n"     if ($self->{nextlink});
    $navthingy .= "</NOBR><HR></CENTER>";
    return $navthingy;
  }

##############################################################################
#
# This creates the navigation bar to be found at the top and bottom of the 
# page.  It's usually called directly (eg. Apache::SetWWWTheme calls it directly)

sub MakeTopBottomBar
  {
    my $self = shift;
    return '' unless (@{$self->{topbottomlinks}});
    my $bar = "<!-- Beginning of top/bottom bar -->\n<CENTER>";
    foreach my $link (@{$self->{topbottomlinks}})
      {
	$bar .= "$link<BR>";
      }
    $bar .= "</CENTER>\n<!-- End of top/bottom bar -->";
    return $bar;
  }

##############################################################################
#
# This footer must always be used, since it closes off all the table stuff
# that we created in the MakeHeader.  It really doesn't do much else, except
# it throws in the "return to top...." bit.  
#

sub MakeFooter
  {
    my $self = shift;
    my $endbody;
    $endbody  = "</TD></TABLE></TD></TR></TABLE>";
    $endbody .= '<DIV ALIGN="left"><H6><A HREF=' . $self->{printablename};
    $endbody .= ">click here for a printable version...</A></H6></DIV>";
    $endbody .= '<DIV ALIGN="right"><H6><A HREF="#top">return to top...</A></H6></DIV>';
    $endbody .= "</BODY>";
    
    return $endbody;
  }
    


##############################################################################
#
# This allows us to read everything from a file, if so desired.  This way
# you can drop configs into a file, and then just edit the file instead of
# changing source code for any cgis that call this module.
#

sub GetConfiguration
  {
    my $self = shift;
    while (@_)
      {
	$self->{configfile} = shift;

	open (CONFIG, $self->{configfile}) || carp "couldn't open server config $self->{configfile}" && return 0;
	local $/ = "";
	
	while (<CONFIG>)
	  {
	    ( /\@BLANKGIF\s*=\s*(.*?);/s )           && ($self->{blankgif}         = $1);
	    ( /\@NAVBAR\s*=\s*(.*?);/s )             && ($self->{usenavbar}        = $1);
	    ( /\@NEXTLINK\s*?=\s*?(.*?);/s )         && ($self->{nextlink}         = $1);
	    ( /\@LASTLINK\s*?=\s*?(.*?);/s )         && ($self->{lastlink}         = $1);
	    ( /\@UPLINK\s*?=\s*?(.*?);/s )           && ($self->{uplink}           = $1);
	    
	    ( /\@BGCOLOR\s*=\s*(.*?);/s )            && ($self->{bgcolor}          = $1);
	    ( /\@BGPICTURE\s*=\s*(.*?);/s )          && ($self->{bgpicture}        = $1);
	    ( /\@BACKGROUND\s*=\s*(.*?);/s )         && ($self->{bgpicture}        = $1);	  
	    ( /\@ALINK\s*=\s*(.*?);/s )              && ($self->{alink}            = $1);
	    ( /\@LINK\s*=\s*(.*?);/s )               && ($self->{"link"}           = $1);
            ( /\@TEXT\s*=\s*(.*?);/s )               && ($self->{text}             = $1);
            ( /\@VLINK\s*=\s*(.*?);/s )              && ($self->{vlink}            = $1);
	    
	    ( /\@SIDEBARTOP\s*?=\s*?(.*?);/s )       && ($self->{sidebartop}       = $1);
	    ( /\@SIDEBARMENUTITLE\s*?=\s*?(.*?);/s ) && ($self->{sidebarmenutitle} = $1);
	    ( /\@MORELINKSTITLE\s*?=\s*?(.*?);/s )   && ($self->{morelinkstitle}   = $1);
	    ( /\@SEARCHTEMPLATE\s*?=\s*?(.*?);/s )   && ($self->{searchtemplate}   = $1);
	    ( /\@SIDEBARSEARCHBOX\s*?=\s*?(.*?);/s ) && ($self->{sidebarsearchbox} = $1);
	    ( /\@SIDEBARCOLOR\s*?=\s*?(.*?);/s )     && ($self->{sidebarcolor}     = $1);
	    ( /\@SIDEBARWIDTH\s*?=\s*?(.*?);/s )     && ($self->{sidebarwidth}     = $1);

	    ( /\@NOSIDEBAREXTRAS\s*?=\s*?(.*?);/s)   && ($self->{nosidebarextras}  = $1);

	    my (@links, @sides);
	    ( /\@INFO\s*?=\s*?(.*?);/s )             && (@links = split(',',$1)) && ($self->{infolinks} = \@links);	   
	    ( /\@SIDEBARMENULINKS\s*?=\s*?(.*?);/s ) && (@sides = split(',',$1)) && ($self->{sidebarmenulinks} = \@sides);
	  }
      }
    close CONFIG;
    return 1;
  } #GetConfiguration
		      
##############################
# all of my mutator methods.

sub SetSearchTemplate
  {
    my $self = shift;
    $self->{searchtemplate} = shift if (@_);
    return $self->{blankgif};
  }

sub SetBlankGif
  {
    my $self = shift;
    $self->{blankgif} = shift if (@_);
    return $self->{blankgif};
  }

sub SetNextLink
  {
    my $self = shift;
    $self->{nextlink} = shift if (@_);
    return $self->{nextlink};
  }



( run in 2.999 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )