protected void Page_Load(object sender, EventArgs e) { CurrentUser = Request.QueryString["CurrentUser"]; CurrentPhotoId = Request.QueryString["photo_id"]; if (string.IsNullOrEmpty(CurrentUser) || string.IsNullOrEmpty(CurrentPhotoId)) { photoalbum.Visible = false; Response.Write("<p width='100%' align='center'>\"This page requires specific parameters and can only be reached from a Album Detail page\"</p>"); return; } this.currPageItem = Sitecore.Context.Item; XslFile1.Parameters = String.Format(CultureInfo.CurrentCulture, "username={0}", CurrentUser); this.currPhoto = PhotoAlbumObject.RestoreItemFromQueryString(CurrentPhotoId); this.ImagesContent.InnerHtml = this.BuildImagesHtml(this.currPhoto); this.albumInst = new PhotoAlbumObject(null) { CurrentAlbumItem = (Item)HttpContext.Current.Session["CurrentAlbum"] }; // Generate album view link this.ReturnToAlbumLink.HRef = PhotoAlbumObject.GetItemPath(Sitecore.Configuration.Settings.GetSetting("detailAlbumPageID")) + "?CurrentAlbum=" + this.albumInst.CurrentAlbumItem.ID.ToString() + "&CurrentUser=" + CurrentUser; this.ShowReviews(); this.HideReviewFormForOwner(); if (PhotoRateClicked()) { this.PostReview(); Response.Redirect(Request.RawUrl); } EditZoomPicture(); }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Translate.Text("Album"); Label2.Text = Translate.Text("Upload"); SelectNUpload.Text = Translate.Text("Upload"); currPageItem = Sitecore.Context.Item; if (!Page.IsPostBack) { // If query string variable CurrentAlbum is set then copy it to session if (Request.QueryString["CurrentAlbum"] != null) { System.Web.HttpContext.Current.Session["CurrentAlbum"] = PhotoAlbumObject.RestoreItemFromQueryString(Request.QueryString["CurrentAlbum"]); } _albumInst = new PhotoAlbumObject(null); if (_albumInst.CurrentPhotoAlbumFolder != null) { ChildList albums = _albumInst.CurrentPhotoAlbumFolder.Children; var lstUserAlbums = new List <UserAlbum>(); foreach (Item alb in albums.InnerChildren) { if (alb.Name != "AlbumsListFeed") { lstUserAlbums.Add(new UserAlbum { Id = alb.ID, Name = alb.Name }); } } if (albums != null) { AlbumsList.DataSource = lstUserAlbums; AlbumsList.DataTextField = "Name"; AlbumsList.DataValueField = "ID"; AlbumsList.DataBind(); if (Request.QueryString["CurrentAlbum"] != null) { AlbumsList.SelectedValue = Request.QueryString["CurrentAlbum"]; } if (_albumInst.CurrentAlbumItem != null) { AlbumsList.SelectedValue = _albumInst.CurrentAlbumItem.Name; } } } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { CurrentUser = Request.QueryString["CurrentUser"]; CurrentAlbum = Request.QueryString["CurrentAlbum"]; if (string.IsNullOrEmpty(CurrentUser) || string.IsNullOrEmpty(CurrentAlbum)) { photoalbum.Visible = false; Response.Write("<p width='100%' align='center'>\"This page requires specific parameters and can only be reached from a All Albums or My Albums pages\"</p>"); return; } System.Web.HttpContext.Current.Session["CurrentAlbum"] = PhotoAlbumObject.RestoreItemFromQueryString(CurrentAlbum); System.Web.HttpContext.Current.Session["CurrentUser"] = CurrentUser; this.album = new PhotoAlbumObject("new Album"); this.album.CurrentAlbumItem = PhotoAlbumObject.RestoreItemFromQueryString(Request.QueryString["CurrentAlbum"]); var thumbnailsDataSource = GenerateDataSource(this.album); var pagePosition = 0; var i = 0; if (!string.IsNullOrEmpty(Request.QueryString["CurrentPhoto"])) { foreach (var p in this.album.GetAlbumPhotos()) { if (string.Equals(p.ID.ToString(), Request.QueryString["CurrentPhoto"].ToString())) { pagePosition = i / photosInPage; } i++; } if (!string.Equals(preSelectPhoto, Request.QueryString["CurrentPhoto"].ToString())) { preSelectPhoto = Request.QueryString["CurrentPhoto"]; dpPhotoAlbum.SetPageProperties(pagePosition * photosInPage, photosInPage, true); } } if (thumbnailsDataSource.Rows.Count <= photosInPage) { dpPhotoAlbum.Visible = false; } this.ThumbnailsRepeater.DataSource = thumbnailsDataSource; this.ThumbnailsRepeater.DataBind(); var currentPhotoId = Request.QueryString["CurrentPhoto"]; var currentPhotoItem = !string.IsNullOrEmpty(currentPhotoId) ? Sitecore.Context.Database.GetItem(currentPhotoId) : this.album.GetAlbumPhotos().FirstOrDefault(); if (currentPhotoItem != null) { this.BigPhoto.Text = this.GenerateFirstPhotoHtml(currentPhotoItem); } this.albumInst = new PhotoAlbumObject(null); var albumItm = PhotoAlbumObject.RestoreItemFromQueryString(Request.QueryString["CurrentAlbum"]); this.ShowReviews(albumItm); this.HideReviewFormForOwner(albumItm); if (Page.IsPostBack) { if (PhotoRateClicked()) { this.PostReview(albumItm); Response.Redirect(Request.RawUrl); } } XslFile1.Parameters = String.Format(CultureInfo.CurrentCulture, "username={0}", CurrentUser); }