From 0c45e5286e25195ac55c269c39390c156e4b8592 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 26 Jun 2007 04:33:07 +0000 Subject: [PATCH] Forward port of isHidden work from 7.3 for Post, Event and WikiPage. isHidden is not allowed to be 0 for those Assets. I had to reinstantiate the update method for the Event Asset, but I only put in the code to force isHidden to be forced to 1. --- docs/changelog/7.x.x.txt | 4 +++- lib/WebGUI/Asset/Event.pm | 19 +++++++++++++------ lib/WebGUI/Asset/Post.pm | 27 ++++++++++++++------------- lib/WebGUI/Asset/WikiPage.pm | 16 +++++++++++++++- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index aa1ca0cff..7f8941443 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -61,7 +61,9 @@ http://www.webgui.org/bugs/tracker/spectre-should-check-that-it-has-a-valid-workflow#lHx4BxEUxcacX7rS5VLxeg - fix: Problems with thumbnails (perlDreamer Consulting, LLC) http://www.webgui.org/bugs/tracker/problems-with-thumbnails - + - fix: CS branch error (perlDreamer Consulting, LLC) + http://www.webgui.org/bugs/tracker/cs-branch-error + - fix: Package deploy: hidden assets become visible (Yung Han Khoe, United Knowledge) 7.3.18 - fix: Old registrants appear in new EMS asset diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 0693b7c4d..3d045d404 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -90,7 +90,7 @@ sub definition { }, 'relatedLinks' => { - fieldType => "HTMLarea", + fieldType => "HTMLArea", defaultValue => undef, }, 'location' => { @@ -171,10 +171,6 @@ sub canEdit { } - - - - #################################################################### =head2 generateRecurringEvents ( ) @@ -1415,7 +1411,6 @@ sub processPropertiesFromFormPost { ### Form is verified # Events are always hidden from navigation - $self->update({ isHidden => 1 }); if (!$self->get("groupIdEdit")) { my $groupIdEdit = $self->getParent->get("groupIdEventEdit") @@ -1655,8 +1650,20 @@ sub setRelatedLinks { }); } +#################################################################### +=head2 update +Wrap update so that isHidden is always set to be a 1. + +=cut + +sub update { + my $self = shift; + my $properties = shift; + $properties->{isHidden} = 1; + return $self->SUPER::update($properties); +} #################################################################### diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 3fca02e47..8824c591a 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -79,7 +79,6 @@ sub addRevision { delete $newSelf->{_thread}; } $newSelf->update({ - isHidden => 1, dateUpdated=>$now, }); @@ -1037,19 +1036,21 @@ We overload the update method from WebGUI::Asset in order to handle file system =cut sub update { - my $self = shift; - my %before = ( - owner => $self->get("ownerUserId"), - view => $self->get("groupIdView"), - edit => $self->get("groupIdEdit") - ); - $self->SUPER::update(@_); - if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) { - my $storage = $self->getStorageLocation; - if (-d $storage->getPath) { - $storage->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit")); - } + my $self = shift; + my $properties = shift; + my %before = ( + owner => $self->get("ownerUserId"), + view => $self->get("groupIdView"), + edit => $self->get("groupIdEdit") + ); + $properties->{isHidden} = 1; + $self->SUPER::update($properties, @_); + if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) { + my $storage = $self->getStorageLocation; + if (-d $storage->getPath) { + $storage->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit")); } + } } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/WikiPage.pm b/lib/WebGUI/Asset/WikiPage.pm index 86e341059..c324587dd 100644 --- a/lib/WebGUI/Asset/WikiPage.pm +++ b/lib/WebGUI/Asset/WikiPage.pm @@ -237,7 +237,6 @@ sub processPropertiesFromFormPost { $self->update({ groupIdView => $self->getWiki->get('groupIdView'), groupIdEdit => $self->getWiki->get('groupToAdminister'), - isHidden => 1, actionTakenBy => $self->session->user->userId, actionTaken => $actionTaken, }); @@ -297,6 +296,21 @@ sub scrubContent { return $scrubbedContent; } +#------------------------------------------------------------------- + +=head2 update + +Wrap update to force isHidden to be on, all the time. + +=cut + +sub update { + my $self = shift; + my $properties = shift; + $properties->{isHidden} = 1; + $self->SUPER::update($properties, @_); +} + #------------------------------------------------------------------- sub view { my $self = shift;