/// <summary> /// Check's to see if the item being loaded in this module should be displayed on this tabid/moduleid, if not does a 301 redirect to the proper page. /// </summary> private void CheckItemUrl() { if (VersionInfoObject != null) { //check to see if this Item should be redirected to a different URL if (Utility.HasValue(VersionInfoObject.Url) && (VersionInfoObject.Url != Request.Url.ToString())) { //do our redirect now Response.Status = "301 Moved Permanently"; Response.RedirectLocation = VersionInfoObject.GetItemExternalUrl; } //check if we're on the correct URL before progressing if (VersionInfoObject.ForceDisplayOnPage() && (TabId != VersionInfoObject.DisplayTabId) && !IsAdmin) { Response.Status = "301 Moved Permanently"; Response.RedirectLocation = GetItemLinkUrl(VersionInfoObject.ItemId); } else if (VersionInfoObject.ForceDisplayOnPage() && (TabId != VersionInfoObject.DisplayTabId) && IsAdmin) { lblPublishMessages.Text = Localization.GetString("PublishForceAdminMessage", LocalSharedResourceFile); divPublishNotifications.Visible = true; } } }
private void Page_Load(object sender, EventArgs e) { try { LocalizeCollapsePanels(); //because we're in the Edit options turn off caching DotNetNuke.UI.Utilities.ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteConfirm", LocalResourceFile)); var cv = (Category)VersionInfoObject; if (!Page.IsPostBack) { 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))); txtSortOrder.Text = cv.SortOrder.ToString(CultureInfo.CurrentCulture); txtCategoryId.Text = cv.ItemId.ToString(CultureInfo.CurrentCulture); cmdDelete.Visible = false; //check if new or edit if (VersionInfoObject.IsNew) { txtCategoryId.Visible = false; lblCategoryId.Visible = false; if (ParentId != -1) { Category parent = Category.GetCategory(ParentId, PortalId); parentCategoryRelationships.AddToSelectedItems(parent); } } trCategoryId.Visible = ShowItemIds; //check if the DisplayTabId should be set. //chkDisplayOnCurrentPage ItemVersionSetting cpSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "CategorySettings", "DisplayOnCurrentPage", PortalId); if (cpSetting != null) { rblDisplayOnCurrentPage.SelectedValue = VersionInfoObject.DisplayOnCurrentPage().ToString(CultureInfo.InvariantCulture); if (VersionInfoObject.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 (VersionInfoObject.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 = VersionInfoObject.ForceDisplayOnPage(); LoadCommentForumsDropDown(); LoadCategoryDisplayTabDropDown(); LoadChildDisplayTabDropDown(); ItemVersionSetting useApprovals = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "chkUseApprovals", "Checked", PortalId); chkUseApprovals.Checked = useApprovals == null || Convert.ToBoolean(useApprovals.PropertyValue, CultureInfo.InvariantCulture); chkUseApprovals.Visible = IsAdmin && UseApprovals; phApproval.Visible = UseApprovals && chkUseApprovals.Checked; lblNotUsingApprovals.Visible = !UseApprovals || !chkUseApprovals.Checked; //itemversionsetting for external RSS feed //provide the ability to define an external RSS feed for a category. ItemVersionSetting rssSetting = ItemVersionSetting.GetItemVersionSetting(VersionInfoObject.ItemVersionId, "CategorySettings", "RssUrl", PortalId); if (rssSetting != null) { txtRssUrl.Text = rssSetting.PropertyValue; } } else { cv.SortOrder = Convert.ToInt32(txtSortOrder.Text, CultureInfo.InvariantCulture); VersionInfoObject.DisplayTabId = Convert.ToInt32(ddlDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); cv.ChildDisplayTabId = Convert.ToInt32(ddlChildDisplayTabId.SelectedValue, CultureInfo.InvariantCulture); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }