/// <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; } }
/// <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; } }