protected void uxCreateButton_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } Webpage.WebpageCreateStatus status = uxIsAlias.Checked ? createInternalAlias() : createAbsoluteLink(); switch (status) { case Webpage.WebpageCreateStatus.DuplicateName: Msg.ShowError(string.Format("Failed to save link. Path name '{0}' already exists.", uxTitle.Text)); break; case Webpage.WebpageCreateStatus.IllegalName: Msg.ShowError(string.Format("Failed to save link. Path name '{0}' is not allowed.", uxTitle.Text)); break; case Webpage.WebpageCreateStatus.Success: break; case Webpage.WebpageCreateStatus.None: default: Msg.ShowError("Error."); break; } }
protected void UpdateButton_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } //prevent malicious edits if (_instanceId == Webpage.RootNavigationId) { throw new InvalidOperationException("The portal root may not be edited through this form."); } if (_link.ParentInstanceId == Webpage.RootNavigationId) { throw new InvalidOperationException("Root pages (website roots) may not be edited through this form."); } _link.InstanceId = _instanceId; _link.Text = TextText.Text; //'Title' has no meaning for an external link, so just make it the same as the navigation text. _link.Title = _link.Text; _link.PathName = PathNameEditCtl.PathName;//sanitized internally by WebModules. _link.ExternalUrl = TargetUrlText.Text; _link.Visible = DisplayLinkInNavCheckBox.Checked; if (!_link.Visible) { //reset sort order so that invisible links may sort alphabetically. _link.SortOrder = 1; } Webpage.WebpageCreateStatus status = Webpage.UpdateWebpage(_link); switch (status) { case Webpage.WebpageCreateStatus.DuplicateName: Msg.ShowError(string.Format("Failed to save link settings. Path name '{0}' already exists.", PathNameEditCtl.PathName)); break; case Webpage.WebpageCreateStatus.IllegalName: Msg.ShowError(string.Format("Failed to save link settings. Path name '{0}' is not allowed.", PathNameEditCtl.PathName)); break; case Webpage.WebpageCreateStatus.Success: Response.Redirect(_urlReferrer); break; case Webpage.WebpageCreateStatus.None: default: Msg.ShowError("Error."); break; } }
protected void UpdatePageSettings_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } if (_instanceId == Webpage.RootNavigationId) { throw new InvalidOperationException("The portal root may not be edited through this form."); } int?newParentId = null; if (ParentPage_div.Visible) { newParentId = ParentPage.SelectedNavigationId; } /*else if (_instanceId == Webpage.RootNavigationId) * { //the portal root must always have a null parent. * newParentId = null; * } */ else { //if the parent page picker is hidden, then we determined during //Page_Load that the current page is a website root page; //website root pages must always be children of the portal root. newParentId = Webpage.RootNavigationId; } bool bSitemapXmlIncludePage; bool bSitemapXmlIncludeLastMod; DateTime?dtSitemapXmlLastmod; bool bSitemapXmlIncludeChangeFreg; string strSitemapXmlChangeFreq; bool bSitemapXmlIncludePriority; decimal dSitemapXmlPriority; sitemapXmlEdit.GetSettings( out bSitemapXmlIncludePage, out bSitemapXmlIncludeLastMod, out dtSitemapXmlLastmod, out bSitemapXmlIncludeChangeFreg, out strSitemapXmlChangeFreq, out bSitemapXmlIncludePriority, out dSitemapXmlPriority); /* * * bool bSitemapXmlIncludePage = checkSitemapXmlIncludePage.Checked; * bool bSitemapXmlIncludeLastMod = false; * DateTime? dtSitemapXmlLastmod = null; * bool bSitemapXmlIncludeChangeFreg = true; * string strSitemapXmlChangeFreq = null; * bool bSitemapXmlIncludePriority = true; * decimal dSitemapXmlPriority = 0.5M; * * if (bSitemapXmlIncludePage) * { * bSitemapXmlIncludeLastMod = checkSitemapXmlIncludeLastMod.Checked; * if (bSitemapXmlIncludeLastMod) * { * string strXmlSitemapLastmod = txtSitemapXmlLastMod.Text.Trim(); * if (!string.IsNullOrEmpty(strXmlSitemapLastmod)) * { * DateTime dt; * if (DateTime.TryParse(strXmlSitemapLastmod, out dt)) * { * dtSitemapXmlLastmod = dt; * } * } * } * * bSitemapXmlIncludeChangeFreg = checkSitemapXmlIncludeChangeFreq.Checked; * if (bSitemapXmlIncludeChangeFreg) * { * strSitemapXmlChangeFreq = ddlChangeFreq.SelectedValue; * } * * bSitemapXmlIncludePriority = checkSitemapXmlIncludePriority.Checked; * if (bSitemapXmlIncludePriority) * { * decimal dOnes = decimal.Parse(ddlSitemapXmlPriorityOnes.SelectedValue); * decimal dTenths = decimal.Parse(ddlSitemapXmlPriorityTenths.SelectedValue) / 10M; * dSitemapXmlPriority = dOnes + dTenths; * } * } */ Webpage.WebpageCreateStatus status = Webpage.UpdateWebpageSettings(_instanceId, newParentId, TitleTextBox.Text, NavigationTextTextBox.Text, PathNameEditCtl.PathName, MetaDescriptionTextbox.Text, MetaKeywordsTextbox.Text, MetaDescriptionTextbox.Text, VisibleCheckBox.Checked, bSitemapXmlIncludePage, bSitemapXmlIncludeLastMod, dtSitemapXmlLastmod, bSitemapXmlIncludeChangeFreg, strSitemapXmlChangeFreq, bSitemapXmlIncludePriority, dSitemapXmlPriority, this.TemplatePropertiesDisplay.result ); //xx switch (status) { case Webpage.WebpageCreateStatus.DuplicateName: Msg.ShowError(string.Format("Failed to save page settings. Path name '{0}' already exists.", PathNameEditCtl.PathName)); break; case Webpage.WebpageCreateStatus.IllegalName: Msg.ShowError(string.Format("Failed to save page settings. Path name '{0}' is not allowed.", PathNameEditCtl.PathName)); break; case Webpage.WebpageCreateStatus.Success: SaveTemplateAndTheme(); Response.Redirect("Default.aspx?InstanceId=" + _instanceId); break; case Webpage.WebpageCreateStatus.None: default: Msg.ShowError("Error."); break; } }