This was supposed to be added in 4.6.0, but we forgot to check it in to CVS.
This commit is contained in:
parent
99b5fe1c91
commit
8b1a43f500
1 changed files with 43 additions and 0 deletions
43
lib/WebGUI/Macro/LoginToggle.pm
Normal file
43
lib/WebGUI/Macro/LoginToggle.pm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package WebGUI::Macro::LoginToggle;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black LLC.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my (@param, $temp, $login, $logout);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($session{user}{userId} == 1) {
|
||||
$login = $param[0] || WebGUI::International::get(716);
|
||||
$temp = '<a class="loginToggleLink" href="'.WebGUI::URL::page('op=displayLogin').'">'.$login.'</a>';
|
||||
} else {
|
||||
$logout = $param[1] || WebGUI::International::get(717);
|
||||
$temp = '<a class="loginToggleLink" href="'.WebGUI::URL::page('op=logout').'">'.$logout.'</a>';
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^LoginToggle\((.*?)\)\;/_replacement($1)/ge;
|
||||
$output =~ s/\^LoginToggle\;/_replacement()/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue