[Subversion] / DadaFork / plugins / boilerplate_plugin.cgi  

View of /DadaFork/plugins/boilerplate_plugin.cgi

Parent Directory | Revision Log
Revision: 2253 - (download)
Wed Jan 10 14:34:26 2007 UTC (17 years, 3 months ago) by pje
File size: 2557 byte(s)
Base version: DadaMail 2.10.12
#!/usr/bin/perl -w
use strict; 

# make sure the DADA lib is in the lib paths!
use lib qw(./ ./DADA ../ ../DADA ../DADA/perllib); 

# use some of those Modules
use DADA::Config;
use DADA::Template::HTML; 
use DADA::App::Guts;
use DADA::MailingList::Settings; 

# we need this for cookies things
use CGI; 
my $q = new CGI; 


# This will take care of all out security woes
my ($admin_list, $root_login) = check_list_security(-cgi_obj  => $q, 
                                                    -Function => 'boilerplate');
my $list = $admin_list; 

# get the list information
my $ls = DADA::MailingList::Settings->new(-List => $list); 
my $li = $ls->get; 
                             
# header     
print(admin_html_header(-Title      => "Admin Plugin Example",
		                -List       => $li->{list},
		                -Form       => 0,
		                -Root_Login => $root_login));
	               
if(!$q->param('process')){ 

print $q->p('I echo whatever you type in:') . 
      $q->start_form()                                        . 
      $q->textfield('echo')                                   . 
	  $q->hidden('process', 'true')                           .
	  $q->submit('echo away!')                                .
	  $q->end_form(); 
}else{ 

	print $q->h1($q->escapeHTML($q->param('echo'))); 
}

#footer
print admin_html_footer(-List => $list, -Form => 0); 


=pod

=head1 Roll Your Own Admin Screen

This should give you a good idea on how to extend Dada Mail's admin area to do.... anything 

There is an example on how to make the actual admin screen + script, it's called 

B<boilerplate_plugin.cgi> 

and should be located in the B<dada/extras/scripts/> directory It should work right out of the box, upload it, chmod 755 it and follow the next set of directions to make it work

=head2 Adding this Module to Dada Mail

You'll need to tweak the $ADMIN_MENU variable in the Config.pm file, $ADMIN_MENU is a reference to an array of hashes of an array of hashes, or somewhere in there. 

Follow the pattern :) 

Adding this right after the last array ref entry: 

	 {-Title           => 'Boilder Plate Example', 
	   -Title_URL      => "plugins/boilerplate_plugin.cgi",
	   -Function       => 'boilerplate',
	   -Activated      => 1, 
	  },
	  
will do the trick, as long as you uploaded B<boilerplate_plugin.cgi> in the same directory as mail.cgi. It's better to give the absolute URL for these things, I think. Upload the revised Config.pm file and there should be a link for this very module. Pretty frickin cool, eh?

=cut



cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help