Example #1
0
        /// <summary>
        /// The OnUpdate on this page is used to save
        ///   the current tab settings to the database and
        ///   then redirect back to the main admin page.
        /// </summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected override void OnUpdate(EventArgs e)
        {
            // Only Update if Input Data is Valid
            if (this.Page.IsValid)
            {
                try
                {
                    this.SavePageData();
                    //remove from cache
                    SqlUrlBuilderProvider.ClearCachePageUrl(this.PageID);
                    UrlBuilderHelper.ClearUrlElements(this.PageID);

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    CurrentCache.RemoveAll("_PageNavigationSettings_");
                    PortalSettings.RemovePortalSettingsCache(PageID, PortalSettings.PortalAlias);

                    // Clear AppleseedSiteMapCache
                    AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();

                    PortalSettings.UpdatePortalSettingParentPageCache(Int32.Parse(this.parentPage.SelectedItem.Value), this.PageID);

                    // redirect back to the admin page
                    // int adminIndex = portalSettings.DesktopPages.Count-1;
                    // 3_aug_2004 Cory Isakson use returntabid from QueryString
                    // Updated 6_Aug_2004 by Cory Isakson to accomodate addtional Page Management
                    var    retPage = this.Request.QueryString["returnPageID"];
                    string returnPage;

                    if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                    {
                        if (retPage != null)
                        {
                            // user is returned to the calling tab.
                            returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                        }
                        else
                        {
                            // user is returned to updated tab
                            returnPage = HttpUrlBuilder.BuildUrl(this.PageID);
                        }

                        Response.Write("<script type=\"text/javascript\">window.parent.location = '" + returnPage + "';</script>");
                    }

                    else
                    {
                        if (retPage != null)
                        {
                            // user is returned to the calling tab.
                            returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                        }
                        else
                        {
                            // user is returned to updated tab
                            returnPage = HttpUrlBuilder.BuildUrl(this.PageID);
                        }

                        this.Response.Redirect(returnPage);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message == "FriendlyUrlIsAlreadyExists")
                    {
                        this.lblUrlAlreadyExist.Visible = true;
                    }
                    else
                    {
                        this.lblErrorNotAllowed.Visible = true;
                    }
                }
            }
        }