first run on new asset system
This commit is contained in:
parent
f7dd3b0577
commit
382ced9ffe
27 changed files with 785 additions and 374 deletions
|
|
@ -14,6 +14,7 @@ use strict qw(refs vars);
|
|||
use Tie::CPHash;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Clipboard;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
|
|
@ -37,18 +38,18 @@ sub process {
|
|||
$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) {
|
||||
$data{title} =~ s/'//g;
|
||||
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;
|
||||
# my $sth = WebGUI::SQL->read("select pageId,title from page where parentId='5'");
|
||||
# while (my %data = $sth->hash) {
|
||||
# $data{title} =~ s/'//g;
|
||||
# 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}}) {
|
||||
|
|
@ -81,64 +82,18 @@ sub process {
|
|||
$var{'addpage.label'} = WebGUI::International::get(2);
|
||||
#--clipboard paster
|
||||
$var{'clipboard.label'} = WebGUI::International::get(1082);
|
||||
%hash2 = ();
|
||||
|
||||
# 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") {
|
||||
$query = "select bufferDate,pageId,title from page where parentId='2' order by bufferDate";
|
||||
} else {
|
||||
$query = "select bufferDate,pageId,title from page where parentId='2' "
|
||||
." and bufferUserId=".quote($session{user}{userId})
|
||||
." order by bufferDate";
|
||||
}
|
||||
$r = WebGUI::SQL->read($query);
|
||||
while (%cphash = $r->hash) {
|
||||
$cphash{title} =~ s/'//g;
|
||||
push @item, [ $cphash{bufferDate},
|
||||
WebGUI::URL::page('op=pastePage&pageId='.$cphash{pageId}),
|
||||
$cphash{title} . ' ('. WebGUI::International::get(2) .')' ];
|
||||
}
|
||||
$r->finish;
|
||||
|
||||
# get wobjects and store in array of arrays in order to integrate with pages and sort by buffer date
|
||||
if ($session{setting}{sharedClipboard} eq "1") {
|
||||
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId='2' "
|
||||
." order by bufferDate";
|
||||
} else {
|
||||
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId='2' "
|
||||
." and bufferUserId=".quote($session{user}{userId})
|
||||
." order by bufferDate";
|
||||
}
|
||||
$r = WebGUI::SQL->read($query);
|
||||
while (%cphash = $r->hash) {
|
||||
$cphash{title} =~ s/'//g;
|
||||
push @item, [ $cphash{bufferDate},
|
||||
WebGUI::URL::page('func=paste&wid='.$cphash{wobjectId}),
|
||||
$cphash{title} . ' ('. $cphash{namespace} .')' ];
|
||||
}
|
||||
$r->finish;
|
||||
|
||||
# Reverse sort by bufferDate and and create hash from list values
|
||||
my @sorted_item = sort {$b->[0] <=> $a->[0]} @item;
|
||||
@item = ();
|
||||
for $i ( 0 .. $#sorted_item ) {
|
||||
$hash2{ $sorted_item[$i][1] } = $sorted_item[$i][2];
|
||||
}
|
||||
@sorted_item = ();
|
||||
my @clipboard;
|
||||
$i = 0;
|
||||
foreach my $key (keys %hash2) {
|
||||
push(@clipboard,{
|
||||
'clipboard.url'=>$key,
|
||||
'clipboard.label'=>$hash2{$key},
|
||||
'clipboard.count'=>$i
|
||||
my $clipboard = WebGUI::Clipboard::getAssetsInClipboard();
|
||||
foreach my $item (@{$clipboard}) {
|
||||
my $title = $item->{title};
|
||||
$title =~ s/'//g; # stops it from breaking the javascript menus
|
||||
push(@{$var{clipboard_loop}}, {
|
||||
'clipboard.label'=>$title,
|
||||
'clipboard.url'=>WebGUI::URL::page("func=paste&assetId=".$item->{assetId})
|
||||
});
|
||||
$i++;
|
||||
}
|
||||
$var{'clipboard_loop'} = \@clipboard;
|
||||
#--admin functions
|
||||
%hash = (
|
||||
'http://validator.w3.org/check?uri='.WebGUI::URL::escape(WebGUI::URL::page())=>WebGUI::International::get(399),
|
||||
'http://validator.w3.org/check?uri=referer'=>WebGUI::International::get(399),
|
||||
);
|
||||
my $acParams = WebGUI::AdminConsole->getAdminConsoleParams;
|
||||
$hash{$acParams->{url}} = $acParams->{title} if ($acParams->{canUse});
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ use WebGUI::URL;
|
|||
sub process {
|
||||
if (WebGUI::Grouping::isInGroup(12)) {
|
||||
my %var;
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my $turnOn = $param[0] || WebGUI::International::get(516);
|
||||
my $turnOff = $param[1] || WebGUI::International::get(517);
|
||||
my ($turnOn,$turnOff,$templateName) = WebGUI::Macro::getParams($_[0]);
|
||||
$turnOn |= WebGUI::International::get(516);
|
||||
$turnOff |= WebGUI::International::get(517);
|
||||
if ($session{var}{adminOn}) {
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin');
|
||||
$var{'toggle.text'} = $turnOff;
|
||||
|
|
@ -32,7 +32,7 @@ sub process {
|
|||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOnAdmin');
|
||||
$var{'toggle.text'} = $turnOn;
|
||||
}
|
||||
return WebGUI::Template::process(WebGUI::Template::getIdByName($param[2],"Macro/AdminToggle"),"Macro/AdminToggle",\%var);
|
||||
return WebGUI::Template::process(WebGUI::Template::getIdByName($templateName,"Macro/AdminToggle")||1,"Macro/AdminToggle",\%var);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ use WebGUI::URL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return WebGUI::URL::getScriptURL().$session{page}{urlizedTitle};
|
||||
my $pathinfo = $session{env}{PATH_INFO};
|
||||
$pathinfo =~ s/^\/(.*)/$1/;
|
||||
return WebGUI::URL::getScriptURL().$pathinfo;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ sub process {
|
|||
if ($session{setting}{defaultPage} eq $session{page}{pageId}) {
|
||||
$temp = $session{page}{urlizedTitle};
|
||||
} else {
|
||||
($temp) = WebGUI::SQL->quickArray("select urlizedTitle from page where pageId=".quote($session{setting}{defaultPage}),WebGUI::SQL->getSlave);
|
||||
($temp) = WebGUI::SQL->quickArray("select url from asset where assetId=".quote($session{setting}{defaultPage}),WebGUI::SQL->getSlave);
|
||||
}
|
||||
$temp = WebGUI::URL::gateway($temp);
|
||||
if ($param[0] ne "linkonly") {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ sub process {
|
|||
$var{'toggle.url'} = WebGUI::URL::page('op=logout');
|
||||
$var{'toggle.text'} = $logout;
|
||||
}
|
||||
return WebGUI::Template::process(WebGUI::Template::getIdByName($param[3],"Macro/LoginToggle"), "Macro/LoginToggle", \%var);
|
||||
return WebGUI::Template::process(WebGUI::Template::getIdByName($param[3],"Macro/LoginToggle")||1, "Macro/LoginToggle", \%var);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue