webgui/lib/WebGUI/Macro/r.pm
2001-10-02 04:28:00 +00:00

44 lines
1.4 KiB
Perl

package WebGUI::Macro::r;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001 Plain Black Software.
#-------------------------------------------------------------------
# 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::Session;
#-------------------------------------------------------------------
sub process {
my ($output, $temp);
$output = $_[0];
#---remove style for printing link---
if ($output =~ /\^r(.*)\^\/r/) {
$temp = $session{env}{REQUEST_URI};
if ($temp =~ /\?/) {
$temp .= '&makePrintable=1';
} else {
$temp .= '?makePrintable=1';
}
$temp = '<a href="'.$temp.'">'.$1.'</a>';
$output =~ s/\^r(.*)\^\/r/$temp/g;
} elsif ($output =~ /\^r/) {
$temp = $session{env}{REQUEST_URI};
if ($temp =~ /\?/) {
$temp .= '&makePrintable=1';
} else {
$temp .= '?makePrintable=1';
}
$temp = '<a href="'.$temp.'">Make Page Printable</a>';
$output =~ s/\^r/$temp/g;
}
return $output;
}
1;