override protected void OnInit(EventArgs e) { InitializeComponent(); LoadControlType(); base.OnInit(e); LoadSharedResources(); //ctlUrlSelection.Url = ItemVersionSetting attachmentSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "ArticleSettings", "ArticleAttachment", PortalId); if (attachmentSetting != null) { ctlUrlSelection.Url = attachmentSetting.PropertyValue; } }
private void Page_Load(object sender, EventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } try { this.btnShowRelatedItem.Visible = false; this.divRelatedLinks.Visible = false; var related = new List <Article>(this.VersionInfoObject.GetRelatedArticles(this.PortalId)); ItemVersionSetting parentRelationshipSetting = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "ArticleSettings", "IncludeParentCategoryArticles", this.PortalId); if (parentRelationshipSetting != null && Convert.ToBoolean(parentRelationshipSetting.PropertyValue, CultureInfo.InvariantCulture)) { int parentCategoryId = Category.GetParentCategory(this.VersionInfoObject.ItemId, this.PortalId); if (parentCategoryId > 0) { // get all articles in the same category, then removes this current article from that list. BD List <Article> categoryArticles = Category.GetCategoryArticles(parentCategoryId, this.PortalId); categoryArticles.RemoveAll(a => a.ItemId == this.VersionInfoObject.ItemId); related.AddRange(categoryArticles); } } if (related.Count < 1) { this.btnShowRelatedItem.Visible = false; this.divRelatedLinks.Visible = false; this.LinksPopulated = false; } else { this.lstItems.DataSource = related; this.lstItems.DataBind(); this.divRelatedLinks.Visible = true; this.LinksPopulated = true; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private int?GetCategoryForumId() { //TODO: we need to handle items that no longer have a valid parent Category pc = Category.GetCategory(Category.GetParentCategory(VersionInfoObject.ItemId, PortalId), PortalId); if (pc != null) { int parentCategoryItemVersionId = pc.ItemVersionId; ItemVersionSetting categoryForumSetting = ItemVersionSetting.GetItemVersionSetting(parentCategoryItemVersionId, "CategorySettings", "CommentForumId", PortalId); int categoryForumId; if (categoryForumSetting == null) { return(null); } Int32.TryParse(categoryForumSetting.PropertyValue, out categoryForumId); return(categoryForumId); } return(null); }
private void ConfigureTags() { //get the upnlRating setting ItemVersionSetting tgSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "pnlTags", "Visible", PortalId); if (tgSetting != null) { pnlTags.Visible = Convert.ToBoolean(tgSetting.PropertyValue, CultureInfo.InvariantCulture); if (Convert.ToBoolean(tgSetting.PropertyValue, CultureInfo.InvariantCulture)) { PopulateTagList(); } } else { if (VersionInfoObject.Tags.Count > 0) { pnlTags.Visible = true; PopulateTagList(); } } }
private void LoadCommentForumsDropDown() { if (IsCommentsEnabled && !IsPublishCommentType) { ddlCommentForum.Items.Clear(); foreach (KeyValuePair <int, string> pair in ForumProvider.GetInstance(PortalId).GetForums()) { ddlCommentForum.Items.Add(new ListItem(pair.Value, pair.Key.ToString(CultureInfo.InvariantCulture))); } ddlCommentForum.Items.Insert(0, (new ListItem(Localization.GetString("NoForum", LocalResourceFile), "-1"))); ItemVersionSetting commentForumSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "CategorySettings", "CommentForumId", PortalId); if (commentForumSetting != null) { ddlCommentForum.SelectedValue = commentForumSetting.PropertyValue; } } else { rowCommentForum.Visible = false; } }
private void DisplayArticle() { if (VersionInfoObject.IsNew) { if (IsAdmin || IsAuthor) { //Default the text to no approved version. if the module isn't configured or no Categories/Articles exist yet then it will be overwritten. lblArticleText.Text = Localization.GetString("NoApprovedVersion", LocalResourceFile); //Check to see if there are Categories defined. If none are defined this is the first //instance of the Module so we need to notify the user to create categories and articles. int categoryCount = DataProvider.Instance().GetCategories(PortalId).Rows.Count; if (categoryCount == 0) { lblArticleText.Text = Localization.GetString("NoDataToDisplay", LocalResourceFile); } else if (IsConfigured == false) { lnkConfigure.Text = Localization.GetString("UnableToFindAction", LocalResourceFile); lnkConfigure.NavigateUrl = EditUrl("ModuleId", ModuleId.ToString(CultureInfo.InvariantCulture), "Module"); lnkConfigure.Visible = true; lblArticleText.Text = Localization.GetString("UnableToFind", LocalResourceFile); } } return; } if (Item.GetItemType(VersionInfoObject.ItemId, PortalId) == "Article") { UseCache = true; var article = (Article)VersionInfoObject; if (DisplayTitle) { SetPageTitle(); lblArticleTitle.Text = article.Name; divArticleTitle.Visible = true; divLastUpdated.Visible = true; } article.ArticleText = Utility.ReplaceTokens(article.ArticleText); DisplayArticlePaging(article); string referrer = string.Empty; if (HttpContext.Current.Request.UrlReferrer != null) { referrer = HttpContext.Current.Request.UrlReferrer.ToString(); } string url = string.Empty; if (HttpContext.Current.Request.RawUrl != null) { url = HttpContext.Current.Request.RawUrl; } article.AddView(UserId, TabId, HttpContext.Current.Request.UserHostAddress); DateTime lastUpdated = Convert.ToDateTime(article.LastUpdated, CultureInfo.InvariantCulture); DateTime dateCreated = Convert.ToDateTime(article.CreatedDate, CultureInfo.InvariantCulture); lblLastUpdated.Text = String.Format(Localization.GetString("LastUpdated", LocalResourceFile), lastUpdated.ToString(LastUpdatedFormat, CultureInfo.CurrentCulture)); lblDateCreated.Text = String.Format(Localization.GetString("DateCreated", LocalResourceFile), dateCreated.ToShortDateString()); //get the pnlAuthor setting ItemVersionSetting auSetting = ItemVersionSetting.GetItemVersionSetting(article.ItemVersionId, "pnlAuthor", "Visible", PortalId); if (auSetting != null) { ShowAuthor = Convert.ToBoolean(auSetting.PropertyValue, CultureInfo.InvariantCulture); } if (ShowAuthor) { pnlAuthor.Visible = true; lblAuthor.Text = article.Author; if (lblAuthor.Text.Trim().Length < 1) { var uc = new UserController(); UserInfo ui = uc.GetUser(PortalId, article.AuthorUserId); lblAuthor.Text = ui.DisplayName; } if (lblAuthor.Text.Trim().Length < 1) { pnlAuthor.Visible = false; } } else { pnlAuthor.Visible = false; } //get the pnlPrinterFriendly setting ItemVersionSetting pfSetting = ItemVersionSetting.GetItemVersionSetting(article.ItemVersionId, "pnlPrinterFriendly", "Visible", PortalId); if (pfSetting != null) { pnlPrinterFriendly.Visible = Convert.ToBoolean(pfSetting.PropertyValue, CultureInfo.InvariantCulture); } //get the pnlEmailAFriend setting ItemVersionSetting efSetting = ItemVersionSetting.GetItemVersionSetting(article.ItemVersionId, "pnlEmailAFriend", "Visible", PortalId); if (efSetting != null) { pnlEmailAFriend.Visible = Convert.ToBoolean(efSetting.PropertyValue, CultureInfo.InvariantCulture); } //get the pnlComments setting ItemVersionSetting ctSetting = ItemVersionSetting.GetItemVersionSetting(article.ItemVersionId, "pnlComments", "Visible", PortalId); if (ctSetting != null) { pnlComments.Visible = Convert.ToBoolean(ctSetting.PropertyValue, CultureInfo.InvariantCulture); } ////get the upnlRating setting //ItemVersionSetting tgSetting = ItemVersionSetting.GetItemVersionSetting(article.ItemVersionId, "pnlTags", "Visible"); //if (tgSetting != null) //{ // pnlTags.Visible = Convert.ToBoolean(tgSetting.PropertyValue, CultureInfo.InvariantCulture); // if (Convert.ToBoolean(tgSetting.PropertyValue, CultureInfo.InvariantCulture)) // { // PopulateTagList(); // } //} //else //{ // if (article.Tags.Count > 0) // { // pnlTags.Visible = true; // PopulateTagList(); // } //} DisplayReturnToList(article); } }
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(); }
private void SaveSettings() { var av = (Article)VersionInfoObject; av.VersionSettings.Clear(); //Printer Friendly Setting setting = Setting.PrinterFriendly; setting.PropertyValue = chkPrinterFriendly.Checked.ToString(CultureInfo.InvariantCulture); var itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //AuthorName setting setting = Setting.AuthorName; setting.PropertyValue = itemEditControl.AuthorName; itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //Email A Friend setting = Setting.EmailAFriend; setting.PropertyValue = chkEmailAFriend.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //ratings setting = Setting.Rating; setting.PropertyValue = chkRatings.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //comments setting = Setting.Comments; setting.PropertyValue = chkComments.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //forum comments setting = Setting.ForumComments; setting.PropertyValue = chkForumComments.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //forum comments thread ID //just continue forward to the next version, this doesn't get set in the edit screen itemVersionSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "ArticleSetting", "CommentForumThreadId", PortalId); if (itemVersionSetting != null) { av.VersionSettings.Add(itemVersionSetting); } //display on current page option setting = Setting.ArticleSettingCurrentDisplay; setting.PropertyValue = rblDisplayOnCurrentPage.SelectedValue; itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //force display on specific page setting = Setting.ArticleSettingForceDisplay; setting.PropertyValue = chkForceDisplayTab.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //display return to list setting = Setting.ArticleSettingReturnToList; setting.PropertyValue = chkReturnList.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //show author setting = Setting.Author; setting.PropertyValue = chkShowAuthor.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //show tags setting = Setting.ShowTags; setting.PropertyValue = chkTags.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //use approvals setting = Setting.UseApprovals; setting.PropertyValue = chkUseApprovals.Checked.ToString(CultureInfo.InvariantCulture); itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); //article attachment setting = Setting.ArticleAttachment; setting.PropertyValue = ctlUrlSelection.Url; itemVersionSetting = new ItemVersionSetting(setting); av.VersionSettings.Add(itemVersionSetting); }
private void Page_Load(object sender, EventArgs e) { try { LocalizeCollapsePanels(); DotNetNuke.UI.Utilities.ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteConfirm", LocalResourceFile)); var av = (Article)VersionInfoObject; if (!Page.IsPostBack) { //check to see if we're dealing with a new Item, if so set the parentid based on the querystring if (av.IsNew) { if (ParentId != -1) { Category parent = Category.GetCategory(ParentId, PortalId);// = null; parentCategoryRelationship.AddToSelectedItems(parent); } } //trArticleId.Visible = ShowItemIds; txtArticleId.Text = VersionInfoObject.ItemId.ToString(CultureInfo.CurrentCulture) == "-1" ? Localization.GetString("NewArticle", LocalResourceFile) : VersionInfoObject.ItemId.ToString(CultureInfo.CurrentCulture); txtVersionNumber.Text = av.VersionNumber; TeArticleText.Text = av.ArticleText; txtPreviousVersionDescription.Text = av.VersionDescription; rblDisplayOnCurrentPage.Items.Add(new ListItem(Localization.GetString("CurrentPage", LocalResourceFile), true.ToString(CultureInfo.InvariantCulture))); rblDisplayOnCurrentPage.Items.Add(new ListItem(Localization.GetString("SpecificPage", LocalResourceFile), false.ToString(CultureInfo.InvariantCulture))); //get the pnlPrinterFriendly setting ItemVersionSetting pfSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "pnlPrinterFriendly", "Visible", PortalId); if (pfSetting != null) { chkPrinterFriendly.Checked = Convert.ToBoolean(pfSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostPrinterFriendlySetting = HostController.Instance.GetString(Utility.PublishDefaultPrinterFriendly + PortalId.ToString(CultureInfo.InvariantCulture)); chkPrinterFriendly.Checked = !Utility.HasValue(hostPrinterFriendlySetting) || Convert.ToBoolean(hostPrinterFriendlySetting, CultureInfo.InvariantCulture); } //get the pnlEmailAFriend setting ItemVersionSetting efSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "pnlEmailAFriend", "Visible", PortalId); if (efSetting != null) { chkEmailAFriend.Checked = Convert.ToBoolean(efSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostEmailFriendSetting = HostController.Instance.GetString(Utility.PublishDefaultEmailAFriend + PortalId.ToString(CultureInfo.InvariantCulture)); chkEmailAFriend.Checked = !Utility.HasValue(hostEmailFriendSetting) || Convert.ToBoolean(hostEmailFriendSetting, CultureInfo.InvariantCulture); } //if ratings are enabled show options if (AreRatingsEnabled) { //get the upnlRating setting ItemVersionSetting rtSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "upnlRating", "Visible", PortalId); if (rtSetting != null) { chkRatings.Checked = Convert.ToBoolean(rtSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostRatingSetting = HostController.Instance.GetString(Utility.PublishDefaultRatings + PortalId.ToString(CultureInfo.InvariantCulture)); chkRatings.Checked = !Utility.HasValue(hostRatingSetting) || Convert.ToBoolean(hostRatingSetting, CultureInfo.InvariantCulture); } } else { chkRatings.Visible = false; } //if comments are enabled show options. if (IsCommentsEnabled) { //get the pnlComments setting ItemVersionSetting ctSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "pnlComments", "Visible", PortalId); if (ctSetting != null) { chkComments.Checked = Convert.ToBoolean(ctSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostCommentSetting = HostController.Instance.GetString(Utility.PublishDefaultComments + PortalId.ToString(CultureInfo.InvariantCulture)); chkComments.Checked = !Utility.HasValue(hostCommentSetting) || Convert.ToBoolean(hostCommentSetting, CultureInfo.InvariantCulture); } if (IsPublishCommentType) { chkForumComments.Visible = false; } else { ItemVersionSetting forumCommentSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "chkForumComments", "Checked", PortalId); chkForumComments.Checked = forumCommentSetting == null || Convert.ToBoolean(forumCommentSetting.PropertyValue, CultureInfo.InvariantCulture); } } else { chkComments.Visible = false; chkForumComments.Visible = false; } //chkShowAuthor ItemVersionSetting auSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "pnlAuthor", "Visible", PortalId); if (auSetting != null) { chkShowAuthor.Checked = Convert.ToBoolean(auSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostAuthorSetting = HostController.Instance.GetString(Utility.PublishDefaultShowAuthor + PortalId.ToString(CultureInfo.InvariantCulture)); chkShowAuthor.Checked = Utility.HasValue(hostAuthorSetting) && Convert.ToBoolean(hostAuthorSetting, CultureInfo.InvariantCulture); } //chkShowTags ItemVersionSetting tagSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "pnlTags", "Visible", PortalId); if (tagSetting != null) { chkTags.Checked = Convert.ToBoolean(tagSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostTagsSetting = HostController.Instance.GetString(Utility.PublishDefaultShowTags + PortalId.ToString(CultureInfo.InvariantCulture)); chkTags.Checked = Utility.HasValue(hostTagsSetting) && Convert.ToBoolean(hostTagsSetting, CultureInfo.InvariantCulture); } //chkDisplayOnCurrentPage ItemVersionSetting cpSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "ArticleSettings", "DisplayOnCurrentPage", PortalId); if (cpSetting != null) { rblDisplayOnCurrentPage.SelectedValue = av.DisplayOnCurrentPage().ToString(CultureInfo.InvariantCulture); if (av.DisplayOnCurrentPage()) { chkForceDisplayTab.Checked = false; chkForceDisplayTab.Visible = false; lblForceDisplayTab.Visible = false; ddlDisplayTabId.Enabled = false; } else { chkForceDisplayTab.Visible = true; lblForceDisplayTab.Visible = true; ddlDisplayTabId.Enabled = true; } } else if (av.DisplayTabId < 0) { rblDisplayOnCurrentPage.SelectedValue = false.ToString(CultureInfo.InvariantCulture); chkForceDisplayTab.Checked = false; chkForceDisplayTab.Visible = true; lblForceDisplayTab.Visible = true; ddlDisplayTabId.Enabled = true; } else { rblDisplayOnCurrentPage.SelectedValue = false.ToString(CultureInfo.InvariantCulture); chkForceDisplayTab.Visible = true; lblForceDisplayTab.Visible = true; ddlDisplayTabId.Enabled = true; } chkForceDisplayTab.Checked = av.ForceDisplayOnPage(); ItemVersionSetting rlSetting = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "ArticleSettings", "DisplayReturnToList", PortalId); if (rlSetting != null) { chkReturnList.Checked = Convert.ToBoolean(rlSetting.PropertyValue, CultureInfo.InvariantCulture); } else { string hostReturnToListSetting = HostController.Instance.GetString(Utility.PublishDefaultReturnToList + PortalId.ToString(CultureInfo.InvariantCulture)); chkReturnList.Checked = Utility.HasValue(hostReturnToListSetting) && Convert.ToBoolean(hostReturnToListSetting, CultureInfo.InvariantCulture); } //use approvals setting ItemVersionSetting useApprovals = ItemVersionSetting.GetItemVersionSetting(av.ItemVersionId, "chkUseApprovals", "Checked", PortalId); chkUseApprovals.Checked = useApprovals == null || Convert.ToBoolean(useApprovals.PropertyValue, CultureInfo.InvariantCulture); chkUseApprovals.Visible = IsAdmin && UseApprovals; phApproval.Visible = chkUseApprovals.Checked && UseApprovals; lblNotUsingApprovals.Visible = !chkUseApprovals.Checked || !UseApprovals; lblNotUsingApprovals.Text = Localization.GetString("ApprovalsDisabled", LocalSharedResourceFile); //LoadPhotoGalleryDropDown(av); LoadDisplayTabDropDown(); //load the article attachement settings } else { if (ddlDisplayTabId.Enabled) { av.DisplayTabId = Convert.ToInt32(ddlDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); } av.VersionNumber = txtVersionNumber.Text; av.VersionDescription = txtVersionDescription.Text; av.ArticleText = TeArticleText.Text; } //load the article attachement settings //ctlUrlSelection.Url = } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void Page_Load(object sender, EventArgs e) { try { LocalizeCollapsePanels(); //check VI for null then set information if (!Page.IsPostBack) { LoadAuthorsList(); //set author ddlAuthor.SelectedValue = VersionInfoObject.AuthorUserId > 0 ? VersionInfoObject.AuthorUserId.ToString() : UserId.ToString(); //configure the author name (Text) if defined //chkShowAuthor ItemVersionSetting auNameSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "lblAuthorName", "Text", PortalId); txtAuthorName.Text = auNameSetting != null ? auNameSetting.PropertyValue : ddlAuthor.SelectedItem.Text.Trim(); if (AllowRichTextDescriptions) { if (DefaultRichTextDescriptions) { teDescription.ChooseMode = true; btnChangeDescriptionEditorMode.Visible = false; teDescription.Visible = true; txtDescription.Visible = false; } else { //if their profile is set to basic text mode, we need to show the radio buttons so they can get to rich text mode. teDescription.ChooseMode = (string)Personalization.GetProfile("DotNetNuke.TextEditor", "PreferredTextEditor") == "BASIC"; btnChangeDescriptionEditorMode.Text = Localization.GetString("btnChangeDescriptionEditorMode_" + txtDescription.Visible, LocalResourceFile); } } else { btnChangeDescriptionEditorMode.Visible = false; } if (Utility.HasValue(VersionInfoObject.MetaTitle) || Utility.HasValue(VersionInfoObject.MetaDescription) || Utility.HasValue(VersionInfoObject.MetaKeywords)) { //chkSearchEngine.Checked = true; //pnlSearchEngine.Visible = true; } txtDescription.Text = VersionInfoObject.Description; teDescription.Text = VersionInfoObject.Description; txtMetaKeywords.Text = VersionInfoObject.MetaKeywords; txtMetaDescription.Text = VersionInfoObject.MetaDescription; txtMetaTitle.Text = VersionInfoObject.MetaTitle; if (EnableDisplayNameAsHyperlink) { chkDisplayAsHyperlink.Checked = !VersionInfoObject.Disabled; } else { lblDisplayAsHyperlink.Visible = false; chkDisplayAsHyperlink.Visible = false; chkDisplayAsHyperlink.Checked = true; } if (Utility.HasValue(VersionInfoObject.StartDate)) { txtStartDate.Text = Utility.GetCurrentCultureDateTime(VersionInfoObject.StartDate); } if (Utility.HasValue(VersionInfoObject.EndDate)) { txtEndDate.Text = Utility.GetCurrentCultureDateTime(VersionInfoObject.EndDate); } txtName.Text = VersionInfoObject.Name; thumbnailSelector.ThumbnailUrl = VersionInfoObject.Thumbnail; } else { VersionInfoObject.Name = txtName.Text; VersionInfoObject.Description = DescriptionText; VersionInfoObject.Thumbnail = thumbnailSelector.ThumbnailUrl;//ctlMediaFile.Url; //define author's name to display _authorName = txtAuthorName.Text.Trim(); VersionInfoObject.MetaKeywords = txtMetaKeywords.Text; VersionInfoObject.MetaDescription = txtMetaDescription.Text; VersionInfoObject.MetaTitle = txtMetaTitle.Text; VersionInfoObject.Disabled = !chkDisplayAsHyperlink.Checked; VersionInfoObject.Url = ctlUrlSelection.Url; VersionInfoObject.NewWindow = chkNewWindow.Checked; DateTime dt; if (Utility.HasValue(txtStartDate.Text) && DateTime.TryParse(txtStartDate.Text, out dt)) { if (!dt.Equals(DateTime.MinValue)) { VersionInfoObject.StartDate = dt.ToString(CultureInfo.InvariantCulture); } } if (Utility.HasValue(txtEndDate.Text) && DateTime.TryParse(txtEndDate.Text, out dt)) { if (!dt.Equals(DateTime.MinValue)) { VersionInfoObject.EndDate = dt.ToString(CultureInfo.InvariantCulture); } } else { VersionInfoObject.EndDate = ""; } VersionInfoObject.AuthorUserId = Convert.ToInt32(ddlAuthor.SelectedValue); VersionInfoObject.RevisingUserId = UserId; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void Page_Load(object sender, EventArgs e) { //store the "view" for this item RecordView(); //SetPageTitle(); _categoryId = ItemId; _customDisplaySettings = new CustomDisplaySettings(Settings, TabModuleId); UsePaging = _customDisplaySettings.AllowPaging; UseCustomSort = _customDisplaySettings.UseCustomSort; if (_customDisplaySettings.GetParentFromQueryString) { //CHECK IF THERE'S ANYTHING IN THE QS AND REACT object o = Request.QueryString["ItemId"]; if (o != null) { int itemId; if (int.TryParse(o.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out itemId)) { //we need to load the children, rather than siblings if _customDisplaySettings.GetRelatedChildren is enabled and the itemid is for a category, not an article if (_customDisplaySettings.GetRelatedChildren && Item.GetItemType(itemId) == ItemType.Category.Name) { _categoryId = itemId; } //otherwise we're going to get the parent category for the itemid passed in. else { _categoryId = Category.GetParentCategory(itemId, PortalId); } } } } if (_customDisplaySettings.EnableRss) { //TODO: replace the hyperlink control on the display side and insert our Link/IMAGE dynamically so we can set the alt text. lnkRss.Visible = true; string rssImage = Localization.GetString("rssImage", LocalResourceFile); #if DEBUG rssImage = rssImage.Replace("[L]", string.Empty); #endif imgRss.Src = ApplicationUrl + rssImage; //"/images/xml.gif"; imgRss.Alt = Localization.GetString("rssAlt", LocalResourceFile); lnkRss.Attributes.Add("type", "application/rss+xml"); lnkRss.ToolTip = Localization.GetString("rssAlt", LocalResourceFile); if (AllowTags && _tagQuery != null && _tagQuery.Count > 0) { lnkRss.NavigateUrl = GetRssLinkUrl(PortalId, "TagFeed", _qsTags); SetRssUrl(lnkRss.NavigateUrl, Localization.GetString("rssAlt", LocalResourceFile)); } else { //check for a setting of an external URL ItemVersionSetting rssSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "CategorySettings", "RssUrl", PortalId); if (rssSetting != null && rssSetting.PropertyValue != string.Empty) { lnkRss.NavigateUrl = rssSetting.PropertyValue; SetExternalRssUrl(lnkRss.NavigateUrl, Localization.GetString("rssAlt", LocalResourceFile)); } else { //TODO: configure the # of items for an RSS feed lnkRss.NavigateUrl = GetRssLinkUrl(_categoryId, 25, ItemType.Article.GetId(), PortalId, "ItemListing"); SetRssUrl(lnkRss.NavigateUrl, Localization.GetString("rssAlt", LocalResourceFile)); } } } //store the URL into session for the return to list options if (UseSessionForReturnToList(PortalId)) { Session["PublishListLink"] = Request.Url.PathAndQuery; } //check if admin, enable edit links if ((IsAdmin || IsAuthor) && IsEditable) { Visibility = true; EditText = Localization.GetString("EditText", LocalResourceFile); } else { Visibility = false; EditText = string.Empty; } try { if (_customDisplaySettings.ItemTypeId == -2) { lblMessage.Text = Localization.GetString("SetupItemType", LocalResourceFile); return; } lstItems.DataSource = GetData(); lstItems.DataBind(); if ((_customDisplaySettings.ShowParent || _customDisplaySettings.ShowParentDescription) && _categoryId != -1) { Category parentCategory = Category.GetCategory(_categoryId, PortalId); if (_customDisplaySettings.ShowParent) { divParentCategoryName.Visible = true; lblCategory.Text = parentCategory.Name; } //show the category description if enabled. if (_customDisplaySettings.ShowParentDescription) { divParentCategoryDescription.Visible = true; lblCategoryDescription.Text = Utility.ReplaceTokens(parentCategory.Description); } } else { lblCategory.Visible = false; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void Page_Load(object sender, EventArgs e) { try { this.LocalizeCollapsePanels(); // because we're in the Edit options turn off caching ClientAPI.AddButtonConfirm(this.cmdDelete, Localization.GetString("DeleteConfirm", this.LocalResourceFile)); var cv = (Category)this.VersionInfoObject; if (!this.Page.IsPostBack) { this.rblDisplayOnCurrentPage.Items.Add( new ListItem(Localization.GetString("CurrentPage", this.LocalResourceFile), true.ToString(CultureInfo.InvariantCulture))); this.rblDisplayOnCurrentPage.Items.Add( new ListItem(Localization.GetString("SpecificPage", this.LocalResourceFile), false.ToString(CultureInfo.InvariantCulture))); this.txtSortOrder.Text = cv.SortOrder.ToString(CultureInfo.CurrentCulture); this.txtCategoryId.Text = cv.ItemId.ToString(CultureInfo.CurrentCulture); this.cmdDelete.Visible = false; // check if new or edit if (this.VersionInfoObject.IsNew) { this.txtCategoryId.Visible = false; this.lblCategoryId.Visible = false; if (this.ParentId != -1) { Category parent = Category.GetCategory(this.ParentId, this.PortalId); this.parentCategoryRelationships.AddToSelectedItems(parent); } } this.trCategoryId.Visible = this.ShowItemIds; // check if the DisplayTabId should be set. // chkDisplayOnCurrentPage ItemVersionSetting cpSetting = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "CategorySettings", "DisplayOnCurrentPage", this.PortalId); if (cpSetting != null) { this.rblDisplayOnCurrentPage.SelectedValue = this.VersionInfoObject.DisplayOnCurrentPage().ToString(CultureInfo.InvariantCulture); if (this.VersionInfoObject.DisplayOnCurrentPage()) { this.chkForceDisplayTab.Checked = false; this.chkForceDisplayTab.Visible = false; this.lblForceDisplayTab.Visible = false; this.ddlDisplayTabId.Enabled = false; } else { this.chkForceDisplayTab.Visible = true; this.lblForceDisplayTab.Visible = true; this.ddlDisplayTabId.Enabled = true; } } else if (this.VersionInfoObject.DisplayTabId < 0) { this.rblDisplayOnCurrentPage.SelectedValue = false.ToString(CultureInfo.InvariantCulture); this.chkForceDisplayTab.Checked = false; this.chkForceDisplayTab.Visible = true; this.lblForceDisplayTab.Visible = true; this.ddlDisplayTabId.Enabled = true; } else { this.rblDisplayOnCurrentPage.SelectedValue = false.ToString(CultureInfo.InvariantCulture); this.chkForceDisplayTab.Visible = true; this.lblForceDisplayTab.Visible = true; this.ddlDisplayTabId.Enabled = true; } this.chkForceDisplayTab.Checked = this.VersionInfoObject.ForceDisplayOnPage(); this.LoadCommentForumsDropDown(); this.LoadCategoryDisplayTabDropDown(); this.LoadChildDisplayTabDropDown(); ItemVersionSetting useApprovals = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "chkUseApprovals", "Checked", this.PortalId); this.chkUseApprovals.Checked = useApprovals == null || Convert.ToBoolean(useApprovals.PropertyValue, CultureInfo.InvariantCulture); this.chkUseApprovals.Visible = this.IsAdmin && this.UseApprovals; this.phApproval.Visible = this.UseApprovals && this.chkUseApprovals.Checked; this.lblNotUsingApprovals.Visible = !this.UseApprovals || !this.chkUseApprovals.Checked; // itemversionsetting for external RSS feed // provide the ability to define an external RSS feed for a category. ItemVersionSetting rssSetting = ItemVersionSetting.GetItemVersionSetting( this.VersionInfoObject.ItemVersionId, "CategorySettings", "RssUrl", this.PortalId); if (rssSetting != null) { this.txtRssUrl.Text = rssSetting.PropertyValue; } } else { cv.SortOrder = Convert.ToInt32(this.txtSortOrder.Text, CultureInfo.InvariantCulture); this.VersionInfoObject.DisplayTabId = Convert.ToInt32(this.ddlDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); cv.ChildDisplayTabId = Convert.ToInt32(this.ddlChildDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }