Added the RootTab, RandomSnippet, RandomImage, CanEditText, If, Spacer, SpecificDropMenu, TopDropMenu, LastModified, PreviousDropMenu, and SI (scaled image) macros.
This commit is contained in:
parent
ff6a6e45ea
commit
6d234e929d
15 changed files with 564 additions and 6 deletions
|
|
@ -30,6 +30,7 @@ Contributing Developers..............Peter Beardsley / Appropriate Solutions
|
|||
Ben Simpson
|
||||
Jeff Szpak / Plain Black
|
||||
Sean Tu / WDI
|
||||
Madsen Wikholm
|
||||
|
||||
Contributing Translators.............AGOFER Ltda.
|
||||
Natalia Almazova
|
||||
|
|
|
|||
35
docs/upgrades/upgrade_5.2.5-5.3.0.pl
Normal file
35
docs/upgrades/upgrade_5.2.5-5.3.0.pl
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use lib "../../lib";
|
||||
use Getopt::Long;
|
||||
use Parse::PlainConfig;
|
||||
use strict;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
||||
my $configFile;
|
||||
my $quiet;
|
||||
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
|
||||
print "\tUpdating config file.\n" unless ($quiet);
|
||||
|
||||
my $pathToConfig = '../../etc/'.$configFile;
|
||||
my $conf = Parse::PlainConfig->new('DELIM' => '=', 'FILE' => $pathToConfig);
|
||||
my $macros = $conf->get("macros");
|
||||
$macros->{RootTab} = "RootTab";
|
||||
$macros->{RandomSnippet} = "RandomSnippet";
|
||||
$macros->{RandomImage} = "RandomImage";
|
||||
$macros->{CanEditText} = "CanEditText";
|
||||
$macros->{If} = "If";
|
||||
$macros->{Spacer} = "Spacer";
|
||||
$macros->{SpecificDropMenu} = "SpecificDropMenu";
|
||||
$macros->{LastModified} = "LastModified";
|
||||
$macros->{PreviousDropMenu} = "PreviousDropMenu";
|
||||
$macros->{TopDropMenu} = "TopDropMenu";
|
||||
$macros->{SI} = "SI_scaledImage";
|
||||
$conf->set("macros"=>$macros);
|
||||
$conf->write;
|
||||
File diff suppressed because one or more lines are too long
31
lib/WebGUI/Macro/CanEditText.pm
Normal file
31
lib/WebGUI/Macro/CanEditText.pm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package WebGUI::Macro::CanEditText;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Privilege;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
return $param[0];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
35
lib/WebGUI/Macro/If.pm
Normal file
35
lib/WebGUI/Macro/If.pm
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package WebGUI::Macro::If;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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 Safe;
|
||||
use WebGUI::Macro;
|
||||
|
||||
sub process {
|
||||
my ($expression, $true, $false) = WebGUI::Macro::getParams(shift);
|
||||
my $output = $false;
|
||||
|
||||
# Workaround to "Safely" eval $expression
|
||||
my $compartment = new Safe;
|
||||
my $return = $compartment->reval($expression);
|
||||
|
||||
return "<p><b>If Macro failed:</b> $@ <p>Expression: $expression
|
||||
<br>Display if true: $true<br>Display if false: $false" if ($@);
|
||||
|
||||
$output = $true if ($return);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
37
lib/WebGUI/Macro/LastModified.pm
Normal file
37
lib/WebGUI/Macro/LastModified.pm
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package WebGUI::Macro::LastModified;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::DateTime;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($label, $format, $time, $output);
|
||||
|
||||
($label, $format) = WebGUI::Macro::getParams(shift);
|
||||
$format = '%z' if ($format eq "");
|
||||
$output = "";
|
||||
|
||||
($time) = WebGUI::SQL->quickArray("SELECT max(lastEdited) FROM wobject where pageId=$session{page}{pageId}");
|
||||
if ($time) {
|
||||
$output = $label.epochToHuman($time,$format);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
64
lib/WebGUI/Macro/PreviousDropMenu.pm
Normal file
64
lib/WebGUI/Macro/PreviousDropMenu.pm
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package WebGUI::Macro::PreviousDropMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::Macro;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _draw {
|
||||
my ($output, $i, $padding, $pageId);
|
||||
my ($tree, $indent, $maxDepth, $currentDepth) = @_;
|
||||
unless ($currentDepth >= $maxDepth) {
|
||||
for ($i=1;$i<=$indent;$i++) {
|
||||
$padding .= " ";
|
||||
}
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$output .= '<option value="'.$tree->{$pageId}{url}.'">';
|
||||
$output .= $padding."- ".$tree->{$pageId}{title};
|
||||
$output .= '</option>';
|
||||
$output .= _draw($tree->{$pageId}{sub}, ($indent+1), $maxDepth, ($currentDepth+1));
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$param[2] = 99 unless ($param[2]);
|
||||
if ($param[0] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},$param[0]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($session{page}{parentId},1);
|
||||
}
|
||||
$temp = '<script language="JavaScript" type="text/javascript">
|
||||
function go(formObj){
|
||||
if (formObj.chooser.options[formObj.chooser.selectedIndex].value != "none") {
|
||||
location = formObj.chooser.options[formObj.chooser.selectedIndex].value
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$temp .= '<form><select name="chooser" size=1 onChange="go(this.form)">';
|
||||
$temp .= '<option value=none>Where do you want to go?';
|
||||
$temp .= _draw($tree,0,$param[1]);
|
||||
$temp .= '</select></form>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -20,8 +20,15 @@ use WebGUI::SQL;
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my ($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder where name=".quote($param[0]));
|
||||
my @images = WebGUI::SQL->buildArray("select collateralId from collateral where collateralType='image' and collateralFolderId=".$collateralFolderId);
|
||||
my $collateralFolderId;
|
||||
if ($param[0] ne "") {
|
||||
($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder
|
||||
where name=".quote($param[0]));
|
||||
} else {
|
||||
$collateralFolderId = 0; #Root
|
||||
}
|
||||
my @images = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='image' and collateralFolderId=".$collateralFolderId);
|
||||
my $collateral = WebGUI::Collateral->new($images[rand($#images+1)]);
|
||||
return '<img src="'.$collateral->getURL.'" '.$collateral->get("parameters").' />';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,15 @@ use WebGUI::SQL;
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my ($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder where name=".quote($param[0]));
|
||||
my @snippets = WebGUI::SQL->buildArray("select collateralId from collateral where collateralType='snippet' and collateralFolderId=".$collateralFolderId);
|
||||
my $collateralFolderId;
|
||||
if ($param[0] ne "") {
|
||||
($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder
|
||||
where name=".quote($param[0]));
|
||||
} else {
|
||||
$collateralFolderId = 0; #Root
|
||||
}
|
||||
my @snippets = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='snippet' and collateralFolderId=".$collateralFolderId);
|
||||
my $collateral = WebGUI::Collateral->new($snippets[rand($#snippets+1)]);
|
||||
return $collateral->get("parameters");
|
||||
}
|
||||
|
|
|
|||
59
lib/WebGUI/Macro/RootTab.pm
Normal file
59
lib/WebGUI/Macro/RootTab.pm
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package WebGUI::Macro::RootTab;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _draw {
|
||||
my ($tree, $root) = @_;
|
||||
#my $output;# = '<table class="rootTab"><tr>';
|
||||
my $output;# = '<div class="rootTabs">';
|
||||
foreach my $key (keys %{$tree}) {
|
||||
$output .= ' <span class="';
|
||||
if ($root == $key) {
|
||||
$output .= "rootTabOn";
|
||||
} else {
|
||||
$output .= "rootTabOff";
|
||||
}
|
||||
$output .= '">';
|
||||
$output .= '<a href="'.$tree->{$key}{url}.'">'.$tree->{$key}{title}.'</a>';
|
||||
$output .= '</span> ';
|
||||
}
|
||||
#$output .= '</div>';
|
||||
#$output .= '</tr></table>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _findRoot {
|
||||
my ($pageId,$parentId) = WebGUI::SQL->quickArray("select pageId,parentId from page where pageId=$_[0]");
|
||||
if ($parentId == 0) {
|
||||
return $pageId;
|
||||
} else {
|
||||
return _findRoot($parentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $root = _findRoot($session{page}{pageId});
|
||||
my $tree = WebGUI::Navigation::tree(0,1);
|
||||
return _draw($tree,$root);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
124
lib/WebGUI/Macro/SI_scaledImage.pm
Normal file
124
lib/WebGUI/Macro/SI_scaledImage.pm
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
package WebGUI::Macro::SI_scaledImage;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::Collateral;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Session;
|
||||
|
||||
# test for Image::Magick
|
||||
|
||||
# (Would be nice if the results of this test were availiable somewhere
|
||||
# central)
|
||||
|
||||
my $hasImageMagick=1;
|
||||
eval " use Image::Magick; "; $hasImageMagick=0 if $@;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getImage {
|
||||
my ($collateral) = @_;
|
||||
return undef unless ($hasImageMagick);
|
||||
my $image = Image::Magick->new();
|
||||
if (my $error = $image->Read($collateral->getPath)) {
|
||||
WebGUI::ErrorHandler::warn("Couldn't read image for resizing: ".$error);
|
||||
return undef;
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($collateralIdent,$width,$height,$parameters) = WebGUI::Macro::getParams($_[0]);
|
||||
my ($collateral,$url);
|
||||
|
||||
if ($collateralIdent =~ /^\d+$/) {
|
||||
$collateral = WebGUI::Collateral->new($collateralIdent);
|
||||
}
|
||||
else {
|
||||
$collateral = WebGUI::Collateral->find($collateralIdent);
|
||||
}
|
||||
|
||||
unless ($collateral) {
|
||||
WebGUI::ErrorHandler::warn("collateral not found: $collateralIdent");
|
||||
return '';
|
||||
}
|
||||
|
||||
unless ($collateral->isImage()) {
|
||||
WebGUI::ErrorHandler::warn("Bad image type: $collateralIdent");
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($width || $height) {
|
||||
$url = GuideGuide::scaleImage(
|
||||
collateral => $collateral,
|
||||
width => $width,
|
||||
height => $height
|
||||
);
|
||||
}
|
||||
else {
|
||||
WebGUI::ErrorHandler::warn("width or heigth must be specified");
|
||||
}
|
||||
|
||||
$url ||= $collateral->getURL;
|
||||
|
||||
return qq!<img src="$url" $parameters/>!;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub scaleImage {
|
||||
my (%p) = @_;
|
||||
|
||||
my ($collateral,$width,$height) = @p{qw(collateral width height)};
|
||||
|
||||
# paranoia
|
||||
return undef unless ($height || $width);
|
||||
|
||||
my $filename = "SIThumb_".($width || 'r')."x".($height || 'r')."_".$collateral->getFilename();
|
||||
$filename .= '.png' if (isIn($collateral->getType(), qw(tif tiff bmp)));
|
||||
|
||||
my $pathName = $collateral->{_node}->getPath().$session{os}{slash}.$filename;
|
||||
unless (-e $pathName) {
|
||||
my $image = _getImage($collateral);
|
||||
return undef unless $image;
|
||||
my ($newWidth,$newHeight);
|
||||
|
||||
if ($width && $height) {
|
||||
($newWidth,$newHeight) = ($width,$height);
|
||||
}
|
||||
else {
|
||||
my ($x, $y) = $image->Get('width','height');
|
||||
my $ratio = $x / $y;
|
||||
$newWidth = $width ? $width : $height * $ratio;
|
||||
$newHeight = $height ? $height : $width / $ratio;
|
||||
}
|
||||
|
||||
my $max = $session{setting}{maxImageSize};
|
||||
if ($newHeight > $max || $newWidth > $max) {
|
||||
WebGUI::ErrorHandler::warn(
|
||||
"Image too large ($newWidth,$newHeight) :".$collateral->get('name')
|
||||
);
|
||||
return undef;
|
||||
}
|
||||
|
||||
$image->Scale(width => $newWidth, height => $newHeight);
|
||||
if (my $error = $image->Write($pathName)) {
|
||||
WebGUI::ErrorHandler::warn("Couldn't resize image: ".$error);
|
||||
}
|
||||
}
|
||||
|
||||
return $collateral->{_node}->getURL."/$filename";
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
29
lib/WebGUI/Macro/Spacer.pm
Normal file
29
lib/WebGUI/Macro/Spacer.pm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package WebGUI::Macro::Spacer;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::Session;
|
||||
use WebGUI::Macro;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub process {
|
||||
my ($output, @param, $width, $height);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$width = $param[0] if defined $param[0];
|
||||
$height = $param[1] if defined $param[1];
|
||||
$output = '<img src="'.$session{config}{extrasURL}.'/spacer.gif"'.(defined $width?' width="'.$width.'"':'').(defined $height?' height="'.$height.'"':'').' border="0">';
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
69
lib/WebGUI/Macro/SpecificDropMenu.pm
Normal file
69
lib/WebGUI/Macro/SpecificDropMenu.pm
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
package WebGUI::Macro::SpecificDropMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::Macro;
|
||||
use WebGUI::Navigation;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _draw {
|
||||
my ($output, $i, $padding, $pageId);
|
||||
my ($tree, $indent, $maxDepth, $currentDepth) = @_;
|
||||
unless ($currentDepth >= $maxDepth) {
|
||||
for ($i=1;$i<=$indent;$i++) {
|
||||
$padding .= " ";
|
||||
}
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$output .= '<option value="'.$tree->{$pageId}{url}.'">';
|
||||
$output .= $padding."- ".$tree->{$pageId}{title};
|
||||
$output .= '</option>';
|
||||
$output .= _draw($tree->{$pageId}{sub}, ($indent+1), $maxDepth, ($currentDepth+1));
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, @param, $pageId, $tree);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
($pageId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
if (defined $pageId) {
|
||||
$param[2] = 99 unless ($param[2]);
|
||||
if ($param[1] ne "") {
|
||||
$tree = WebGUI::Navigation::tree($pageId,$param[1]);
|
||||
} else {
|
||||
$tree = WebGUI::Navigation::tree($pageId,1);
|
||||
}
|
||||
$temp = '<script language="JavaScript" type="text/javascript">
|
||||
function go(formObj){
|
||||
if (formObj.chooser.options[formObj.chooser.selectedIndex].value != "none") {
|
||||
location = formObj.chooser.options[formObj.chooser.selectedIndex].value
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$temp .= '<form><select name="chooser" size=1 onChange="go(this.form)">';
|
||||
$temp .= '<option value=none>Where do you want to go?';
|
||||
$temp .= _draw($tree,0,$param[2]);
|
||||
$temp .= '</select></form>';
|
||||
} else {
|
||||
$temp = "No page specified.";
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
40
lib/WebGUI/Macro/TopDropMenu.pm
Normal file
40
lib/WebGUI/Macro/TopDropMenu.pm
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package WebGUI::Macro::TopDropMenu;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2003 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::Navigation;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($temp, $tree, $pageId);
|
||||
$tree = WebGUI::Navigation::tree(1,1);
|
||||
$temp = '<script language="JavaScript" type="text/javascript">
|
||||
function go(formObj){
|
||||
if (formObj.chooser.options[formObj.chooser.selectedIndex].value != "none") {
|
||||
location = formObj.chooser.options[formObj.chooser.selectedIndex].value
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$temp .= '<form><select name="chooser" size=1 onChange="go(this.form)">';
|
||||
$temp .= '<option value=none>Where do you want to go?';
|
||||
foreach $pageId (keys %{$tree}) {
|
||||
$temp .= '<option value="'.$tree->{$pageId}{url}.'">'.$tree->{$pageId}{title};
|
||||
}
|
||||
$temp .= '</select></form>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -20,10 +20,13 @@ function returnSelected(in_values) {
|
|||
<select name="textPulldown" onchange="returnSelected(this.value)">
|
||||
<option value=''>Collateral...</option>
|
||||
<option value='^I("logo");'>Image</option>
|
||||
<option value='^SI("logo","100");'>Scaled Image</option>
|
||||
<option value='^Thumbnail("logo");'>Thumbnail</option>
|
||||
<option value='^ThumbnailLinker("logo");'>Linked Thumbnail</option>
|
||||
<option value='^File("product specs");'>File with Icon</option>
|
||||
<option value='^i("status report");'>File URL</option>
|
||||
<option value='^RandomImage("collateral folder");'>Random Image</option>
|
||||
<option value='^RandomSnippet("collateral folder");'>Random Snippet</option>
|
||||
<option value='^Snippet("flash code");'>Snippet</option>
|
||||
</select>
|
||||
|
||||
|
|
@ -37,11 +40,15 @@ function returnSelected(in_values) {
|
|||
<option value='^m;'>Current Menu (Horizontal)</option>
|
||||
<option value='^P;'>Previous Menu (Vertical)</option>
|
||||
<option value='^p;'>Previous Menu (Horizontal)</option>
|
||||
<option value='^PreviousDropMenu;'>Previous Dropdown Menu</option>
|
||||
<option value='^S("home",0);'>Specific SubMenu (Vertical)</option>
|
||||
<option value='^s("home");'>Specific SubMenu (Horizontal)</option>
|
||||
<option value='^SpecificDropMenu("home",3);'>Specific Dropdown Menu</option>
|
||||
<option value='^Synopsis;'>Synopsis Menu</option>
|
||||
<option value='^T;'>Top Level Menu (Vertical)</option>
|
||||
<option value='^t;'>Top Level Menu (Horizontal)</option>
|
||||
<option value='^TopDropMenu;'>Top Dropdown Menu</option>
|
||||
<option value='^RootTab;'>Root Tabs Menu</option>
|
||||
<option value='^rootmenu;'>Root Menu (Horizontal)</option>
|
||||
<option value='^H;'>Home Link</option>
|
||||
<option value='^/;'>System URL</option>
|
||||
|
|
@ -58,6 +65,7 @@ function returnSelected(in_values) {
|
|||
<option value='^Env("HTTP_USER_AGENT");'>Environment Variable</option>
|
||||
<option value='^Page("urlizedTitle");'>Page Property</option>
|
||||
<option value='^International(300);'>Get an International Message</option>
|
||||
<option value='^If("1==1","1 is exactly 1","The universe has gone weird.");'>If Condition</option>
|
||||
<option value='^*(100);'>Random Number</option>
|
||||
<option value='^FormParam("phoneNumber");'>Form Parameter</option>
|
||||
<option value='^URLEncode("This string of text.");'>URL Encode</option>
|
||||
|
|
@ -79,8 +87,10 @@ function returnSelected(in_values) {
|
|||
<option value=''>User...</option>
|
||||
<option value='^L;'>Login Form</option>
|
||||
<option value='^a("Account Info");'>My Account Link</option>
|
||||
<option value='^CanEditText("You can edit this page.");'>Can Edit Page Message</option>
|
||||
<option value='^AdminText("You are in admin mode!");'>Admin Mode Message</option>
|
||||
<option value='^GroupText("Visitors","You need an account to do anything cool on this site!");'>Group Message</option>
|
||||
<option value='^AdminToggle;'>Admin Toggle</option>
|
||||
<option value='^LoginToggle;'>Login Toggle</option>
|
||||
<option value='^@;'>Username</option>
|
||||
<option value='^#;'>User ID</option>
|
||||
|
|
@ -88,9 +98,11 @@ function returnSelected(in_values) {
|
|||
|
||||
<select onchange="returnSelected(this.value)">
|
||||
<option value=''>Style...</option>
|
||||
<option value='^Spacer("10","100");'>Spacer</option>
|
||||
<option value='^c;'>Company Name</option>
|
||||
<option value='^u;'>Company URL</option>
|
||||
<option value='^e;'>Company Email Address</option>
|
||||
<option value='^LastModified;'>Last Modified Date</option>
|
||||
<option value='^PageTitle;'>Page Title</option>
|
||||
<option value='^r;'>Make Page Printable</option>
|
||||
<option value='^RootTitle;'>Root Title</option>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue