AdminToggle messages can be overridden.

This commit is contained in:
JT Smith 2002-08-14 00:52:46 +00:00
parent 8afc63abd5
commit 86031b1299

View file

@ -7,33 +7,38 @@ package WebGUI::Macro::AdminToggle;
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::URL;
#-------------------------------------------------------------------
sub _replacement {
my ($temp);
if (WebGUI::Privilege::isInGroup(4)) {
if ($session{var}{adminOn}) {
$temp = '<a href="'.WebGUI::URL::page('op=switchOffAdmin').'">'.WebGUI::International::get(517).'</a>';
} else {
$temp = '<a href="'.WebGUI::URL::page('op=switchOnAdmin').'">'.WebGUI::International::get(516).'</a>';
}
}
return $temp;
my ($temp, @param, $turnOn, $turnOff);
if (WebGUI::Privilege::isInGroup(4)) {
@param = WebGUI::Macro::getParams($_[0]);
if ($session{var}{adminOn}) {
$turnOff = $param[1] || WebGUI::International::get(517);
$temp = '<a href="'.WebGUI::URL::page('op=switchOffAdmin').'">'.$turnOff.'</a>';
} else {
$turnOn = $param[0] || WebGUI::International::get(516);
$temp = '<a href="'.WebGUI::URL::page('op=switchOnAdmin').'">'.$turnOn.'</a>';
}
}
return $temp;
}
#-------------------------------------------------------------------
sub process {
my ($output, $temp);
$output = $_[0];
$output =~ s/\^AdminToggle\;/_replacement()/ge;
return $output;
my ($output, $temp);
$output = $_[0];
$output =~ s/\^AdminToggle\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^AdminToggle\;/_replacement()/ge;
return $output;
}
1;