Wizard.pm 0000644 0000764 0000764 00000002715 10363316054 012242 0 ustar 00tandat tandat # ==================================================================
# Auto Generated Plugin Configuration - Needed for Web Based Creator.
#
# Plugins::SimplePages
# Author : Dat Tan Truong
# Version : 1.0
# Updated : Wed Jan 18 08:46:24 2006
#
# ==================================================================
#
package Plugins::SimplePages;
# ==================================================================
use strict;
use vars qw/$WIZARD/;
$WIZARD = {
'files' => [],
'hooks' => [
[
'create_home',
'POST',
'Plugins::SimplePages::build_pages',
undef
]
],
'install' => '',
'install_code' => '',
'menu' => [
[
'About',
'admin.cgi?do=plugin&plugin=SimplePages&func=showabout'
]
],
'meta' => {
'author' => 'Dat Tan Truong',
'description' => 'With this plugin, admin can built other static pages with almost up-to-date information.',
'license' => 'Commercial',
'prog_ver' => '3.0.4',
'url' => 'http://cgito.net',
'version' => '1.0'
},
'name' => 'SimplePages',
'uninstall' => '',
'uninstall_code' => '',
'user' => [
[
'Pages',
'terms.html,contact.html,advertising.html',
'Please enter the static pages to be built. Each one is separated by a comma',
'TEXT',
[],
[]
]
]
};
1;
Install.pm 0000644 0000764 0000764 00000006771 10363316760 012422 0 ustar 00tandat tandat # ==================================================================
# Plugins::SimplePages - Auto Generated Install Module
#
# Plugins::SimplePages
# Author : Dat Tan Truong
# Version : 1.0
# Updated : Wed Jan 18 08:46:24 2006
#
# ==================================================================
#
package Plugins::SimplePages;
# ==================================================================
use strict;
use vars qw/$VERSION $DEBUG $NAME $META/;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/:objects/;
$VERSION = '1.0';
$DEBUG = 0;
$NAME = 'SimplePages';
# Inhert from base class for debug and error methods
@Plugins::SimplePages::ISA = qw(GT::Base);
$META = {
'author' => 'Dat Tan Truong',
'description' => 'With this plugin, admin can built other static pages with almost up-to-date information.',
'license' => 'Commercial',
'prog_ver' => '3.0.4',
'url' => 'http://cgito.net',
'version' => '1.0'
};
sub pre_install {
# -----------------------------------------------------------------------------
# This function displays an HTML formatted message that will display any
# instructions/information to the user before they install the plugin.
#
my $inst_msg = '';
return $inst_msg;
}
sub pre_uninstall {
# -----------------------------------------------------------------------------
# This function displays an HTML formatted message that will display any
# instructions/information to the user before they remove the plugin.
#
my $uninst_msg = '';
return $uninst_msg;
}
sub install {
# -----------------------------------------------------------------------------
# This function does the actual installation. Its first argument is a plugin
# manager which you can use to register hooks, install files, add menu options,
# etc. The second argument is a GT::Tar object which you can use to access any
# files in your plugin module.
#
# You should return an HTML formatted string that will be displayed to the
# user.
#
# If there is an error, return undef, and set the error message in
# $Plugins::SimplePages::error
#
my ($mgr, $tar) = @_;
$mgr->install_hooks('SimplePages', [['create_home', 'POST', 'Plugins::SimplePages::build_pages', '']]);
$mgr->install_menu('SimplePages', [['About', 'admin.cgi?do=plugin&plugin=SimplePages&func=showabout']]);
$mgr->install_options('SimplePages', [['Pages', 'terms.html,contact.html,advertising.html', 'Please enter the static pages to be built. Each one is separated by a comma', 'TEXT', [], [], '']]);
;
return "The plugin has been successfully installed!";
}
sub uninstall {
# -----------------------------------------------------------------------------
# This function removes the plugin. Its first argument is also a plugin
# manager which you can use to register hooks, install files, add menu options,
# etc. You should return an HTML formatted string that will be displayed to the
# user.
#
# If there is an error, return undef, and set the error message in
# $Plugins::SimplePages::error
#
my $mgr = shift;
$mgr->uninstall_hooks('SimplePages', [['create_home', 'POST', 'Plugins::SimplePages::build_pages', '']]); $mgr->uninstall_menu('SimplePages', [['About', 'admin.cgi?do=plugin&plugin=SimplePages&func=showabout']]);
$mgr->uninstall_options('SimplePages', [['Pages', 'terms.html,contact.html,advertising.html', 'Please enter the static pages to be built. Each one is separated by a comma', 'TEXT', [], [], '']]);
;
return "The plugin has been successfully removed!";
}
1;
SimplePages.pm 0000644 0000764 0000764 00000004340 10363316760 013213 0 ustar 00tandat tandat # ==================================================================
# Plugins::SimplePages - Auto Generated Program Module
#
# Plugins::SimplePages
# Author : Dat Tan Truong
# Version : 1.0
# Updated : Wed Jan 18 08:46:24 2006
#
# ==================================================================
#
package Plugins::SimplePages;
# ==================================================================
use strict;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use Links::Plugins;
use Links qw/:objects/;
# Inherit from base class for debug and error methods
@Plugins::SimplePages::ISA = qw(GT::Base);
# Your code begins here.
# PLUGIN HOOKS
# ===================================================================
sub build_pages {
# -----------------------------------------------------------------------------
# This subroutine will be called whenever the hook 'create_home' is run. You
# should call $PLG->action(STOP) if you don't want the regular
# 'create_home' code to run, otherwise the code will continue as normal.
#
my (@args) = @_;
### do no thing special but trigger this to create static page
my @pages = split(',',Links::Plugins::get_plugin_user_cfg('SimplePages')->{Pages});
foreach my $p(@pages){
next unless($p =~ /\w+\.\w+$/);
print qq|Creating page:$p....|;
my $des = "$CFG->{build_static_path}/$p";
open(my $fh,">$des") or next;
print $fh Links::user_page($p,{%$CFG});
close($fh);
print "Done.\n
";
}
return @args;
}
# ADMIN MENU OPTIONS
# ===================================================================
sub showabout {
# -------------------------------------------------------------------
# This subroutine will be called whenever the user clicks on 'About' in the
# admin menu. Remember, you need to print your own HTTP header; to do so you
# can use:
#
print $IN->header();
#
print qq|
With this, admin can add more static pages like contact, terms, etc into the template set and have the building function generated them with Glinks settings.
That's it!
Cheers,
Dat at dat\@cgito.net
http://cgito.net