diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 2635ae305..7e1da7f81 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -5,6 +5,7 @@ - fixed: thingy's checkbox field - Inbox and ?op=viewInbox can now handle millions of rows without taking 10 minutes to return some results + - Exposed a form element for the GalleryAlbum Others Can Add property 7.5.18 - fixed: Collateral Image Manager broken in Firefox 3 diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index 94e18417f..53bd144ce 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -500,6 +500,11 @@ sub getTemplateVars { } } + # Set a flag for pending files + if ( $self->get( "status" ) eq "pending" ) { + $var->{ 'isPending' } = 1; + } + # Permissions $var->{ canAddFile } = $self->canAddFile; $var->{ canEdit } = $self->canEdit; @@ -1065,6 +1070,12 @@ sub www_edit { richEditId => $self->getParent->get("richEditIdAlbum"), }); + $var->{ form_othersCanAdd } + = WebGUI::Form::yesNo( $session, { + name => "othersCanAdd", + value => $form->get( "othersCanAdd" ) || $self->get( "othersCanAdd" ), + } ); + # Generate the file loop my $assetIdThumbnail = $form->get("assetIdThumbnail") || $self->get("assetIdThumbnail"); $self->appendTemplateVarsFileLoop( $var, $self->getFileIds ); diff --git a/lib/WebGUI/User.pm b/lib/WebGUI/User.pm index bd091d7be..5d8843166 100644 --- a/lib/WebGUI/User.pm +++ b/lib/WebGUI/User.pm @@ -332,6 +332,32 @@ sub getGroups { } } +#---------------------------------------------------------------------------- + +=head2 getGroupIdsRecursive ( ) + +Get the groups the user is in AND all the groups those groups are in, recursively. +Returns a flattened array reference of unique group IDs + +=cut + +sub getGroupIdsRecursive { + my $self = shift; + my $groupingIds = $self->getGroups( "withoutExpired" ); + my %groupIds = map { $_ => 1 } @{ $groupingIds }; + while ( my $groupingId = shift @{ $groupingIds } ) { + my $group = WebGUI::Group->new( $self->session, $groupingId ); + for my $groupGroupingId ( @{ $group->getGroupsFor } ) { + if ( !$groupIds{ $groupGroupingId } ) { + push @{ $groupingIds }, $groupGroupingId; + } + $groupIds{ $groupGroupingId } = 1; + } + } + + return [ keys %groupIds ]; +} + #------------------------------------------------------------------- =head2 getWholeName ( ) diff --git a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm index 17bb832a8..5688275ac 100644 --- a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm +++ b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm @@ -550,6 +550,12 @@ our $I18N = { context => q{Description of template variable}, }, + 'editForm othersCanAdd label' => { + message => q{Others Can Add}, + lastUpdated => 0, + context => q{Description of asset property to allow people besides the owner to add files to the album}, + }, + }; 1;