bunch of fixes
This commit is contained in:
parent
02e687d04c
commit
156f48f465
10 changed files with 45 additions and 23 deletions
|
|
@ -67,15 +67,18 @@ sub _formatFunction {
|
|||
my $url;
|
||||
if (exists $function->{func}) {
|
||||
$url = WebGUI::URL::page("func=".$function->{func});
|
||||
$url = '#' if $session{form}{func} eq $function->{func};
|
||||
} else {
|
||||
$url = WebGUI::URL::page("op=".$function->{op});
|
||||
$url = '#' if $session{form}{op} eq $function->{op};
|
||||
}
|
||||
return {
|
||||
title=>WebGUI::International::get($function->{title}{id}, $function->{title}{namespace}),
|
||||
icon=>$session{config}{extrasURL}."/adminConsole/".$function->{icon},
|
||||
'icon.small'=>$session{config}{extrasURL}."/adminConsole/small/".$function->{icon},
|
||||
url=>$url,
|
||||
canUse=>WebGUI::Grouping::isInGroup($function->{group})
|
||||
canUse=>WebGUI::Grouping::isInGroup($function->{group}),
|
||||
isCurrentOpFunc=>($session{form}{op} eq $function->{op} || $session{form}{func} eq $function->{func})
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1409,7 +1409,7 @@ sub getLineage {
|
|||
if ($rules->{returnObjects}) {
|
||||
my $parent = $relativeCache{$parentId};
|
||||
$relativeCache{$id} = $asset;
|
||||
$asset->{_parent} = $parent;
|
||||
$asset->{_parent} = $parent if exists $relativeCache{$properties->{parentId}};
|
||||
$parent->{_firstChild} = $asset unless(exists $parent->{_firstChild});
|
||||
$parent->{_lastChild} = $asset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,12 +665,19 @@ sub processPropertiesFromFormPost {
|
|||
$self->setStatusApproved;
|
||||
}
|
||||
my $storage = $self->getStorageLocation;
|
||||
my $filename = $storage->addFileFromFormPost("file");
|
||||
my $filename;
|
||||
my $attachmentLimit = $self->getThread->getParent->get("attachmentsPerPost");
|
||||
$filename = $storage->addFileFromFormPost("file", $attachmentLimit) if $attachmentLimit;
|
||||
if (defined $filename) {
|
||||
$self->setSize($storage->getFileSize($filename));
|
||||
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
|
||||
foreach my $file (@{$storage->getFiles}) {
|
||||
$storage->generateThumbnail($file);
|
||||
if ($storage->isImage($file)) {
|
||||
$storage->generateThumbnail($file,$session{setting}{maxImageSize});
|
||||
$storage->deleteFile($file);
|
||||
$storage->renameFile('thumb-'.$file,$file);
|
||||
$storage->generateThumbnail($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
$session{form}{proceed} = "redirectToParent";
|
||||
|
|
|
|||
|
|
@ -510,7 +510,8 @@ Subscribes the user to this thread.
|
|||
sub subscribe {
|
||||
my $self = shift;
|
||||
$self->createSubscriptionGroup;
|
||||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
WebGUI::Cache->new("cspost_".$self->getId."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_".$session{form}{pn})->delete;
|
||||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -528,7 +529,7 @@ sub trash {
|
|||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($parentLineage.'%')." and Post.assetId<>".quote($self->getId)." and Post.assetId=asset.assetId order by Post.dateSubmitted desc");
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
$self->getParent->setLastPost('','') ? $self->getParent->setLastPost($id,$date) : $id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -569,7 +570,8 @@ Negates the subscribe method.
|
|||
|
||||
sub unsubscribe {
|
||||
my $self = shift;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
WebGUI::Cache->new("cspost_".$self->getId."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_".$session{form}{pn})->delete;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ sub getShortcut {
|
|||
}
|
||||
}
|
||||
$self->{_shortcut}{_properties}{templateId} = $self->get("overrideTemplateId") if ($self->get("overrideTemplate"));
|
||||
$self->{_shortcut}{_properties}{collaborationTemplateId} = $self->get("overrideTemplateId") if ($self->get("overrideTemplate"));
|
||||
$self->{_shortcut}{_properties}{title} = $self->get("title") if ($self->get("overrideTitle"));
|
||||
$self->{_shortcut}{_properties}{description} = $self->get("description") if ($self->get("overrideDescription"));
|
||||
$self->{_shortcut}{_properties}{title} = $self->get("displayTitle") if ($self->get("overrideDisplayTitle"));
|
||||
|
|
|
|||
|
|
@ -830,7 +830,7 @@ sub setLastPost {
|
|||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update(lastPostId=>$id, lastPostDate=>$date);
|
||||
$self->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -843,6 +843,7 @@ Subscribes a user to this collaboration system.
|
|||
|
||||
sub subscribe {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId})->delete;
|
||||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
|
|
@ -856,6 +857,7 @@ Unsubscribes a user from this collaboration system
|
|||
|
||||
sub unsubscribe {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId})->delete;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ sub getEditForm {
|
|||
$sth->finish;
|
||||
unless(%indexName) {
|
||||
return "<p><b>" . WebGUI::International::get(2,"Asset_IndexedSearch") .
|
||||
"<p>" . WebGUI::International::get(3,"Asset_IndexedSearch") . "</b></p>";
|
||||
"<p>" . WebGUI::International::get(3,"Asset_IndexedSearch") . "</p></b></p>";
|
||||
}
|
||||
|
||||
# Index to use
|
||||
|
|
@ -381,10 +381,13 @@ sub view {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("search add/edit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("26","Asset_IndexedSearch"));
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->getAdminConsole->setHelp("search add/edit");
|
||||
my $form = $self->getEditForm;
|
||||
my $output = $form;
|
||||
$output = $form->print unless $form =~ /^<p><b/;
|
||||
return $self->getAdminConsole->render($output,WebGUI::International::get("26","Asset_IndexedSearch"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -687,12 +687,12 @@ sub www_edit {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->SUPER::www_editSave();
|
||||
my $output = $_[0]->SUPER::www_editSave();
|
||||
if ($session{form}{proceed} eq "addQuestion") {
|
||||
$session{form}{qid} = "new";
|
||||
return $_[0]->www_editQuestion;
|
||||
}
|
||||
return "";
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -728,7 +728,7 @@ sub www_editAnswer {
|
|||
$question = WebGUI::SQL->buildHashRef("select Survey_questionId,question
|
||||
from Survey_question where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
$question = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$question) };
|
||||
$f->select(
|
||||
$f->selectList(
|
||||
-name=>"gotoQuestion",
|
||||
-options=>$question,
|
||||
-value=>[$answer->{gotoQuestion}],
|
||||
|
|
@ -855,11 +855,11 @@ sub www_editQuestion {
|
|||
while (%data = $sth->hash) {
|
||||
$output .=
|
||||
deleteIcon('func=deleteAnswerConfirm&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId},
|
||||
$self->getUrl,WebGUI::International::get(45,'Asset_Survey')).
|
||||
editIcon('func=editAnswer&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId}, $self->getUrl).
|
||||
moveUpIcon('func=moveAnswerUp'.'&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId}, $self->getUrl).
|
||||
moveDownIcon('func=moveAnswerDown&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId}, $self->getUrl).
|
||||
' '.$data{answer}.'<br />';
|
||||
$self->get("url"),WebGUI::International::get(45,'Asset_Survey')).
|
||||
editIcon('func=editAnswer&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId}, $self->get("url")).
|
||||
moveUpIcon('func=moveAnswerUp'.'&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId}, $self->get("url")).
|
||||
moveDownIcon('func=moveAnswerDown&qid='.$question->{Survey_questionId}.'&aid='.$data{Survey_answerId}, $self->get("url")).
|
||||
' '.$data{answer}.'<br>';
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1676,7 +1676,7 @@ sub template {
|
|||
|
||||
#Remove entries from template list that the user does not have permission to view.
|
||||
for my $assetId ( keys %{$templateList} ) {
|
||||
my $asset = WebGUI::Asset->new($assetId);
|
||||
my $asset = WebGUI::Asset::Template->new($assetId);
|
||||
|
||||
if (!$asset->canView($userId)) {
|
||||
delete $templateList->{$assetId};
|
||||
|
|
|
|||
|
|
@ -190,9 +190,12 @@ Provide the form variable name to which the file being uploaded is assigned. Not
|
|||
sub addFileFromFormPost {
|
||||
my $self = shift;
|
||||
my $formVariableName = shift;
|
||||
return "" if (WebGUI::HTTP::getStatus() =~ /^413/);
|
||||
my $attachmentLimit = shift;
|
||||
return "" if (WebGUI::HTTP::getStatus() =~ /^413/);
|
||||
my $filename;
|
||||
my $attachmentCount = 1;
|
||||
foreach my $tempPath ($session{cgi}->upload($formVariableName)) {
|
||||
last if $attachmentCount > $attachmentLimit;
|
||||
if ($tempPath =~ /([^\/\\]+)$/) {
|
||||
$filename = $1;
|
||||
} else {
|
||||
|
|
@ -206,6 +209,7 @@ sub addFileFromFormPost {
|
|||
$filename = WebGUI::URL::makeCompliant($filename);
|
||||
my $bytesread;
|
||||
my $file = FileHandle->new(">".$self->getPath($filename));
|
||||
$attachmentCount++;
|
||||
if (defined $file) {
|
||||
my $buffer;
|
||||
binmode $file;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue