예제 #1
0
        /// <summary> Stores the list of items for a single bibid to the cache  </summary>
        /// <param name="BibID"> Bibliographic identifier for the list of items </param>
        /// <param name="StoreObject"> List of items within the single title </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        public void Store_Items_In_Title(string BibID, SobekCM_Items_In_Title StoreObject, Custom_Tracer Tracer)
        {
            // If the cache is disabled, just return before even tracing
            if (settings.Disabled)
            {
                return;
            }

            if (Tracer != null)
            {
                Tracer.Add_Trace("CachedDataManager_ItemServices.Store_Items_In_Title", "");
            }

            // Store this on the local cache, if not there and storing on the cache server failed
            string key = "ITEMLIST_" + BibID.ToUpper();

            if (HttpContext.Current.Cache[key] == null)
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("CachedDataManager_ItemServices.Store_Items_In_Title", "Adding object '" + key + "' to the local cache with expiration of 1 minutes");
                }

                HttpContext.Current.Cache.Insert(key, StoreObject, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(1));
            }
        }
 void iconPanel_Double_Clicked(DataRow thisRow)
 {
     if (thisRow != null)
     {
         string bibid = thisRow["BibID"].ToString();
         SobekCM_Items_In_Title multiple = SobekCM_Database.Get_Multiple_Volumes(bibid, null);
         if (multiple == null)
         {
             MessageBox.Show("Either the BibID you entered is invalid, or there was a database error.");
         }
         else
         {
             Hide();
             Edit_Serial_Hierarchy_Form edit = new Edit_Serial_Hierarchy_Form(bibid, multiple);
             edit.ShowDialog();
             refresh();
             Show();
             mainPanel.Width = mainPanel.Width - 1;
             mainPanel.Width = mainPanel.Width + 1;
         }
     }
 }
        /// <summary> Constructor for a new instance of the MySobek_HtmlSubwriter class </summary>
        /// <param name="Results_Statistics"> Information about the entire set of results for a browse of a user's bookshelf folder </param>
        /// <param name="Paged_Results"> Single page of results for a browse of a user's bookshelf folder, within the entire set </param>
        /// <param name="Code_Manager"> List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param>
        /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param>
        /// <param name="Hierarchy_Object"> Current item aggregation object to display </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="Current_Item">Current item to edit, if the user is requesting to edit an item</param>
        /// <param name="Aggregation_Aliases"> List of all existing aliases for existing aggregations </param>
        /// <param name="Web_Skin_Collection"> Collection of all the web skins </param>
        /// <param name="Current_User"> Currently logged on user </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="IP_Restrictions"> List of all IP Restriction ranges in use by this digital library </param>
        /// <param name="URL_Portals"> List of all web portals into this system </param>
        /// <param name="Stats_Date_Range"> Object contains the start and end dates for the statistical data in the database </param>
        /// <param name="Thematic_Headings"> Headings under which all the highlighted collections on the home page are organized </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public MySobek_HtmlSubwriter(Search_Results_Statistics Results_Statistics,
                                     List <iSearch_Title_Result> Paged_Results,
                                     Aggregation_Code_Manager Code_Manager,
                                     Item_Lookup_Object All_Items_Lookup,
                                     Item_Aggregation Hierarchy_Object,
                                     SobekCM_Skin_Object HTML_Skin,
                                     Language_Support_Info Translator,
                                     SobekCM_Navigation_Object Current_Mode,
                                     SobekCM_Item Current_Item,
                                     Dictionary <string, string> Aggregation_Aliases,
                                     SobekCM_Skin_Collection Web_Skin_Collection,
                                     User_Object Current_User,
                                     IP_Restriction_Ranges IP_Restrictions,
                                     Dictionary <string, Wordmark_Icon> Icon_Table,
                                     Portal_List URL_Portals,
                                     Statistics_Dates Stats_Date_Range,
                                     List <Thematic_Heading> Thematic_Headings,
                                     Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Saving values and geting user object back from the session");

            resultsStatistics = Results_Statistics;
            pagedResults      = Paged_Results;
            codeManager       = Code_Manager;
            itemList          = All_Items_Lookup;
            htmlSkin          = HTML_Skin;
            translator        = Translator;
            currentCollection = Hierarchy_Object;
            currentItem       = Current_Item;
            user           = Current_User;
            ipRestrictions = IP_Restrictions;
            iconTable      = Icon_Table;
            statsDates     = Stats_Date_Range;


            if (Current_Mode.My_Sobek_Type == My_Sobek_Type_Enum.Log_Out)
            {
                Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Performing logout");

                HttpContext.Current.Session["user"] = null;
                HttpContext.Current.Response.Redirect("?");
            }

            if ((Current_Mode.My_Sobek_Type != My_Sobek_Type_Enum.Logon) && (user != null) && (user.Is_Temporary_Password))
            {
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.New_Password;
            }

            if (Current_Mode.Logon_Required)
            {
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Logon;
            }

            Tracer.Add_Trace("MySobek_HtmlSubwriter.Constructor", "Building the my sobek viewer object");
            switch (Current_Mode.My_Sobek_Type)
            {
            case My_Sobek_Type_Enum.Home:
                mySobekViewer = new Home_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.New_Item:
                mySobekViewer = new New_Group_And_Item_MySobekViewer(user, Current_Mode, itemList, codeManager, iconTable, htmlSkin, translator, Tracer);
                break;

            case My_Sobek_Type_Enum.Folder_Management:
                mySobekViewer = new Folder_Mgmt_MySobekViewer(user, resultsStatistics, pagedResults, codeManager, itemList, currentCollection, htmlSkin, translator, Current_Mode, Tracer);
                break;

            case My_Sobek_Type_Enum.Saved_Searches:
                mySobekViewer = new Saved_Searches_MySobekViewer(user, translator, Current_Mode, Tracer);
                break;

            case My_Sobek_Type_Enum.Preferences:
                mySobekViewer = new Preferences_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.Logon:
                mySobekViewer = new Logon_MySobekViewer(Current_Mode, Tracer);
                break;

            case My_Sobek_Type_Enum.New_Password:
                mySobekViewer = new NewPassword_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.Delete_Item:
                mySobekViewer = new Delete_Item_MySobekViewer(user, Current_Mode, All_Items_Lookup, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Item_Behaviors:
                mySobekViewer = new Edit_Item_Behaviors_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Item_Metadata:
                mySobekViewer = new Edit_Item_Metadata_MySobekViewer(user, Current_Mode, itemList, currentItem, codeManager, iconTable, htmlSkin, Tracer);
                break;

            case My_Sobek_Type_Enum.File_Management:
                mySobekViewer = new File_Management_MySobekViewer(user, Current_Mode, Current_Item, itemList, codeManager, iconTable, htmlSkin, translator, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Group_Behaviors:
                mySobekViewer = new Edit_Group_Behaviors_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer);
                break;

            case My_Sobek_Type_Enum.Edit_Group_Serial_Hierarchy:
                mySobekViewer = new Edit_Serial_Hierarchy_MySobekViewer(user);
                break;

            case My_Sobek_Type_Enum.Group_Add_Volume:
                // Pull the list of items tied to this group
                SobekCM_Items_In_Title itemsInTitle = Cached_Data_Manager.Retrieve_Items_In_Title(currentItem.BibID, Tracer);
                if (itemsInTitle == null)
                {
                    // Get list of information about this item group and save the item list
                    DataSet itemDetails = SobekCM_Database.Get_Item_Group_Details(currentItem.BibID, Tracer);
                    itemsInTitle = new SobekCM_Items_In_Title(itemDetails.Tables[1]);

                    // Store in cache if retrieved
                    Cached_Data_Manager.Store_Items_In_Title(currentItem.BibID, itemsInTitle, Tracer);
                }
                mySobekViewer = new Group_Add_Volume_MySobekViewer(user, Current_Mode, itemList, currentItem, codeManager, iconTable, htmlSkin, itemsInTitle, translator, Tracer);
                break;

            case My_Sobek_Type_Enum.Group_AutoFill_Volumes:
                mySobekViewer = new Group_AutoFill_Volume_MySobekViewer(user);
                break;

            case My_Sobek_Type_Enum.Group_Mass_Update_Items:
                mySobekViewer = new Mass_Update_Items_MySobekViewer(user, Current_Mode, currentItem, codeManager, Tracer);
                break;

            case My_Sobek_Type_Enum.User_Tags:
                mySobekViewer = new User_Tags_MySobekViewer(user, Tracer);
                break;

            case My_Sobek_Type_Enum.User_Usage_Stats:
                mySobekViewer = new User_Usage_Stats_MySobekViewer(user, Current_Mode, statsDates, Tracer);
                break;
            }

            // Pass in the navigation and translator information
            mySobekViewer.CurrentMode = Current_Mode;
            mySobekViewer.Translator  = translator;
        }
        /// <summary> Constructor for a new instance of the Group_Add_Volume_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        /// <param name="All_Items_Lookup"> Allows individual items to be retrieved by various methods as <see cref="Single_Item"/> objects.</param>
        /// <param name="Current_Item"> Individual digital resource to be edited by the user </param>
        /// <param name="Code_Manager"> Code manager contains the list of all valid aggregation codes </param>
        /// <param name="HTML_Skin"> HTML Web skin which controls the overall appearance of this digital library </param>
        /// <param name="Icon_Table"> Dictionary of all the wordmark/icons which can be tagged to the items </param>
        /// <param name="Items_In_Title"> List of items within this title </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Group_Add_Volume_MySobekViewer(User_Object User,
                                              SobekCM_Navigation_Object Current_Mode,
                                              Item_Lookup_Object All_Items_Lookup,
                                              SobekCM_Item Current_Item, Aggregation_Code_Manager Code_Manager,
                                              Dictionary <string, Wordmark_Icon> Icon_Table,
                                              SobekCM_Skin_Object HTML_Skin,
                                              SobekCM_Items_In_Title Items_In_Title,
                                              Language_Support_Info Translator,
                                              Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Constructor", String.Empty);

            currentMode     = Current_Mode;
            item            = Current_Item;
            itemList        = All_Items_Lookup;
            codeManager     = Code_Manager;
            iconList        = Icon_Table;
            webSkin         = HTML_Skin;
            itemsInTitle    = Items_In_Title;
            base.Translator = Translator;

            // Set some defaults
            ipRestrict              = -1;
            title                   = String.Empty;
            date                    = String.Empty;
            level1                  = String.Empty;
            level2                  = String.Empty;
            level3                  = String.Empty;
            level1Order             = -1;
            level2Order             = -1;
            level3Order             = -1;
            hierarchyCopiedFromDate = false;
            message                 = String.Empty;
            trackingBox             = String.Empty;
            bornDigital             = false;
            materialRecdDate        = null;
            materialRecdNotes       = String.Empty;
            dispositionAdvice       = -1;
            dispositionAdviceNotes  = String.Empty;


            // If the user cannot edit this item, go back
            if (!user.Can_Edit_This_Item(item))
            {
                currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                HttpContext.Current.Response.Redirect(currentMode.Redirect_URL());
            }

            // Determine the default template code
            string template_code = "addvolume";

            if (!user.Include_Tracking_In_Standard_Forms)
            {
                template_code = "addvolume_notracking";
            }

            // Load this template
            template = Cached_Data_Manager.Retrieve_Template(template_code, Tracer);
            if (template != null)
            {
                Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Constructor", "Found template in cache");
            }
            else
            {
                Tracer.Add_Trace("Group_Add_Volume_MySobekViewer.Constructor", "Reading template file");

                // Read this template
                Template_XML_Reader reader = new Template_XML_Reader();
                template = new Template();
                reader.Read_XML(SobekCM_Library_Settings.Base_MySobek_Directory + "templates\\defaults\\" + template_code + ".xml", template, true);

                // Add the current codes to this template
                template.Add_Codes(Code_Manager);

                // Save this into the cache
                Cached_Data_Manager.Store_Template(template_code, template, Tracer);
            }

            // See if there was a hidden request
            string hidden_request = HttpContext.Current.Request.Form["action"] ?? String.Empty;

            // If this was a cancel request do that
            if (hidden_request == "cancel")
            {
                currentMode.Mode = Display_Mode_Enum.Item_Display;
                HttpContext.Current.Response.Redirect(currentMode.Redirect_URL());
            }
            else if (hidden_request.IndexOf("save") == 0)
            {
                // Get the VID that used as a source for this
                string vid = HttpContext.Current.Request.Form["base_volume"];

                if (string.IsNullOrEmpty(vid))
                {
                    message = "<span style=\"color: red\"><strong>No base volume selected!</strong></span>";
                }
                else
                {
                    try
                    {
                        // Get a new instance of this item
                        SobekCM_Item saveItem = SobekCM_Item_Factory.Get_Item(Current_Mode.BibID, vid, Icon_Table, Tracer);

                        // Clear some values for this item
                        saveItem.VID = String.Empty;
                        saveItem.Divisions.Clear();
                        saveItem.Behaviors.Serial_Info.Clear();
                        saveItem.Bib_Info.Series_Part_Info.Clear();
                        saveItem.Behaviors.Clear_Ticklers();
                        saveItem.Tracking.Internal_Comments = String.Empty;

                        // Save the template changes to this item
                        template.Save_To_Bib(saveItem, user, 1);

                        // Save this item and copy over
                        complete_item_submission(saveItem, Tracer);

                        // Clear the volume list
                        Cached_Data_Manager.Remove_Items_In_Title(saveItem.BibID, Tracer);

                        // Forward differently depending on request
                        switch (hidden_request)
                        {
                        case "save_edit":
                            currentMode.Mode          = Display_Mode_Enum.My_Sobek;
                            currentMode.My_Sobek_Type = My_Sobek_Type_Enum.Edit_Item_Metadata;
                            currentMode.VID           = saveItem.VID;
                            HttpContext.Current.Response.Redirect(currentMode.Redirect_URL());
                            break;

                        case "save_again":
                            // No redirect, but save values
                            date                   = saveItem.Bib_Info.Origin_Info.Date_Issued;
                            ipRestrict             = saveItem.Behaviors.IP_Restriction_Membership;
                            trackingBox            = saveItem.Tracking.Tracking_Box;
                            bornDigital            = saveItem.Tracking.Born_Digital;
                            dispositionAdvice      = saveItem.Tracking.Disposition_Advice;
                            dispositionAdviceNotes = saveItem.Tracking.Disposition_Advice_Notes;
                            materialRecdDate       = saveItem.Tracking.Material_Received_Date;
                            materialRecdNotes      = saveItem.Tracking.Material_Received_Notes;
                            if (!hierarchyCopiedFromDate)
                            {
                                if (saveItem.Behaviors.Serial_Info.Count > 0)
                                {
                                    level1      = saveItem.Behaviors.Serial_Info[0].Display;
                                    level1Order = saveItem.Behaviors.Serial_Info[0].Order;
                                }
                                if (saveItem.Behaviors.Serial_Info.Count > 1)
                                {
                                    level2      = saveItem.Behaviors.Serial_Info[1].Display;
                                    level2Order = saveItem.Behaviors.Serial_Info[1].Order;
                                }
                                if (saveItem.Behaviors.Serial_Info.Count > 2)
                                {
                                    level3      = saveItem.Behaviors.Serial_Info[2].Display;
                                    level3Order = saveItem.Behaviors.Serial_Info[2].Order;
                                }
                            }
                            message = message + "<span style=\"color: blue\"><strong>Saved new volume ( " + saveItem.BibID + " : " + saveItem.VID + ")</strong></span>";
                            break;

                        //case "save_addfiles":
                        //    break;

                        default:
                            currentMode.Mode = Display_Mode_Enum.Item_Display;
                            currentMode.VID  = saveItem.VID;
                            HttpContext.Current.Response.Redirect(currentMode.Redirect_URL());
                            break;
                        }
                    }
                    catch (Exception ee)
                    {
                        message = message + "<br /><span style=\"color: red\"><strong>EXCEPTION CAUGHT!<br /><br />" + ee.Message + "<br /><br />" + ee.StackTrace.Replace("\n", "<br />") + "</strong></span>";
                    }
                }
            }
        }
        /// <summary> Constructor for a new instance of the Edit_Item_Group_Form class </summary>
        /// <param name="Group_Info"> List of all the items within this item group </param>
        /// <param name="BibID"> BibID of the current item being displayed </param>
        public Edit_Serial_Hierarchy_Form(string BibID, SobekCM_Items_In_Title Group_Info)
        {
            groupInfo = Group_Info;
            bibid     = BibID;

            // Get references to each column
            itemIdColumn      = groupInfo.Item_Table.Columns["ItemID"];
            titleColumn       = groupInfo.Item_Table.Columns["Title"];
            level1TextColumn  = groupInfo.Item_Table.Columns["Level1_Text"];
            level1IndexColumn = groupInfo.Item_Table.Columns["Level1_Index"];
            level2TextColumn  = groupInfo.Item_Table.Columns["Level2_Text"];
            level2IndexColumn = groupInfo.Item_Table.Columns["Level2_Index"];
            level3TextColumn  = groupInfo.Item_Table.Columns["Level3_Text"];
            level3IndexColumn = groupInfo.Item_Table.Columns["Level3_Index"];
            vidColumn         = groupInfo.Item_Table.Columns["VID"];

            if (!groupInfo.Item_Table.Columns.Contains("sort1"))
            {
                groupInfo.Item_Table.Columns.Add("sort1", Type.GetType("System.Int32"));
                groupInfo.Item_Table.Columns.Add("sort2", Type.GetType("System.Int32"));
                groupInfo.Item_Table.Columns.Add("sort3", Type.GetType("System.Int32"));
                groupInfo.Item_Table.Columns.Add("changed", Type.GetType("System.Boolean"));
            }

            foreach (DataRow thisRow in groupInfo.Item_Table.Rows)
            {
                thisRow["sort1"]   = thisRow[level1IndexColumn];
                thisRow["sort2"]   = thisRow[level2IndexColumn];
                thisRow["sort3"]   = thisRow[level3IndexColumn];
                thisRow["changed"] = false;
            }

            view = new DataView(groupInfo.Item_Table)
            {
                Sort = "sort1 ASC, sort2 ASC, sort3 ASC"
            };

            InitializeComponent();

            isXp = true;
            if (!Windows_Appearance_Checker.is_XP_Theme)
            {
                isXp = false;
                checkBox1.FlatStyle = FlatStyle.Flat;
                checkBox1.BackColor = Color.White;
            }

            BackColor             = Color.FromArgb(240, 240, 240);
            headerPanel.BackColor = Color.FromArgb(25, 68, 141);

            Text = "Edit Item Group Information ( " + BibID + " )";

            rows = new List <Serial_Hierarchy_Row>();

            oddRow    = true;
            locationY = 0;
            index     = 0;
            if (groupInfo.Item_Table.Rows.Count < ROWS_PER_PAGE)
            {
                nextButton.Button_Enabled = false;
                prevButton.Button_Enabled = false;

                foreach (object t in groupInfo.Item_Table.Rows)
                {
                    add_row();
                }
            }
            else
            {
                prevButton.Button_Enabled = false;

                for (int i = 0; i < ROWS_PER_PAGE; i++)
                {
                    add_row();
                }
            }

            show_serial_hierarchy();

            // Set the size correctly
            Size = SMaRT_UserSettings.Edit_Hierarchy_Form_Size;
            int screen_width  = Screen.PrimaryScreen.WorkingArea.Width;
            int screen_height = Screen.PrimaryScreen.WorkingArea.Height;

            if ((Width > screen_width) || (Height > screen_height) || (SMaRT_UserSettings.Edit_Hierarchy_Form_Maximized))
            {
                WindowState = FormWindowState.Maximized;
            }
        }