MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Photo Gallery on User Profile Page? (Closed) (Mono Support )

Viewed 19813 time(s), 9 post(s) 12/20/2011 9:19:02 PMby grant.stone007
grant-stone007

grant.stone007

12/20/2011 9:19:02 PM
I had an idea to place the Photo Gallery Web Part on the User Profile page so Albums and photos would be part of profile page sort of like Facebook has. I had hoped that when ...

1. A visitor (non-user) or a User (non-Friend) goes to /profile/userA/ they see userA's Albums and Photos marked Public.
2. When a Friend visits /profile/userA/ they see userA's Albums and Photos marked Friends or Public.
3. When userA visits his/her own profile page they see all Albums and photos owned by userA (and perhaps can create new, delete, edit, etc.)

My goal is to satisfy 1 and 2 above, 3 is not important because userA can always go to existing PhotoGallery.aspx page to admin their albums and photos.

It seems scenario 3 above works just fine but 1, 2 do not is I place a Photo Gallery webpart on Profile page. It seems Photo Gallery part is context sensitive to current user and has no means to filter albums or photos beyond that. Correct?

What approach might I take to devise such a feature? Are there any ways using existing API? I have experimented with AlbumList and NewAlbumsList classes but cannot seem to figure out how to override the datasource of lvItem control in a manner that displays properly at runtime. I can successfully construct the proper EntityCollection<snAlbumEntity> but I fail at applying it.

Any advice would be appreciated.
This content has not been rated yet. 
647 Reputation 69 Total posts
grant-stone007

grant.stone007

12/21/2011 5:27:04 AM
I think I almost have my own solution. I started with the PopularGroups sample and modified it, inheriting from NewAlbumList. Now I will work on
1. Modify DataBind() to get the collection I want. I will use PopularGroupsRepository sample to create my own GetAlbums method.
2. Create a custom Template without some of the Tags.
3. Override action when click on Album Cover img to invoke a PrettyPhoto presentation of Photos.

I will post again when I have question or when I am completed with solution.
This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

12/21/2011 7:44:21 AM
Hi,

maybe there is an easier way, we can expose few methods that will allow you to access the existing user based filter then you can just set the UserId on the user profile page and it should work as is.

I'll let you know when we prepare this for you.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
khorvat

khorvat

12/21/2011 8:37:19 AM
Hi,

we have exposed the UserId so you can set the property on the user profile page and try to get only albums for that user. If you want to change sub module initialization you will need to inherit the PhotoGalleryContainer module and override the OnInitialize method.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
grant-stone007

grant.stone007

12/21/2011 1:59:43 PM
Sounds good. Are you referring to exposing UserId on the NewAlbumsList class or AlbumList class what class are you speaking of?

I assume you will provide some new binaries in near future. Until then I will continue with my approach as it is a good academic exercise for me in how to create a custom web part.
This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

12/21/2011 2:11:48 PM
Hi,

I have sent you new assemblies with InMail and as I have mentioned you will need to set PhotoGalleryContainer UserId property on the user profile page and try to get only albums for that user.

Did you get the assemblies zip file ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
grant-stone007

grant.stone007

12/21/2011 4:02:01 PM
I did receive email with zip atttached. Sorry, I should have rad emails first before previous post. I have done some simple tests and it looks like the PhotoGalleryContainer.UserId is the only new exposed property. Right?

When I set this to the UserId of the profile page being viewed there are some odd behaviors with respect to who is visiting the profile page.

Let us say we are visiting UserA' profile page. (/profile/UserA/)
1. If visitor is UserA then all is OK as expected. All PhotoGalleryContainer features are enabled.
2. If visitor is UserB (authenticated) then PhotoGalleryContainer behaves as though UserB meaning it show UserB's My Albums, Create Album, etc.
3. if visitor is annonymous (not authenticated then PhotoGalleryContainer only show Albums tab and all albums are shown.

My desire that case 2,3 above would only show UserA photo albums.

Perhaps I am over simplifying my implementation as my initial testing merely sets the UserId property in a small code block right in the UserProfile page.

Are there other property or methods you exposed?

Perhaps my timing of setting the PhotoGalleryContainer.UserID property is incorrect. What page lifecycle phase would you set it in and should I call PhotoGalleryContainer.DataBind() after setting UserId?

Thank you so much.
This content has not been rated yet. 
647 Reputation 69 Total posts
grant-stone007

grant.stone007

12/30/2011 3:39:24 PM
I create a solution by creating a custom control (copy of NewAlbumsList.ascx) and a class that inherits from NewAlbumsList. I override Databind() establishing context of current user and user of albums to view. Then call a custom GetAlbums() method to set bindContainer.Collection to my custom collection of SnAlbumEntity.

The result is a control I place on UserProfile page that behaves as I desired in terns of non-authenticated, users, friends, etc.

Thanks for your suggestions as they lead me to my solution. I also made use of couple of other support topics that illustrated functionality.
This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

12/30/2011 5:20:01 PM
I'm glad that you have found a way to accomplish the task, we have this kind of extensions simplified even more in next MonoX version. 
This content has not been rated yet. 
15993 Reputation 2214 Total posts