adding more default content, and changing the add content menu to be more powerful

This commit is contained in:
JT Smith 2004-02-16 04:57:58 +00:00
parent 5a70267ee8
commit 069b21dea0
10 changed files with 83 additions and 50 deletions

View file

@ -31,11 +31,24 @@ sub process {
tie %hash, "Tie::IxHash";
tie %hash2, "Tie::IxHash";
tie %cphash, "Tie::CPHash";
#--content adder
$hash{WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId})} = WebGUI::International::get(2);
if ($session{user}{uiLevel} >= 7) {
$hash{WebGUI::URL::page('op=selectPackageToDeploy')} = WebGUI::International::get(376);
}
#--packages adder
$var{'packages.canAdd'} = ($session{user}{uiLevel} >= 7);
$var{'packages.label'} = WebGUI::International::get(376);
my @packages;
my $i;
my $sth = WebGUI::SQL->read("select pageId,title from page where parentId=5");
while (my %data = $sth->hash) {
push(@packages, {
'package.url'=>WebGUI::URL::page('op=deployPackage&pid='.$data{pageId}),
'package.label'=>$data{title},
'package.count'=>$i
});
$i++;
}
$sth->finish;
$var{package_loop} = \@packages;
#--contenttypes adder
$var{'contentTypes.label'} = WebGUI::International::get(1083);
foreach my $namespace (@{$session{config}{wobjects}}) {
my $cmd = "WebGUI::Wobject::".$namespace;
my $w = eval{$cmd->new({namespace=>$namespace,wobjectId=>"new"})};
@ -52,16 +65,18 @@ sub process {
my $i = 0;
foreach my $key (keys %hash) {
push(@addcontent,{
'addcontent.url'=>$key,
'addcontent.label'=>$hash{$key},
'addcontent.count'=>$i
'contenttype.url'=>$key,
'contenttype.label'=>$hash{$key},
'contenttype.count'=>$i
});
$i++;
}
$var{'addcontent_loop'} = \@addcontent;
$var{'contenttypes_loop'} = \@addcontent;
$var{'addpage.url'} = WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId});
$var{'addpage.label'} = WebGUI::International::get(2);
#--clipboard paster
$var{'clipboard.label'} = WebGUI::International::get(1082);
%hash2 = ();
$var{'clipboard.label'} = WebGUI::International::get(3);
# get pages and store in array of arrays in order to integrate with wobjects and sort by buffer date
if ($session{setting}{sharedClipboard} eq "1") {

View file

@ -20,7 +20,7 @@ use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy);
our @EXPORT = qw(&www_deployPackage );
#-------------------------------------------------------------------
sub _duplicateWobjects {
@ -112,30 +112,6 @@ sub _recursePageTree {
$a->finish;
}
#-------------------------------------------------------------------
sub www_selectPackageToDeploy {
my ($output, %data, $sth, $flag);
$session{page}{useAdminStyle} = 1;
if (WebGUI::Privilege::canEditPage()) {
tie %data,'Tie::CPHash';
$output = helpIcon(30);
$output .= '<h1>'.WebGUI::International::get(375).'</h1>';
$output .= '<ul>';
$sth = WebGUI::SQL->read("select * from page where parentId=5");
while (%data = $sth->hash) {
$output .= '<li> <a href="'.WebGUI::URL::page('op=deployPackage&pid='.$data{pageId})
.'">'.$data{title}.'</a>';
$flag = 1;
}
$sth->finish;
$output .= WebGUI::International::get(377) unless $flag;
$output .= '</ul>';
return $output;
} else {
return WebGUI::Privilege::insufficient();
}
}
#-------------------------------------------------------------------
sub www_deployPackage {
if (WebGUI::Privilege::canEditPage()) {