How Do I Hide Empty User Photo Galleries?

This post has 8 Replies | 4 Followers

Not Ranked
Posts 1
Points 35
vanguys Posted: Mon, Feb 12 2007 2:10 PM
Everything is working great on my new site, but now I have a few new users and a bunch of empty photo galleries.  I love using the auto create for the galleries and blogs as it cuts down on maintenance time, but in the blogs section, their blogs don't appear until they actually post something.  I would like to do the same thing for the photo gallery.
Not Ranked
Posts 4
Points 65

I too have the same questions.   Any ideas?

 

Thanks

Jeremy 

  • | Post Points: 20
Not Ranked
Posts 13
Points 215
Kunlun replied on Fri, Jun 29 2007 12:53 AM

 Go to file Themes\Default\Galleries\grouplist.aspx

FInd the <ItemTemplate> for the GalleryList control.

Modify the first line of the of the <ItemTemplate> to: 

<li runat="server" visible="<%# ((Gallery)Container.DataItem).PostCount > 0 %>">

I copy the entrie section here:

<div class="CommonContent">

<CSGallery:GalleryList runat="server">

<QueryOverrides SortBy="LastPost" SortOrder="Descending" PageSize="6" />

<HeaderTemplate>

<ul class="GalleryList">

</HeaderTemplate>

<ItemTemplate>

<li id="Li1" runat="server" visible="<%# ((Gallery)Container.DataItem).PostCount > 0 %>">

<div class="GalleryGalleryArea">

<CSGallery:GalleryData runat="server" Property="Name" LinkTo="ViewGallery" Tag="H4" CssClass="GalleryGalleryHeader" />

<div class="GalleryGalleryContent">

<CSGallery:GalleryPostList runat="server">

<QueryOverrides SortBy="PictureDate" SortOrder="Descending" PageSize="5" />

<HeaderTemplate>

<ul class="GalleryImageList">

</HeaderTemplate>

<ItemTemplate>

<li><CSGallery:GalleryPostData LinkTo="ViewPicture" runat="server" Tag="Div" CssClass="GalleryGalleryImage"><ContentTemplate><CSGallery:GalleryPostImage runat="Server" ImageType="Thumbnail" /></ContentTemplate></CSGallery:GalleryPostData></li>

</ItemTemplate>

<FooterTemplate>

</ul>

</FooterTemplate>

</CSGallery:GalleryPostList>

<div class="GalleryGalleryFooter">

<CSControl:PlaceHolder runat="server">

<DisplayConditions><CSGallery:GalleryPropertyValueComparison ComparisonProperty="MostRecentPostID" Operator="GreaterThan" ComparisonValue="0" runat="server" /></DisplayConditions>

<ContentTemplate>

<CSControl:ResourceControl ResourceName="Gallery_AggregateUpdatedGalleriesListing_UploadedOn" runat="Server" />

<CSGallery:GalleryData runat="server" Property="MostRecentPostDate" />

<CSControl:ResourceControl ResourceName="Gallery_AggregateUpdatedGalleriesListing_By" runat="Server" />

 

<CSGallery:GalleryData runat="server" LinkTo="MostRecentPostAuthor" Property="MostRecentPostAuthor" />

</ContentTemplate>

</CSControl:PlaceHolder>

</div>

</div>

</div>

</li>

</ItemTemplate>

<FooterTemplate>

</ul>

</FooterTemplate>

</CSGallery:GalleryList>

 

<CSControl:SiteUrl runat="server" UrlName="gallerylist" ResourceName="Gallery_AggregateUpdatedGalleriesListing_ViewAll" />

</div>

 Save the changes and run it.

Hope this helps.

Kunlun

 

Top 200 Contributor
Posts 112
Points 1,900
qingsong replied on Wed, Jul 11 2007 4:54 PM

Thanks, Kunlun,

 This works for grouplist. What about the gallerylist? How to define the QueryOverrides so that only the gallery with pictures will show up on the list?

  • | Post Points: 20
Not Ranked
Posts 13
Points 215
Kunlun replied on Thu, Jul 12 2007 1:18 PM

Qingsong,

For a quick fix, just go to ~\web\themes\default\\galleries\gallerylist.aspx, and set the visibilty to false for those galleries with no photo posts.

Here is the partial code for the changes below. The only snag is that this approach does not change the totoal item number displayed below the list. The right way to do this is to do at the databinding level, i.e., remove the empty galleries from the data source before bind it to the custom control.

Holp this helps,

Kunlun

 

=========================================================================== 

<ItemTemplate>

<tr class="CommonListRow" runat="server" visible="<%# ((Gallery)Container.DataItem).PostCount > 0 %>">

<td class="CommonListCellLeftMost" valign="top">

<CSGallery:GalleryData runat="server" LinkTo="ViewGallery" Property="Name" /><br />

<CSGallery:GalleryData runat="server" Property="Description" />

</td>

<td class="CommonListCell" align="center"><CSGallery:GalleryData runat="server" Property="MostRecentPostDate" IncludeTimeInDate="true" />&nbsp;</td>

<td class="CommonListCell" align="center"><CSGallery:GalleryData runat="server" Property="TotalThreads" /></td>

</tr>

</ItemTemplate>

<AlternatingItemTemplate>

<tr class="CommonListRowAlt" runat="server" visible="<%# ((Gallery)Container.DataItem).PostCount > 0 %>">

<td class="CommonListCellLeftMost" valign="top">

<CSGallery:GalleryData runat="server" LinkTo="ViewGallery" Property="Name" /><br />

<CSGallery:GalleryData runat="server" Property="Description" />

</td>

<td class="CommonListCell" align="center"><CSGallery:GalleryData runat="server" Property="MostRecentPostDate" IncludeTimeInDate="true" />&nbsp;</td>

<td class="CommonListCell" align="center"><CSGallery:GalleryData runat="server" Property="TotalThreads" /></td>

</tr>

</AlternatingItemTemplate>

==========================================================================

  • | Post Points: 20
Top 200 Contributor
Posts 112
Points 1,900
qingsong replied on Thu, Jul 12 2007 2:41 PM

Can we use <QueryOverrides> to filter out those empty galleries?

What will be the fileter name?

  • | Post Points: 20
Not Ranked
Posts 13
Points 215
Kunlun replied on Thu, Jul 12 2007 4:57 PM

QueryOverrides does not have a defined property or method that can be used to filter out the empty Galleries. It does have a filter called "applyUserGroupFilter". Then we have define a groupQuery first and set the ApplyUserGroupFilter=True.

Kunlun

  • | Post Points: 5
Top 500 Contributor
Posts 84
Points 1,170
muro1 replied on Wed, Aug 15 2007 6:32 AM

Nice feature, Kunlun, thanks for sharing.

Regards. 

  • | Post Points: 5
Top 75 Contributor
Male
Posts 266
Points 1,140

I found a better solution in CS2007. In /theme/yourtheme/galleries/grouplist.aspx, there is a GalleryList control. Inside the <ItemTemplate>, just before the existing markup, add this:

<CSControl:PlaceHolder runat="server">
    <DisplayConditions><CSControl:SectionPropertyValueComparison ComparisonProperty="PostCount" ComparisonValue="0" Operator="GreaterThan" runat="server" /></DisplayConditions>
    <ContentTemplate>

Then right before the </ItemTemplate>, add this:

    </ContentTemplate>
</CSControl:PlaceHolder>

That will wrap everything in a PlaceHolder control, which will only display if the Section's PostCount is greater than 0.

This technique will also work on other areas of the site.

Page 1 of 1 (9 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com