/// <summary>
        /// Updates the settings for this module instance.
        /// </summary>
        public override void UpdateSettings()
        {
            if (this.Page.IsValid)
            {
                this.ArticleId = this.ArticleSelectorControl.ArticleId ?? Null.NullInteger;

                this.LastUpdatedFormat        = this.txtLastUpdatedFormat.Text.Trim();
                this.RatingDisplayOption      = (RatingDisplayOption)Enum.Parse(typeof(RatingDisplayOption), this.ddlDisplayRatings.SelectedValue);
                this.DisplayCommentSubmission = this.chkCommentSubmit.Checked;
                this.DisplayComments          = this.chkCommentDisplay.Checked;
                this.CommentDisplayOption     = (CommentDisplayOption)Enum.Parse(typeof(CommentDisplayOption), this.ddlDisplayComments.SelectedValue);
                this.DisplayRandomComment     = this.CommentDisplayOption.Equals(CommentDisplayOption.Paging); ////chkCommentRandom.Checked;
                this.FirstNameCollectOption   = (NameDisplayOption)Enum.Parse(typeof(NameDisplayOption), this.ddlFirstNameCollect.SelectedValue);
                this.LastNameCollectOption    = (NameDisplayOption)Enum.Parse(typeof(NameDisplayOption), this.ddlLastNameCollect.SelectedValue);
                this.CollectEmailAddress      = this.chkEmailAddressCollect.Checked;
                this.CollectUrl = this.chkUrlCollect.Checked;
                this.AllowPhotoGalleryDisplay = this.chkDisplayPhotoGallery.Checked;

                int parsedValue;
                this.MaximumNumberOfThumbnails = int.TryParse(
                    this.txtPhotoGalleryMaxCount.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                     ? parsedValue
                                                     : (int?)null;
                this.HoverThumbnailHeight = int.TryParse(
                    this.txtPhotoGalleryHoverThumbnailHeight.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                ? parsedValue
                                                : (int?)null;
                this.HoverThumbnailWidth = int.TryParse(
                    this.txtPhotoGalleryHoverThumbnailWidth.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                               ? parsedValue
                                               : (int?)null;
                this.GalleryThumbnailHeight = int.TryParse(
                    this.txtPhotoGalleryThumbnailHeight.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                  ? parsedValue
                                                  : (int?)null;
                this.GalleryThumbnailWidth = int.TryParse(
                    this.txtPhotoGalleryThumbnailWidth.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                 ? parsedValue
                                                 : (int?)null;
            }
        }
Ejemplo n.º 2
0
        private void ConfigureChildControls()
        {
            if (VersionInfoObject.IsNew)
            {
                return;
            }

            //check if items are enabled.
            if (DisplayEmailAFriend && VersionInfoObject.IsNew == false)
            {
                ea = (EmailAFriend)LoadControl(EmailControlToLoad);
                ea.ModuleConfiguration = ModuleConfiguration;
                ea.ID = Path.GetFileNameWithoutExtension(EmailControlToLoad);
                ea.VersionInfoObject = VersionInfoObject;
                phEmailAFriend.Controls.Add(ea);
            }
            if (DisplayPrinterFriendly && VersionInfoObject.IsNew == false)
            {
                pf = (PrinterFriendlyButton)LoadControl(PrinterControlToLoad);
                pf.ModuleConfiguration = ModuleConfiguration;
                pf.ID = Path.GetFileNameWithoutExtension(PrinterControlToLoad);
                phPrinterFriendly.Controls.Add(pf);
            }

            if (DisplayRelatedLinks)
            {
                ral = (RelatedArticleLinksBase)LoadControl(RelatedArticlesControlToLoad);
                ral.ModuleConfiguration = ModuleConfiguration;
                ral.ID = Path.GetFileNameWithoutExtension(RelatedArticlesControlToLoad);
                phRelatedArticles.Controls.Add(ral);
            }

            if (DisplayRelatedArticle)
            {
                Article a = VersionInfoObject.GetRelatedArticle(PortalId);
                if (a != null)
                {
                    ad = (ArticleDisplay)LoadControl(ArticleControlToLoad);
                    ad.ModuleConfiguration = ModuleConfiguration;
                    ad.ID                     = Path.GetFileNameWithoutExtension(ArticleControlToLoad);
                    ad.Overrideable           = false;
                    ad.UseCache               = true;
                    ad.DisplayPrinterFriendly = false;
                    ad.DisplayRelatedArticle  = false;
                    ad.DisplayRelatedLinks    = false;
                    ad.DisplayEmailAFriend    = false;



                    ad.SetItemId(a.ItemId);
                    ad.DisplayTitle = false;
                    phRelatedArticle.Controls.Add(ad);
                    divRelatedArticle.Visible = true;
                }
                else
                {
                    divRelatedArticle.Visible = false;
                }
            }

            if (RatingDisplayOption.Equals(RatingDisplayOption.Enable) || RatingDisplayOption.Equals(RatingDisplayOption.ReadOnly))
            {
                //get the upnlRating setting
                ItemVersionSetting rtSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "upnlRating", "Visible", PortalId);
                if (rtSetting != null)
                {
                    upnlRating.Visible = Convert.ToBoolean(rtSetting.PropertyValue, CultureInfo.InvariantCulture);
                }
                if (upnlRating.Visible)
                {
                    //lblRatingMessage.Visible = true; //TODO: re-enable ratings
                    lblRatingMessage.Visible = false; //TODO: re-enable ratings

                    //ajaxRating.MaxRating = MaximumRating;

                    var avgRating = (int)Math.Round(((Article)VersionInfoObject).AverageRating);
                    //ajaxRating.CurrentRating = (avgRating > MaximumRating ? MaximumRating : (avgRating < 0 ? 0 : avgRating));

                    //ajaxRating.ReadOnly = RatingDisplayOption.Equals(RatingDisplayOption.ReadOnly);
                }
            }

            btnComment.Visible = DisplayCommentsLink;
            if (IsCommentsEnabled)
            {
                btnComment.NavigateUrl = Request.RawUrl + "#CommentEntry";
                if (!UseForumComments || (DisplayPublishComments && !VersionInfoObject.IsNew))
                {
                    pnlComments.Visible = pnlCommentDisplay.Visible = true;
                    commentDisplay      = (CommentDisplayBase)LoadControl(CommentsControlToLoad);
                    commentDisplay.ModuleConfiguration = ModuleConfiguration;
                    commentDisplay.ID        = Path.GetFileNameWithoutExtension(CommentsControlToLoad);
                    commentDisplay.ArticleId = VersionInfoObject.ItemId;
                    phCommentsDisplay.Controls.Add(commentDisplay);
                }

                if (UseForumComments)
                {
                    pnlComments.Visible = true;
                    mvCommentDisplay.SetActiveView(vwForumComments);
                    ItemVersionSetting forumThreadIdSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "ArticleSetting", "CommentForumThreadId", PortalId);
                    if (forumThreadIdSetting != null)
                    {
                        lnkGoToForum.Visible     = true;
                        lnkGoToForum.NavigateUrl = ForumProvider.GetInstance(PortalId).GetThreadUrl(Convert.ToInt32(forumThreadIdSetting.PropertyValue, CultureInfo.InvariantCulture));
                    }
                    else
                    {
                        btnForumComment.Visible = true;
                    }
                }
            }
            ConfigureTags();
        }
        /// <summary>
        /// Updates the settings for this module instance.
        /// </summary>
        public override void UpdateSettings()
        {
            if (Page.IsValid)
            {
                ArticleId = ArticleSelectorControl.ArticleId ?? Null.NullInteger;

                LastUpdatedFormat = txtLastUpdatedFormat.Text.Trim();
                RatingDisplayOption = (RatingDisplayOption)Enum.Parse(typeof(RatingDisplayOption), ddlDisplayRatings.SelectedValue);
                DisplayCommentSubmission = chkCommentSubmit.Checked;
                DisplayComments = chkCommentDisplay.Checked;
                CommentDisplayOption = (CommentDisplayOption)Enum.Parse(typeof(CommentDisplayOption), ddlDisplayComments.SelectedValue);
                DisplayRandomComment = CommentDisplayOption.Equals(CommentDisplayOption.Paging); ////chkCommentRandom.Checked;
                FirstNameCollectOption = (NameDisplayOption)Enum.Parse(typeof(NameDisplayOption), ddlFirstNameCollect.SelectedValue);
                LastNameCollectOption = (NameDisplayOption)Enum.Parse(typeof(NameDisplayOption), ddlLastNameCollect.SelectedValue);
                CollectEmailAddress = chkEmailAddressCollect.Checked;
                CollectUrl = chkUrlCollect.Checked;
                AllowPhotoGalleryDisplay = chkDisplayPhotoGallery.Checked;

                int parsedValue;
                MaximumNumberOfThumbnails = int.TryParse(txtPhotoGalleryMaxCount.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                     ? parsedValue
                                                     : (int?)null;
                HoverThumbnailHeight = int.TryParse(txtPhotoGalleryHoverThumbnailHeight.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                ? parsedValue
                                                : (int?)null;
                HoverThumbnailWidth = int.TryParse(txtPhotoGalleryHoverThumbnailWidth.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                               ? parsedValue
                                               : (int?)null;
                GalleryThumbnailHeight = int.TryParse(txtPhotoGalleryThumbnailHeight.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                  ? parsedValue
                                                  : (int?)null;
                GalleryThumbnailWidth = int.TryParse(txtPhotoGalleryThumbnailWidth.Text, NumberStyles.Integer, CultureInfo.CurrentCulture, out parsedValue)
                                                 ? parsedValue
                                                 : (int?)null;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sets the values on this form based on the settings stored for this module instance
        /// </summary>
        private void SetInitialValues()
        {
            ListItem li = ddlDisplayRatings.Items.FindByValue(RatingDisplayOption.ToString());

            if (li != null)
            {
                li.Selected = true;
            }

            li = ddlDisplayComments.Items.FindByValue(CommentDisplayOption.ToString());
            if (li != null)
            {
                li.Selected = true;
            }

            if (ddlFirstNameCollect != null)
            {
                li = ddlFirstNameCollect.Items.FindByValue(FirstNameCollectOption.ToString());
            }
            if (li != null)
            {
                li.Selected = true;
            }

            li = ddlLastNameCollect.Items.FindByValue(LastNameCollectOption.ToString());
            if (li != null)
            {
                li.Selected = true;
            }

            ArticleSelectorControl.ArticleId = ArticleId;

            if (MaximumNumberOfThumbnails.HasValue && MaximumNumberOfThumbnails.Value > 0)
            {
                txtPhotoGalleryMaxCount.Text = MaximumNumberOfThumbnails.Value.ToString(CultureInfo.CurrentCulture);
            }

            if (HoverThumbnailHeight.HasValue && HoverThumbnailHeight.Value > 0)
            {
                txtPhotoGalleryHoverThumbnailHeight.Text = HoverThumbnailHeight.Value.ToString(CultureInfo.CurrentCulture);
            }

            if (HoverThumbnailWidth.HasValue && HoverThumbnailWidth.Value > 0)
            {
                txtPhotoGalleryHoverThumbnailWidth.Text = HoverThumbnailWidth.Value.ToString(CultureInfo.CurrentCulture);
            }

            if (GalleryThumbnailHeight.HasValue && GalleryThumbnailHeight.Value > 0)
            {
                txtPhotoGalleryThumbnailHeight.Text = GalleryThumbnailHeight.Value.ToString(CultureInfo.CurrentCulture);
            }

            if (GalleryThumbnailWidth.HasValue && GalleryThumbnailWidth.Value > 0)
            {
                txtPhotoGalleryThumbnailWidth.Text = GalleryThumbnailWidth.Value.ToString(CultureInfo.CurrentCulture);
            }

            chkDisplayPhotoGallery.Checked = AllowPhotoGalleryDisplay;

            chkCommentDisplay.Checked      = DisplayComments;
            chkCommentSubmit.Checked       = DisplayCommentSubmission;
            chkEmailAddressCollect.Checked = CollectEmailAddress;
            chkUrlCollect.Checked          = CollectUrl;

            if (txtLastUpdatedFormat != null)
            {
                txtLastUpdatedFormat.Text = LastUpdatedFormat;
            }
        }