fixed a bug in uss, template selection, and added a new template variable for wobject proxies.

This commit is contained in:
JT Smith 2004-08-27 18:16:07 +00:00
parent 82daf4f984
commit 3679c31973
6 changed files with 36 additions and 3 deletions

View file

@ -585,7 +585,7 @@ The name of the form variable to retrieve.
=cut
sub template {
if ($session{form}{$_[0]} =~ /^\d+$/) {
if (exists $session{form}{$_[0]}) {
return $session{form}{$_[0]};
}
return 1;

View file

@ -602,6 +602,8 @@ sub generate {
if ($wobjectProxy->{overrideTemplate}) {
${$wobject}{templateId} = $wobjectProxy->{proxiedTemplateId};
}
my $originalWobjectPage = WebGUI::Page->new($wobject->{pageId});
$wobject->{'original.page.url'} = WebGUI::URL::gateway($originalWobjectPage->get("urlizedTitle"));
}
}
my $cmd = "WebGUI::Wobject::".${$wobject}{namespace};

View file

@ -257,6 +257,12 @@ sub www_approveSubmission {
}
}
#-------------------------------------------------------------------
sub www_copy {
return "Copying of User Submission Systems has been disabled until 6.3.";
}
#-------------------------------------------------------------------
sub www_deleteFile {
my ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=".quote($session{form}{sid}));
@ -284,13 +290,15 @@ sub www_deleteSubmission {
#-------------------------------------------------------------------
sub www_deleteSubmissionConfirm {
my ($owner, $forumId) = WebGUI::SQL->quickArray("select userId,forumId from USS_submission where USS_submissionId=".quote($session{form}{sid}));
my ($owner, $forumId, $pageId) = WebGUI::SQL->quickArray("select userId,forumId,pageId from USS_submission where USS_submissionId=".quote($session{form}{sid}));
if ($owner == $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) {
my ($inUseElsewhere) = WebGUI::SQL->quickArray("select count(*) from USS_submission where forumId=".quote($forumId));
unless ($inUseElsewhere > 1) {
my $forum = WebGUI::Forum->new($forumId);
$forum->purge;
}
my $page = WebGUI::Page->new($pageId);
$page->purge;
$_[0]->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid});
my $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
$file->deleteNode;
@ -639,6 +647,23 @@ sub www_editSubmissionSave {
$hash{status} = "Approved";
}
}
my $parentPage = WebGUI::Page->new($_[0]->get("pageId"));
my %pageVars = %{$parentPage->get};
delete $pageVars{pageId};
delete $pageVars{nestedSetLeft};
delete $pageVars{nestedSetRight};
delete $pageVars{depth};
delete $pageVars{parentId};
delete $pageVars{sequenceNumber};
$pageVars{hideFromNavigation} = 1;
$pageVars{title} = $pageVars{menuTitle} = $hash{title};
$pageVars{subroutine} = "viewSubmissionAsPage";
$pageVars{subroutinePackage} = "WebGUI::Wobject::USS";
$pageVars{subroutineParams} = "{wobjectId=>'".$_[0]->wid."',submissionId=>'".$hash{USS_submissionId}."'}";
$pageVars{urlizedTitle} .= "/".$hash{title};
my $newPage = $parentPage->add;
$pageVars{urlizedTitle} = WebGUI::Page::makeUnique(WebGUI::URL::urlize($pageVars{urlizedTitle},$newPage->get("pageId")));
$newPage->set(\%pageVars);
$_[0]->setCollateral("USS_submission", "USS_submissionId", \%hash, 1, 0, "USS_id", $_[0]->get("USS_id"));
return $_[0]->www_viewSubmission();
} else {

View file

@ -86,8 +86,10 @@ Most Recent will select the most recent wobject that match the proxy criteria.
A statement to determinate what to proxy, in the form of "color = blue and weight != heavy". Multiple expressions may be joined with "and" and "or". <br>
A property or value must be quoted if it contains spaces. Feel free to use the criteria builder to build your statements.
<p>
<b>NOTE:</b> Wobject Proxy will automatically add a template variable to the wobject it's proxying called 'original.page.url'. You can use that to link to the original content that's being proxied.
<p>
|,
lastUpdated => 1057091098
lastUpdated => 1053183804
},
'greater than' => {