private void Save_Page_7_Postback(NameValueCollection Form)
        {
            string action = Form["admin_aggr_action"];
            if (!String.IsNullOrEmpty(action))
            {
                if ((action.IndexOf("delete_") == 0) && ( action.Length > 7 ))
                {
                    string code_to_delete = action.Substring(7);
                    itemAggregation.Remove_Child_Page(code_to_delete);

                    // Save to the admins session
                    HttpContext.Current.Session["Edit_Aggregation_" + itemAggregation.Code] = itemAggregation;
                }

                if (action == "save_childpage")
                {
                    childPageCode = Form["admin_aggr_code"];
                    childPageLabel = Form["admin_aggr_label"];
                    childPageVisibility = Form["admin_aggr_visibility"];
                    childPageParent = Form["admin_aggr_parent"];

                    // Convert to the integer id for the parent and begin to do checking
                    List<string> errors = new List<string>();

                    // Validate the code
                    if (childPageCode.Length > 20)
                    {
                        errors.Add("New child page code must be twenty characters long or less");
                    }
                    else if (childPageCode.Length == 0)
                    {
                        errors.Add("You must enter a CODE for this child page");

                    }
                    else if (SobekCM_Library_Settings.Reserved_Keywords.Contains(childPageCode.ToLower()))
                    {
                        errors.Add("That code is a system-reserved keyword.  Try a different code.");
                    }
                    else if (itemAggregation.Child_Page_By_Code(childPageCode.ToUpper()) != null)
                    {
                        errors.Add("New code must be unique... <i>" + childPageCode + "</i> already exists");
                    }

                    if (childPageLabel.Trim().Length == 0)
                        errors.Add("You must enter a LABEL for this child page");
                    if (childPageVisibility.Trim().Length == 0)
                        errors.Add("You must select a VISIBILITY for this child page");

                    if (errors.Count > 0)
                    {
                        // Create the error message
                        actionMessage = "ERROR: Invalid entry for new item child page<br />";
                        foreach (string error in errors)
                            actionMessage = actionMessage + "<br />" + error;
                    }
                    else
                    {
                        Item_Aggregation_Child_Page newPage = new Item_Aggregation_Child_Page {Code = childPageCode, Parent_Code = childPageParent, Source = Item_Aggregation_Child_Page.Source_Type.Static_HTML };
                        newPage.Add_Label(childPageLabel, SobekCM_Library_Settings.Default_UI_Language);
                        switch (childPageVisibility)
                        {
                            case "none":
                                newPage.Browse_Type = Item_Aggregation_Child_Page.Visibility_Type.NONE;
                                break;

                            case "browse":
                                newPage.Browse_Type = Item_Aggregation_Child_Page.Visibility_Type.MAIN_MENU;
                                break;

                            case "browseby":
                                newPage.Browse_Type = Item_Aggregation_Child_Page.Visibility_Type.METADATA_BROWSE_BY;
                                break;
                        }
                        string html_source_dir = aggregationDirectory + "\\html\\browse";
                        if (!Directory.Exists(html_source_dir))
                            Directory.CreateDirectory(html_source_dir);
                        string html_source_file = html_source_dir + "\\" + childPageCode + "_" + Web_Language_Enum_Converter.Enum_To_Code(SobekCM_Library_Settings.Default_UI_Language) + ".html";
                        if (!File.Exists(html_source_file))
                        {
                            HTML_Based_Content htmlContent = new HTML_Based_Content();
                            htmlContent.Static_Text = "<br /><br />This is a new browse page.<br /><br />" + childPageLabel + "<br /><br />The code for this browse is: " + childPageCode;
                            htmlContent.Author = user.Full_Name;
                            htmlContent.Date = DateTime.Now.ToLongDateString();
                            htmlContent.Title = childPageLabel;
                            htmlContent.Save_To_File(html_source_file);
                        }
                        newPage.Add_Static_HTML_Source("html\\browse\\" + childPageCode + "_" + Web_Language_Enum_Converter.Enum_To_Code(SobekCM_Library_Settings.Default_UI_Language) + ".html", SobekCM_Library_Settings.Default_UI_Language);

                        itemAggregation.Add_Child_Page(newPage);

                        // Save to the admins session
                        HttpContext.Current.Session["Edit_Aggregation_" + itemAggregation.Code] = itemAggregation;

                    }
                }
            }
        }
        /// <summary> Constructor for a new instance of the Static_Browse_Info_AggregationViewer class </summary>
        /// <param name="Browse_Object"> Browse or information object to be displayed </param>
        /// <param name="Static_Web_Content"> HTML content-based browse, info, or imple CMS-style web content objects.  These are objects which are read from a static HTML file and much of the head information must be maintained </param>
        /// <param name="Current_Collection"> Current collection being displayed</param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_User"> Current user/session information </param>
        public Static_Browse_Info_AggregationViewer(Item_Aggregation_Child_Page Browse_Object, HTML_Based_Content Static_Web_Content, Item_Aggregation Current_Collection, SobekCM_Navigation_Object Current_Mode, User_Object Current_User )
            : base(Current_Collection, Current_Mode)
        {
            browseObject = Browse_Object;
            staticWebContent = Static_Web_Content;
            currentUser = Current_User;

            bool isAdmin = (currentUser != null) && (currentUser.Is_Aggregation_Admin(currentCollection.Code));
            if (( currentMode.Aggregation_Type == Aggregation_Type_Enum.Child_Page_Edit) && ( !isAdmin))
                currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;

            NameValueCollection form = HttpContext.Current.Request.Form;
            if ((currentMode.Aggregation_Type == Aggregation_Type_Enum.Child_Page_Edit) && (form["sbkSbia_ChildTextEdit"] != null) && ( currentUser != null ))
            {
                string aggregation_folder = SobekCM_Library_Settings.Base_Design_Location + "aggregations\\" + currentCollection.Code + "\\";
                string file = aggregation_folder + browseObject.Get_Static_HTML_Source(currentMode.Language);

                // Get the header information as well
                if ( !String.IsNullOrEmpty(form["admin_childpage_title"]))
                {
                    staticWebContent.Title = form["admin_childpage_title"];
                }
                if (form["admin_childpage_author"] != null)
                    staticWebContent.Author = form["admin_childpage_author"];
                if (form["admin_childpage_date"] != null)
                    staticWebContent.Date = form["admin_childpage_date"];
                if (form["admin_childpage_description"] != null)
                    staticWebContent.Description = form["admin_childpage_description"];
                if (form["admin_childpage_keywords"] != null)
                    staticWebContent.Keywords = form["admin_childpage_keywords"];
                if (form["admin_childpage_extrahead"] != null)
                    staticWebContent.Extra_Head_Info = form["admin_childpage_extrahead"];

                // Make a backup from today, if none made yet
                if (File.Exists(file))
                {
                    DateTime lastWrite = (new FileInfo(file)).LastWriteTime;
                    string new_file = file.ToLower().Replace(".txt", "").Replace(".html", "").Replace(".htm", "") + lastWrite.Year + lastWrite.Month.ToString().PadLeft(2, '0') + lastWrite.Day.ToString() .PadLeft(2, '0')+ ".bak";
                    if (File.Exists(new_file))
                        File.Delete(new_file);
                    File.Move(file, new_file);
                }

                // Assign the new text
                Static_Web_Content.Static_Text = form["sbkSbia_ChildTextEdit"];
                Static_Web_Content.Date = DateTime.Now.ToLongDateString();
                Static_Web_Content.Save_To_File(file);

                // Also save this change
                SobekCM_Database.Save_Item_Aggregation_Milestone(currentCollection.Code, "Child page '" + browseObject.Code + "' edited (" + Web_Language_Enum_Converter.Enum_To_Name(currentMode.Language) + ")", currentUser.Full_Name);

                // Forward along
                currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_Info;
                if ( Browse_Object.Browse_Type == Item_Aggregation_Child_Page.Visibility_Type.METADATA_BROWSE_BY )
                    currentMode.Aggregation_Type = Aggregation_Type_Enum.Browse_By;

                string redirect_url = currentMode.Redirect_URL();
                if (redirect_url.IndexOf("?") > 0)
                    redirect_url = redirect_url + "&refresh=always";
                else
                    redirect_url = redirect_url + "?refresh=always";
                currentMode.Request_Completed = true;
                HttpContext.Current.Response.Redirect(redirect_url, false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
        }
        private void Save_Child_Page_Postback(NameValueCollection Form)
        {
            string code = currentMode.My_Sobek_SubMode.Substring(2);
            Item_Aggregation_Child_Page childPage = itemAggregation.Child_Page_By_Code(code);

            // Check for action flag
            string action = Form["admin_aggr_action"];
            if (action == "add_version")
            {
                try
                {
                    string language = Form["admin_aggr_new_version_lang"];
                    string title = Form["admin_aggr_new_version_label"];
                    string copyFrom = Form["admin_aggr_new_version_copy"];

                    string file = "html\\browse\\" + childPage.Code + "_" + language + ".html";
                    string fileDir = aggregationDirectory + "\\" + file;
                    Web_Language_Enum languageEnum = Web_Language_Enum_Converter.Code_To_Enum(language);

                    // Create the source file FIRST
                    string copyFromFull = aggregationDirectory + "\\" + copyFrom;
                    if ((copyFrom.Length > 0) && (File.Exists(copyFromFull)))
                    {
                        File.Copy(copyFromFull, fileDir, true );
                    }
                    else if ( !File.Exists(fileDir))
                    {
                        HTML_Based_Content htmlContent = new HTML_Based_Content();
                        htmlContent.Static_Text = "<br /><br />This is a new " + Web_Language_Enum_Converter.Enum_To_Name(languageEnum) + " browse page.<br /><br />" + title + "<br /><br />The code for this browse is: " + childPage.Code;
                        htmlContent.Author = user.Full_Name;
                        htmlContent.Date = DateTime.Now.ToLongDateString();
                        htmlContent.Title = title;
                        htmlContent.Save_To_File(fileDir);
                    }

                    // Add to this child page
                    childPage.Add_Label(title, languageEnum);
                    childPage.Add_Static_HTML_Source(file, languageEnum);

                }
                catch
                {
                    actionMessage = "Error adding new version to this child page";
                }

            }
            else if ((action.IndexOf("delete_") == 0) && ( action.Length > 7 ))
            {
                string delete_code = action.Substring(7);
                childPage.Remove_Language(Web_Language_Enum_Converter.Code_To_Enum(delete_code));

            }
        }