bug fixes
This commit is contained in:
parent
90d124de32
commit
5ebc401d6f
5 changed files with 23 additions and 13 deletions
|
|
@ -2377,14 +2377,14 @@ Saves and updates history. If canEdit, returns www_manageAssets() if a new Asset
|
|||
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my $object;
|
||||
if ($session{form}{assetId} eq "new") {
|
||||
$object = $self->addChild({className=>$session{form}{class}});
|
||||
$object->{_parent} = $self;
|
||||
} else {
|
||||
$object = $self;
|
||||
}
|
||||
$object = $self->addChild({className=>$session{form}{class}});
|
||||
$object->{_parent} = $self;
|
||||
} else {
|
||||
$object = $self;
|
||||
}
|
||||
$object->processPropertiesFromFormPost;
|
||||
$object->updateHistory("edited");
|
||||
return $self->www_manageAssets if ($session{form}{proceed} eq "manageAssets" && $session{form}{assetId} eq "new");
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ our @ISA = qw(WebGUI::Asset);
|
|||
#-------------------------------------------------------------------
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
return ($session{form}{func} eq "add" && $self->getThread->getParent->canPost) ||
|
||||
return (($session{form}{func} eq "add" || ($session{form}{assetId} eq "new" && $session{form}{func} eq "editSave" && $session{form}{class} eq "WebGUI::Asset::Post")) && $self->getThread->getParent->canPost) || # account for new posts
|
||||
|
||||
($self->isPoster && $self->getThread->getParent->get("editTimeout") > (WebGUI::DateTime::time() - $self->get("dateUpdated"))) ||
|
||||
$self->getThread->getParent->canModerate;
|
||||
|
||||
|
|
@ -621,7 +622,8 @@ sub processPropertiesFromFormPost {
|
|||
ownerUserId => $session{user}{userId},
|
||||
groupIdView => $self->getThread->getParent->get("groupIdView"),
|
||||
groupIdEdit => $self->getThread->getParent->get("groupIdEdit"),
|
||||
isHidden => 1
|
||||
isHidden => 1,
|
||||
dateSubmitted=>time()
|
||||
);
|
||||
if ($self->getThread->getParent->canModerate) {
|
||||
$self->getThread->lock if ($session{form}{'lock'});
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ sub view {
|
|||
$var->{'user.isModerator'} = $self->getParent->canModerate;
|
||||
$var->{'user.canPost'} = $self->getParent->canPost;
|
||||
$var->{'user.canReply'} = $self->canReply;
|
||||
$var->{'repliesAllowed'} = $self->getParent->("allowReplies");
|
||||
$var->{'repliesAllowed'} = $self->getParent->get("allowReplies");
|
||||
|
||||
$var->{'layout.nested.url'} = $self->getLayoutUrl("nested");
|
||||
$var->{'layout.flat.url'} = $self->getLayoutUrl("flat");
|
||||
|
|
@ -573,7 +573,8 @@ sub view {
|
|||
left join Thread on Thread.assetId=asset.assetId
|
||||
left join Post on Post.assetId=asset.assetId
|
||||
where asset.lineage like ".quote($self->get("lineage").'%')
|
||||
." and (
|
||||
." and asset.state='published'
|
||||
and (
|
||||
Post.status in ('approved','archived')";
|
||||
$sql .= " or Post.status='pending'" if ($self->getParent->canModerate);
|
||||
$sql .= " or (asset.ownerUserId=".quote($session{user}{userId})." and asset.ownerUserId<>'1')
|
||||
|
|
|
|||
|
|
@ -157,6 +157,13 @@ sub appendTemplateLabels {
|
|||
$var->{'without.label'} = "Without";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
return ((($session{form}{func} eq "add" || ($session{form}{assetId} eq "new" && $session{form}{func} eq "editSave" && $session{form}{class} eq "WebGUI::Asset::Post::Thread")) && $self->canPost) || # account for new posts
|
||||
$self->SUPER::canEdit());
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canModerate {
|
||||
my $self = shift;
|
||||
|
|
@ -286,7 +293,7 @@ sub definition {
|
|||
},
|
||||
allowRichEdit =>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>1
|
||||
defaultValue=>0
|
||||
},
|
||||
attachmentsPerPost =>{
|
||||
fieldType=>"integer",
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ sub getEditForm {
|
|||
);
|
||||
|
||||
# Add a "Add another query" button
|
||||
if ($nr < 5 and ($self->get("dbQuery".($nr+1)) eq "" || ($_[0]->get("dbQuery".($nr)) eq "" and $_[0]->get("dbQuery".($nr+1)) ne ""))) {
|
||||
if ($nr < 5 and ($self->get("dbQuery".($nr+1)) eq "" || ($self->get("dbQuery".($nr)) eq "" and $self->get("dbQuery".($nr+1)) ne ""))) {
|
||||
$tabform->getTab("properties")->button(
|
||||
-value=>WebGUI::International::get('Add another query',"SQLReport"),
|
||||
-extras=>'onClick="toggleQuery(\''.($nr+1).'\'); this.style.display=\'none\';"',
|
||||
|
|
@ -204,7 +204,7 @@ sub getEditForm {
|
|||
}
|
||||
|
||||
# Make empty query blocks invisible
|
||||
if ($nr > 1 && ($self->get("dbQuery".$nr) eq "" || $_[0]->get("dbQuery".($nr-1)) eq "")) {
|
||||
if ($nr > 1 && ($self->get("dbQuery".$nr) eq "" || $self->get("dbQuery".($nr-1)) eq "")) {
|
||||
$tabform->getTab("properties")->raw(qq|
|
||||
<script language="javascript">
|
||||
toggleQuery('$nr');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue