Example #1
0
        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();
        }
Example #2
0
        /// <summary>
        /// Generates the first photo HTML.
        /// </summary>
        /// <param name="item">The source item.</param>
        /// <returns>The first photo HTML.</returns>
        private string GenerateFirstPhotoHtml(Item item)
        {
            const string Template = @"
      <a href='{0}'><img class='img-shadow' width='230px' src='{1}'></a>
      <div class='title'>{2}</div>
      <div class='slideshow'><a href='{3}'>{4}</a></div>
      <div class='sub'>{5}</div>";

            var bigPhotoLink = GetPhotoPageLink(item);
            var bigPhotoSrc  = GetPhotoSrc(item, 230);
            var count        = this.album.GetAlbumPhotos().Count();
            var countText    = count == 1 ? string.Format(CultureInfo.InvariantCulture, "{0} photo", count) : string.Format(CultureInfo.InvariantCulture, "{0} photos", count);
            var viewSlider   = PhotoAlbumObject.GetItemPath(Sitecore.Configuration.Settings.GetSetting("albumSliderPageItemID")) + "?CurrentAlbum=" + this.album.CurrentAlbumItem.ID + "&CurrentUser="******"View Slideshow", countText);

            return(result);
        }
Example #3
0
        /// <summary>
        /// Gets the photo page link.
        /// </summary>
        /// <param name="item">The photo item.</param>
        /// <returns>The photo page link.</returns>
        private static string GetPhotoPageLink(Item item)
        {
            var link = PhotoAlbumObject.GetItemPath(Sitecore.Configuration.Settings.GetSetting("detailPhotoPageItemID")) + "?photo_id=" + item.ID + "&CurrentUser=" + CurrentUser;

            return(link);
        }
Example #4
0
        /// <summary>
        /// Generates the data source.
        /// </summary>
        /// <param name="album">The album.</param>
        /// <returns>The data source.</returns>
        private static DataTable GenerateDataSource(PhotoAlbumObject album)
        {
            var table = new DataTable("Thumbnails");

            table.Columns.Add("link");
            table.Columns.Add("srcLink");

            var images = album.GetAlbumPhotos();

            foreach (var item in images)
            {
                //  const string Template = @"/Photo_album/Custom/View_Album.aspx?CurrentAlbum={0}&CurrentPhoto={1}";

                const string Template = @"{0}?CurrentAlbum={1}&CurrentPhoto={2}&CurrentUser={3}";
                var          link     = string.Format(CultureInfo.InvariantCulture, Template, PhotoAlbumObject.GetItemPath(Sitecore.Configuration.Settings.GetSetting("detailAlbumPageID")),
                                                      album.CurrentAlbumItem.ID, item.ID, CurrentUser);
                var srcLink = GetPhotoSrc(item, 80);

                table.Rows.Add(link, srcLink);
            }

            return(table);
        }