/// <summary> /// Hook showing gallery items on a network profile. /// </summary> /// <param name="e">Hook event arguments</param> public void ShowNetworkGallery(HookEventArgs e) { Network theNetwork = (Network)e.Owner; Template template = new Template(Assembly.GetExecutingAssembly(), "viewprofilegallery"); template.Medium = core.Template.Medium; template.SetProse(core.Prose); Gallery gallery = new Gallery(e.core, theNetwork); List<GalleryItem> galleryItems = gallery.GetItems(e.core, 1, 6, 0); template.Parse("PHOTOS", theNetwork.GalleryItems.ToString()); foreach (GalleryItem galleryItem in galleryItems) { VariableCollection galleryVariableCollection = template.CreateChild("photo_list"); galleryVariableCollection.Parse("TITLE", galleryItem.ItemTitle); galleryVariableCollection.Parse("PHOTO_URI", Gallery.BuildPhotoUri(core, theNetwork, galleryItem.Path)); string thumbUri = string.Format("/network/{0}/images/_tiny/{1}", theNetwork.NetworkNetwork, galleryItem.Path); galleryVariableCollection.Parse("THUMBNAIL", thumbUri); } template.Parse("U_NETWORK_GALLERY", Gallery.BuildGalleryUri(core, theNetwork)); e.core.AddMainPanel(template); }
/// <summary> /// Hook showing gallery items on a group profile. /// </summary> /// <param name="e">Hook event arguments</param> public void ShowGroupGallery(HookEventArgs e) { UserGroup thisGroup = (UserGroup)e.Owner; if (!(!thisGroup.IsGroupMember(e.core.LoggedInMemberItemKey) && thisGroup.GroupType == "CLOSED")) { Template template = new Template(Assembly.GetExecutingAssembly(), "viewprofilegallery"); template.Medium = core.Template.Medium; template.SetProse(core.Prose); // show recent photographs in the gallery Gallery gallery = new Gallery(e.core, thisGroup); List<GalleryItem> galleryItems = gallery.GetItems(e.core, 1, 6, 0); template.Parse("PHOTOS", thisGroup.GalleryItems.ToString()); foreach (GalleryItem galleryItem in galleryItems) { VariableCollection galleryVariableCollection = template.CreateChild("photo_list"); galleryVariableCollection.Parse("TITLE", galleryItem.ItemTitle); galleryVariableCollection.Parse("PHOTO_URI", galleryItem.Uri); galleryVariableCollection.Parse("THUMBNAIL", galleryItem.ThumbnailUri); } template.Parse("U_GROUP_GALLERY", Gallery.BuildGalleryUri(core, thisGroup)); e.core.AddMainPanel(template); } }