package WebGUI::Operation::Navigation;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2004 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 Exporter;
use strict;
use Tie::IxHash;
use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::HTMLForm;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Operation::Shared;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Navigation;
use WebGUI::TabForm;
use WebGUI::ErrorHandler;
use WebGUI::Privilege;
our @ISA = qw(Exporter);
our @EXPORT = qw(&www_listNavigation &www_editNavigation &www_editNavigationSave &www_copyNavigation
&www_deleteNavigation www_deleteNavigationConfirm www_previewNavigation);
#-------------------------------------------------------------------
sub _submenu {
my (%menu);
tie %menu, 'Tie::IxHash';
$menu{WebGUI::URL::page('op=editNavigation')} = 'Add new Navigation.';
if (($session{form}{op} eq "editNavigation" && $session{form}{navigationId} ne "new") || $session{form}{op} eq "deleteNavigationConfirm") {
$menu{WebGUI::URL::page('op=editNavigation&identifier='.$session{form}{identifier})} =
WebGUI::International::get(18, 'Navigation');
$menu{WebGUI::URL::page('op=copyNavigation&navigationId='.$session{form}{navigationId})} =
WebGUI::International::get(19, 'Navigation');
$menu{WebGUI::URL::page('op=deleteNavigation&navigationId='.$session{form}{navigationId})} =
WebGUI::International::get(20, 'Navigation');
}
$menu{WebGUI::URL::page('op=listNavigation')} = WebGUI::International::get(21, 'Navigation');
return menuWrapper($_[0],\%menu);
}
#-------------------------------------------------------------------
sub www_copyNavigation {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(3));
my %navigation = WebGUI::SQL->quickHash("select * from Navigation where identifier = ".
quote($session{form}{identifier}));
WebGUI::SQL->write("insert into Navigation (navigationId, identifier, depth, method, startAt, stopAtLevel,
templateId, showSystemPages, showHiddenPages, showUnprivilegedPages,
reverse)
values (".getNextId("navigationId").",
".quote('Copy of '.$navigation{identifier}).", $navigation{depth}, ".quote($navigation{method}).
", ".quote($navigation{startAt}).", $navigation{stopAtLevel}, $navigation{templateId},
$navigation{showSystemPages}, $navigation{showHiddenPages},$navigation{showUnprivilegedPages},
$navigation{reverse})");
return www_listNavigation();
}
#-------------------------------------------------------------------
sub www_deleteNavigation {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::isInGroup(3));
if ($session{form}{navigationId} < 1000 && $session{form}{navigationId} > 0) {
return WebGUI::Privilege::vitalComponent();
}
my $output .= '
';
my $sth = WebGUI::SQL->read("select navigationId, identifier from Navigation order by identifier");
my $i = 0;
my @row = ();
while (my %data = $sth->hash) {
$row[$i].= '