예제 #1
0
        /// <summary> Constructor for a new instance of the Oai_MainWriter class </summary>
        /// <param name="All_Items_Lookup"> Lookup object used to pull basic information about any item loaded into this library </param>
        /// <param name="Query_String"> URL Query string to parse for OAI-PMH verbs and other values </param>
        public Oai_MainWriter(NameValueCollection Query_String, Item_Lookup_Object All_Items_Lookup)
            : base(null, null, null, null, null, null, null, null)

        {
            // Build list of valid arguments
            validArgs = new List <string>
            {
                "from",
                "until",
                "metadataPrefix",
                "set",
                "resumptionToken",
                "identifier",
                "verb",
                "portal",
                "urlrelative"
            };

            // Load the list of OAI sets
            oaiSets     = SobekCM_Database.Get_OAI_Sets();
            queryString = Query_String;

            itemLookupObj = All_Items_Lookup;

            root = SobekCM_Library_Settings.Base_Data_Directory;
        }
예제 #2
0
        private void okButton_Button_Pressed(object sender, EventArgs e)
        {
            string username = userNameTextBox.Text.Replace("\\", "").Replace("/", "").Replace(".", "").Replace(",", "").Replace("&", "").Replace(":", "").Replace("@", "").Trim();
            string email    = emailTextBox.Text.Trim();
            string note     = notesTextBox.Text.Trim();

            // Ensure the required data is present
            if ((username.Length == 0) || (email.Length == 0))
            {
                MessageBox.Show("Username and email are both required fields.      ", "Missing Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Save the user's preferences
            SMaRT_UserSettings.Email_Address = email;
            SMaRT_UserSettings.User_Name     = username;
            SMaRT_UserSettings.Save();

            // Add this request to the database
            bool result = SobekCM_Database.Tivoli_Request_File(bibid, vid, "*", username.Replace(" ", ""), email, note);

            if (result)
            {
                MessageBox.Show("Request submitted.   You should receive an email when the retrieval is complete.    ", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
            else
            {
                MessageBox.Show("Error requesting the files from the archives.   ", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        /// <summary> Constructor for a new instance of the Builder_AdminViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Current_Mode"> Mode / navigation information for the current request</param>
        public Builder_AdminViewer(User_Object User, SobekCM_Navigation_Object Current_Mode)
            : base(User)
        {
            currentMode = Current_Mode;

            // Ensure the user is the system admin
            if ((User == null) || ((!User.Is_System_Admin) && (!User.Is_Portal_Admin)))
            {
                Current_Mode.Mode          = Display_Mode_Enum.My_Sobek;
                Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Home;
                Current_Mode.Redirect();
                return;
            }

            // If this is a postback, handle any events first
            if ((Current_Mode.isPostBack) && (User.Is_System_Admin))
            {
                // Pull the hidden value
                string save_value = HttpContext.Current.Request.Form["admin_builder_tosave"].ToUpper().Trim();
                if (save_value.Length > 0)
                {
                    // Set this value
                    SobekCM_Database.Set_Setting("Builder Operation Flag", save_value);
                    Current_Mode.Redirect();
                }
            }
        }
        private void updateBornDigitalFlagMenuItem_Click(object sender, EventArgs e)
        {
            if ((gridPanel == null) || (gridPanel.Selected_Row == null) || (gridPanel.Selected_Row.Length == 0))
            {
                return;
            }

            Update_Born_Digital_Form workflowForm = new Update_Born_Digital_Form();

            if (workflowForm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                int  updated = 0;
                bool newflag = workflowForm.Born_Digital_Flag;
                foreach (DataRow thisRow in gridPanel.Selected_Row)
                {
                    int itemid = Convert.ToInt32(thisRow["ItemID"]);
                    if (itemid > 0)
                    {
                        if (SobekCM_Database.Update_Born_Digital_Flag(itemid, newflag))
                        {
                            thisRow["Born_Digital"] = newflag;
                        }
                        updated++;
                    }
                }

                Cursor = Cursors.Default;
                gridPanel.Refresh();
                MessageBox.Show(updated + " records updated.");
            }
        }
        private void addWorklogHistoryEntryMenuItem_Click(object sender, EventArgs e)
        {
            if ((gridPanel == null) || (gridPanel.Selected_Row == null) || (gridPanel.Selected_Row.Length == 0))
            {
                return;
            }

            Add_Workflow_Form workflowForm = new Add_Workflow_Form();

            if (workflowForm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                int      updated = 0;
                int      skipped = 0;
                string   type    = workflowForm.Workflow_Type;
                DateTime date    = workflowForm.Workflow_Date;
                string   notes   = workflowForm.Workflow_Notes;
                foreach (DataRow thisRow in gridPanel.Selected_Row)
                {
                    int itemid = Convert.ToInt32(thisRow["ItemID"]);
                    if (itemid > 0)
                    {
                        SobekCM_Database.Add_Past_Workflow(itemid, type, notes, date, username, String.Empty);
                        updated++;
                    }
                    else
                    {
                        skipped++;
                    }
                }

                Cursor = Cursors.Default;
                MessageBox.Show(updated + " records updated.\n\n" + skipped + " multi-volume records skipped");
            }
        }
        private void updateMaterialReceivedDateMenuItem_Click(object sender, EventArgs e)
        {
            if ((gridPanel == null) || (gridPanel.Selected_Row == null) || (gridPanel.Selected_Row.Length == 0))
            {
                return;
            }

            Update_Material_Received_Form workflowForm = new Update_Material_Received_Form();

            if (workflowForm.ShowDialog() == DialogResult.OK)
            {
                Cursor = Cursors.WaitCursor;
                int      updated   = 0;
                DateTime date      = workflowForm.Date_Received;
                bool     estimated = workflowForm.Estimated;
                string   notes     = workflowForm.Notes;
                foreach (DataRow thisRow in gridPanel.Selected_Row)
                {
                    int itemid = Convert.ToInt32(thisRow["ItemID"]);
                    if (itemid > 0)
                    {
                        if (SobekCM_Database.Update_Material_Received(itemid, date, estimated, username, notes))
                        {
                            thisRow["Material_Received_Date"] = date.ToShortDateString();
                        }
                        updated++;
                    }
                }

                Cursor = Cursors.Default;
                gridPanel.Refresh();
                MessageBox.Show(updated + " records updated.");
            }
        }
예제 #7
0
        private static string HTML_Send_Email(string Recepient_List, string CC_List, string Comments, string User_Name, string SobekCM_Instance_Name, string URL, string URL_Title, string URL_Short_Type, int UserID)
        {
            try
            {
                StringBuilder messageBuilder = new StringBuilder();

                messageBuilder.Append("<span style=\"font-family:Arial, Helvetica, sans-serif;\">");
                if ((Comments.Length > 0) && (Comments != URL_Title))
                {
                    messageBuilder.AppendLine(User_Name + " wanted you to see this " + URL_Short_Type + " on " + SobekCM_Instance_Name + " and included the following comments.<br /><br />\n");
                    messageBuilder.AppendLine(Comments.Replace("<", "(").Replace(">", ")").Replace("\"", "&quot;") + ".<br /><br />\n");
                }
                else
                {
                    messageBuilder.AppendLine(User_Name + " wanted you to see this " + URL_Short_Type + " on " + SobekCM_Instance_Name + ".<br /><br />\n");
                }

                messageBuilder.AppendLine("<a href=\"" + URL + "\">" + URL_Title + "</a>");
                messageBuilder.AppendLine("</span>");

                string[] email_recepients = Recepient_List.Split(";,".ToCharArray());
                foreach (string thisEmailRecepient in email_recepients)
                {
                    SobekCM_Database.Send_Database_Email(thisEmailRecepient.Trim() + "," + CC_List, URL_Short_Type + " from " + SobekCM_Instance_Name, messageBuilder.ToString(), true, false, -1, UserID);
                }
                return(String.Empty);
            }
            catch (Exception ee)
            {
                return(ee.Message);
            }
        }
예제 #8
0
        /// <summary> Constructor for a new instance of the Saved_Searches_MySobekViewer class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        public Saved_Searches_MySobekViewer(RequestCache RequestSpecificValues) : base(RequestSpecificValues)
        {
            RequestSpecificValues.Tracer.Add_Trace("Saved_Searches_MySobekViewer.Constructor", String.Empty);

            if (RequestSpecificValues.Current_Mode.isPostBack)
            {
                // Pull the standard values
                NameValueCollection form = HttpContext.Current.Request.Form;

                string item_action = form["item_action"].ToUpper().Trim();
                string folder_id   = form["folder_id"].Trim();

                if (item_action == "REMOVE")
                {
                    int folder_id_int;
                    if (Int32.TryParse(folder_id, out folder_id_int))
                    {
                        SobekCM_Database.Delete_User_Search(folder_id_int, RequestSpecificValues.Tracer);
                    }
                }

                HttpContext.Current.Response.Redirect(HttpContext.Current.Items["Original_URL"].ToString(), false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                RequestSpecificValues.Current_Mode.Request_Completed = true;
            }
        }
예제 #9
0
        private static string Text_Send_Email(string Recepient_List, string CC_List, string Comments, string User_Name, string SobekCM_Instance_Name, string URL, string URL_Title, string URL_Short_Type, int UserID)
        {
            try
            {
                StringBuilder messageBuilder = new StringBuilder();

                if ((Comments.Length > 0) && (Comments != URL_Title))
                {
                    messageBuilder.AppendLine(User_Name + " wanted you to see this " + URL_Short_Type.ToLower() + " on " + SobekCM_Instance_Name + " and included the following comments.\n");
                    messageBuilder.AppendLine("\"" + Comments.Replace("<", "(").Replace(">", ")").Replace("\"", "&quot;") + "\"\n");
                }
                else
                {
                    messageBuilder.AppendLine(User_Name + " wanted you to see this " + URL_Short_Type.ToLower() + " on " + SobekCM_Instance_Name + ".\n");
                }

                messageBuilder.AppendLine("\tURL:\t" + URL);
                messageBuilder.AppendLine("\tTitle:\t" + URL_Title);

                string[] email_recepients = Recepient_List.Split(";,".ToCharArray());
                foreach (string thisEmailRecepient in email_recepients)
                {
                    SobekCM_Database.Send_Database_Email(thisEmailRecepient.Trim() + "," + CC_List, URL_Short_Type + " from " + SobekCM_Instance_Name, messageBuilder.ToString(), false, false, -1, UserID);
                }
                return(String.Empty);
            }
            catch (Exception ee)
            {
                return(ee.Message);
            }
        }
예제 #10
0
        /// <summary> Refreshes the item list and aggregation/greenstone code information from the database on a regular basis </summary>
        /// <param name="Code_Manager"> [REF] List of valid collection codes, including mapping from the Sobek collections to Greenstone collections</param>
        /// <param name="All_Items_Lookup"> [REF] Lookup object used to pull basic information about any item loaded into this library </param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        public static bool Refresh_Item_List_And_Aggregation_Codes(ref Aggregation_Code_Manager Code_Manager, ref Item_Lookup_Object All_Items_Lookup)
        {
            try
            {
                // Load SobekCM Codes to Greenstone Codes conversion again
                if (Code_Manager != null)
                {
                    lock (Code_Manager)
                    {
                        SobekCM_Database.Populate_Code_Manager(Code_Manager, null);
                    }
                }
                else
                {
                    Code_Manager = new Aggregation_Code_Manager();
                    SobekCM_Database.Populate_Code_Manager(Code_Manager, null);
                }

                //lock (item_list_lock_object)
                //{
                //    if (All_Items_Lookup == null)
                //        All_Items_Lookup = new Item_Lookup_Object();

                //    // Have the database popoulate the little bit of bibid/vid information we retain
                //    SobekCM_Database.Populate_Item_Lookup_Object(true, All_Items_Lookup, null);
                //}

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        /// <summary> Add the main HTML to be added to the page </summary>
        /// <param name="Output"> Textwriter to write the HTML for this viewer</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This writes the HTML from the static browse or info page here  </remarks>
        public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            DataTable historyTbl = SobekCM_Database.Get_Aggregation_Change_Log(ViewBag.Hierarchy_Object.Code, RequestSpecificValues.Tracer);

            if ((historyTbl == null) || (historyTbl.Rows.Count == 0))
            {
                Output.WriteLine("<p>No history found for this collection!</p>");

                Output.WriteLine("<p>This may be due to an error, or this may be a legacy collection which has not been edited in a very long time.</p>");

                return;
            }

            Output.WriteLine("<p style=\"text-align: left; padding:0 20px 0 20px;\">Below is the change log for this collection and the design files under this collection.  This does not include the history of digital reources loaded into this collection.</p>");

            Output.WriteLine("  <table class=\"sbkWhav_Table\">");
            Output.WriteLine("    <tr>");
            Output.WriteLine("      <th style=\"width:100px;\">Date</th>");
            Output.WriteLine("      <th style=\"width:180px;\">User</th>");
            Output.WriteLine("      <th style=\"width:500px;\">Change Description</th>");
            Output.WriteLine("    </tr>");

            foreach (DataRow thisChange in historyTbl.Rows)
            {
                Output.WriteLine("    <tr>");
                Output.WriteLine("      <td>" + Convert.ToDateTime(thisChange[1]).ToShortDateString() + "</td>");
                Output.WriteLine("      <td>" + thisChange[2] + "</td>");
                Output.WriteLine("      <td>" + thisChange[0].ToString().Replace("\n", "<br />") + "</td>");
                Output.WriteLine("    </tr>");
                Output.WriteLine("    <tr class=\"sbkWhav_TableRule\"><td colspan=\"3\"></td></tr>");
            }

            Output.WriteLine("  </table>");
            Output.WriteLine("  <br /><br />");
        }
예제 #12
0
        /// <summary> Stream to which to write the HTML for this subwriter  </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Feature_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Save the current viewer code
            string current_view_code = CurrentMode.ViewerCode;

            // Start the citation table
            Output.WriteLine("\t\t<!-- FEATURE VIEWER OUTPUT -->");
            Output.WriteLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Features</b></span></td></tr>");
            Output.WriteLine("\t\t<tr><td class=\"SobekDocumentDisplay\">");
            Output.WriteLine("\t\t\t<div class=\"SobekCitation\">");

            // Get the list of streets from the database
            Map_Features_DataSet features = SobekCM_Database.Get_All_Features_By_Item(CurrentItem.Web.ItemID, Tracer);

            Create_Feature_Index(Output, features);

            // Finish the citation table
            Output.WriteLine("\t\t\t</div>");
            Output.WriteLine("\t\t</td>");
            Output.WriteLine("\t\t<!-- END FEATURE VIEWER OUTPUT -->");

            // Restore the mode
            CurrentMode.ViewerCode = current_view_code;
        }
예제 #13
0
        /// <summary> Constructor for a new instance of the Saved_Searches_MySobekViewer class </summary>
        /// <param name="User"> Authenticated user information </param>
        /// <param name="Translator"> Translation / language support object for writing the user interface is multiple languages</param>
        /// <param name="currentMode"> Mode / navigation information for the current request</param>
        /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param>
        public Saved_Searches_MySobekViewer(User_Object User,
                                            Language_Support_Info Translator,
                                            SobekCM_Navigation_Object currentMode,
                                            Custom_Tracer Tracer)
            : base(User)
        {
            Tracer.Add_Trace("Saved_Searches_MySobekViewer.Constructor", String.Empty);

            user            = User;
            base.Translator = Translator;

            if (currentMode.isPostBack)
            {
                // Pull the standard values
                NameValueCollection form = HttpContext.Current.Request.Form;

                string item_action = form["item_action"].ToUpper().Trim();
                string folder_id   = form["folder_id"].Trim();

                if (item_action == "REMOVE")
                {
                    int folder_id_int;
                    if (Int32.TryParse(folder_id, out folder_id_int))
                    {
                        SobekCM_Database.Delete_User_Search(folder_id_int, Tracer);
                    }
                }

                HttpContext.Current.Response.Redirect(HttpContext.Current.Items["Original_URL"].ToString());
            }
        }
        private void testConnectionButton_Button_Pressed(object sender, EventArgs e)
        {
            Connection_String = "data source=" + serverNameTextBox.Text.Trim() + ";initial catalog=" + databaseNameTextBox.Text.Trim() + ";integrated security=Yes;";

            MessageBox.Show(SobekCM_Database.Test_Connection(Connection_String)
                                ? "CONNECTION SUCCESSFUL!"
                                : "CONNECTION FAILED!");
        }
예제 #15
0
        /// <summary> Constructor for a new instance of the Oai_MainWriter class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        /// <param name="Query_String"> URL Query string to parse for OAI-PMH verbs and other values </param>
        public Oai_MainWriter(NameValueCollection Query_String, RequestCache RequestSpecificValues) : base(RequestSpecificValues)

        {
            // Build list of valid arguments
            validArgs = new List <string>
            {
                "from",
                "until",
                "metadataPrefix",
                "set",
                "resumptionToken",
                "identifier",
                "verb",
                "portal",
                "urlrelative"
            };

            // Load the list of OAI sets
            oaiSets     = SobekCM_Database.Get_OAI_Sets();
            queryString = Query_String;

            // Set the response type
            HttpContext.Current.Response.ContentType = "text/xml";

            // Determine some global settings
            if (UI_ApplicationCache_Gateway.Configuration.OAI_PMH != null)
            {
                config = UI_ApplicationCache_Gateway.Configuration.OAI_PMH;
                oai_resource_identifier_base = UI_ApplicationCache_Gateway.Configuration.OAI_PMH.Identifier_Base;
                oai_repository_name          = UI_ApplicationCache_Gateway.Configuration.OAI_PMH.Name;
                oai_repository_identifier    = UI_ApplicationCache_Gateway.Configuration.OAI_PMH.Identifier;
            }
            else
            {
                config = new OAI_PMH_Configuration();
                config.Set_Default();
                config.Enabled = true;
            }
            if (String.IsNullOrEmpty(oai_resource_identifier_base))
            {
                oai_resource_identifier_base = "oai:" + UI_ApplicationCache_Gateway.Settings.System.System_Abbreviation + ":";
            }
            if (String.IsNullOrEmpty(oai_repository_name))
            {
                oai_repository_name = UI_ApplicationCache_Gateway.Settings.System.System_Name;
            }
            if (String.IsNullOrEmpty(oai_repository_identifier))
            {
                oai_repository_identifier = UI_ApplicationCache_Gateway.Settings.System.System_Abbreviation;
            }

            // Get the list of metadata prefixes permissiable by the system
            metadataPrefixes = new List <string>();
            foreach (OAI_PMH_Metadata_Format thisConfig in config.Metadata_Prefixes)
            {
                metadataPrefixes.Add(thisConfig.Prefix);
            }
        }
        private void testConnectionButton_Button_Pressed(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            bool connection_succsss = SobekCM_Database.Test_Connection(connectionTextBox.Text.Trim());

            Cursor = Cursors.Default;

            MessageBox.Show(connection_succsss ? "CONNECTION SUCCESSFUL!" : "CONNECTION FAILED!");
        }
예제 #17
0
        protected override void OnUnload(EventArgs E)
        {
            if (HttpContext.Current.Session["Last_Exception"] == null)
            {
                SobekCM_Database.Verify_Item_Lookup_Object(true, ref Global.Item_List, null);
            }

            base.OnUnload(E);
        }
예제 #18
0
        /// <summary> Gets the OAI-PMH m,etadata for a single digital resource, by identifier </summary>
        /// <param name="Output"> Stream to which to write the text for this main writer </param>
        /// <param name="Identifier"> Identifier for the record to retrieve the metadata for </param>
        /// <param name="MetadataPrefix"> Prefix for the metadata format to return the record </param>
        protected internal void GetRecord(TextWriter Output, string Identifier, string MetadataPrefix)
        {
            // Perform check that the identifier is valid
            bool valid = true;

            // Metadata prefix must be in the list of acceptable metadata prefixes
            if (!metadataPrefixes.Contains(MetadataPrefix))
            {
                Write_Error(Output, "identifier=\"" + Identifier + "\" metadataPrefix=\"" + MetadataPrefix + "\" verb=\"GetRecord\"", "cannotDisseminateFormat", "Item " + Identifier + " does not have metadata for " + MetadataPrefix);
                return;
            }

            // Ensure the identifier is in basic correct form
            OAI_Record thisTitle = null;

            if (Identifier.IndexOf(oai_resource_identifier_base) != 0)
            {
                valid = false;
            }
            else
            {
                // Get the bib id and vid
                string bibid_vid = Identifier.Substring(oai_resource_identifier_base.Length);
                if (bibid_vid.Length != 16)
                {
                    valid = false;
                }
                else
                {
                    // Pull the information for this item
                    string bibid = bibid_vid.Substring(0, 10);
                    string vid   = bibid_vid.Substring(11);
                    thisTitle = SobekCM_Database.Get_OAI_Record(bibid, vid, MetadataPrefix);
                }
            }

            // Throw error if invalid
            if ((!valid) || (thisTitle == null))
            {
                Write_Error(Output, "identifier=\"" + Identifier + "\" metadataPrefix=\"" + MetadataPrefix + "\" verb=\"GetRecord\"", "idDoesNotExist", "identifier is not valid URI: " + Identifier);
                return;
            }

            // Display the information
            Output.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ");
            Output.WriteLine("<?xml-stylesheet type=\"text/xsl\" href=\"oai2.xsl\" ?>");
            Output.WriteLine("<OAI-PMH xmlns=\"http://www.openarchives.org/OAI/2.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\">");
            Output.WriteLine("<responseDate>" + date_in_utc(DateTime.Now) + "</responseDate>");
            Output.WriteLine("<request identifier=\"" + Identifier + "\" metadataPrefix=\"" + MetadataPrefix + "\" verb=\"GetRecord\">" + url + "</request>");
            Output.WriteLine("<GetRecord>");

            Output.Write("<record><header><identifier>" + oai_resource_identifier_base + thisTitle.BibID + "_" + thisTitle.VID + "</identifier><datestamp>" + thisTitle.Last_Modified_Date.Year + "-" + thisTitle.Last_Modified_Date.Month.ToString().PadLeft(2, '0') + "-" + thisTitle.Last_Modified_Date.Day.ToString().PadLeft(2, '0') + "</datestamp></header>");
            Output.WriteLine("<metadata>" + thisTitle.Record + "</metadata></record>");

            Output.WriteLine("</GetRecord>");
            Output.WriteLine("</OAI-PMH>");
        }
예제 #19
0
        /// <summary> Add controls directly to the form, either to the main control area or to the file upload placeholder </summary>
        /// <param name="placeHolder"> Main place holder to which all main controls are added </param>
        /// <param name="uploadFilesPlaceHolder"> Place holder is used for uploading file [UNUSED IN THIS VIEWER] </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> The <see cref="PagedResults_HtmlSubwriter"/> class is instantiated and adds controls to the placeholder here </remarks>
        public override void Add_Controls(PlaceHolder placeHolder, PlaceHolder uploadFilesPlaceHolder, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Saved_Searches_MySobekViewer.Add_Controls", String.Empty);
            DataTable searchesTable = SobekCM_Database.Get_User_Searches(user.UserID, Tracer);

            StringBuilder saveSearchBuilder = new StringBuilder(1000);

            saveSearchBuilder.AppendLine("<!-- Hidden field is used for postbacks to indicate what to save and reset -->");
            saveSearchBuilder.AppendLine("<input type=\"hidden\" id=\"item_action\" name=\"item_action\" value=\"\" />");
            saveSearchBuilder.AppendLine("<input type=\"hidden\" id=\"folder_id\" name=\"folder_id\" value=\"\" />");

            saveSearchBuilder.AppendLine("<div class=\"SobekHomeText\" >");
            if (searchesTable.Rows.Count > 0)
            {
                saveSearchBuilder.AppendLine("  <blockquote>");
                saveSearchBuilder.AppendLine("  <table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">");
                saveSearchBuilder.AppendLine("    <tr align=\"left\" bgcolor=\"#0022a7\" >");
                saveSearchBuilder.AppendLine("      <th width=\"120px\" align=\"left\"><span style=\"color: White\"> &nbsp; ACTIONS</span></th>");
                saveSearchBuilder.AppendLine("      <th width=\"480px\" align=\"left\"><span style=\"color: White\">SAVED SEARCH</span></th>");
                saveSearchBuilder.AppendLine("     </tr>");
                saveSearchBuilder.AppendLine("    <tr><td bgcolor=\"#e7e7e7\" colspan=\"2\"></td></tr>");



                // Write the data for each interface
                foreach (DataRow thisRow in searchesTable.Rows)
                {
                    int    usersearchid = Convert.ToInt32(thisRow["UserSearchID"]);
                    string search_url   = thisRow["SearchURL"].ToString();
                    string search_desc  = thisRow["UserNotes"].ToString();

                    // Build the action links
                    saveSearchBuilder.AppendLine("    <tr align=\"left\" valign=\"center\" >");
                    saveSearchBuilder.Append("      <td class=\"SobekFolderActionLink\" >( ");
                    saveSearchBuilder.Append("<a title=\"Click to delete this saved search\" href=\"" + currentMode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_search('" + usersearchid + "');\">delete</a> | ");
                    saveSearchBuilder.AppendLine("<a title=\"Click to view this search\" href=\"" + search_url + "\">view</a> )</td>");
                    saveSearchBuilder.AppendLine("      <td><a href=\"" + search_url + "\">" + search_desc + "</a></td>");
                    saveSearchBuilder.AppendLine("     </tr>");
                    saveSearchBuilder.AppendLine("    <tr><td bgcolor=\"#e7e7e7\" colspan=\"2\"></td></tr>");
                }

                saveSearchBuilder.AppendLine("  </table>");
                saveSearchBuilder.AppendLine("  </blockquote>");
            }
            else
            {
                saveSearchBuilder.AppendLine("<blockquote>You do not have any saved searches or browses.<br /><br />To add a search or browse, use the ADD button while viewing the results of your search or browse.</blockquote><br />");
            }
            saveSearchBuilder.AppendLine("</div>");

            // Add this as a literal
            Literal mgmtLiteral = new Literal {
                Text = saveSearchBuilder.ToString()
            };

            placeHolder.Controls.Add(mgmtLiteral);
        }
예제 #20
0
        /// <summary> Gets the OAI-PMH m,etadata for a single digital resource, by identifier </summary>
        /// <param name="Output"> Stream to which to write the text for this main writer </param>
        /// <param name="identifier"> Identifier for the record to retrieve the metadata for </param>
        /// <param name="metadata_prefix"> Prefix for the metadata format to return the record </param>
        protected internal void GetRecord(TextWriter Output, string identifier, string metadata_prefix)
        {
            // Perform check that the identifier is valid
            bool   valid  = true;
            string record = String.Empty;

            // Metadata prefix must currently be oai_dc currently
            if (metadata_prefix != "oai_dc")
            {
                Write_Error(Output, "identifier=\"" + identifier + "\" metadataPrefix=\"" + metadata_prefix + "\" verb=\"GetRecord\"", "cannotDisseminateFormat", "Item " + identifier + " does not have metadata for " + metadata_prefix);
                return;
            }

            // Ensure the identifier is in basic correct form
            OAI_Record thisTitle = null;

            if (identifier.IndexOf(SobekCM_Library_Settings.OAI_Resource_Identifier_Base) != 0)
            {
                valid = false;
            }
            else
            {
                // Get the bib id and vid
                string bibid = identifier.Substring(SobekCM_Library_Settings.OAI_Resource_Identifier_Base.Length);
                if (bibid.Length != 10)
                {
                    valid = false;
                }
                else
                {
                    // Pull the information for this item
                    thisTitle = SobekCM_Database.Get_OAI_Record(bibid, metadata_prefix);
                }
            }

            // Throw error if invalid
            if ((!valid) || (thisTitle == null))
            {
                Write_Error(Output, "identifier=\"" + identifier + "\" metadataPrefix=\"" + metadata_prefix + "\" verb=\"GetRecord\"", "idDoesNotExist", "identifier is not valid URI: " + identifier);
                return;
            }

            // Display the information
            Output.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ");
            Output.WriteLine("<?xml-stylesheet type=\"text/xsl\" href=\"oai2.xsl\" ?>");
            Output.WriteLine("<OAI-PMH xmlns=\"http://www.openarchives.org/OAI/2.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\">");
            Output.WriteLine("<responseDate>" + date_in_utc(DateTime.Now) + "</responseDate>");
            Output.WriteLine("<request identifier=\"" + identifier + "\" metadataPrefix=\"" + metadata_prefix + "\" verb=\"GetRecord\">" + url + "</request>");
            Output.WriteLine("<GetRecord>");

            Output.Write("<record><header><identifier>" + SobekCM_Library_Settings.OAI_Resource_Identifier_Base + thisTitle.BibID + "</identifier><datestamp>" + thisTitle.Last_Modified_Date.Year + "-" + thisTitle.Last_Modified_Date.Month.ToString().PadLeft(2, '0') + "-" + thisTitle.Last_Modified_Date.Day.ToString().PadLeft(2, '0') + "</datestamp></header>");
            Output.WriteLine("<metadata><oai_dc:dc xmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd\">" + thisTitle.Record + "</oai_dc:dc></metadata></record>");

            Output.WriteLine("</GetRecord>");
            Output.WriteLine("</OAI-PMH>");
        }
예제 #21
0
        /// <summary> Saves this item to the SobekCM database </summary>
        /// <param name="Item_List"> Item list datatable for pulling out the original creation date for this resource </param>
        /// <param name="New_Item"> Flag indicates this is an entirely new item </param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        public bool Save_to_Database(DataTable Item_List, bool New_Item)
        {
            if (bibPackage == null)
            {
                return(false);
            }

            try
            {
                // save the bib package to the SobekCM database
                bool      existed    = false;
                DateTime  createTime = packageTime;
                DataRow[] check      = Item_List.Select("BibID='" + bibid + "' and VID='" + vid + "'");
                if (check.Length > 0)
                {
                    existed = true;
                    if (Item_List.Columns.Contains("CreateDate"))
                    {
                        createTime = Convert.ToDateTime(check[0]["CreateDate"]);
                    }
                }

                // Set the file root again
                bibPackage.Web.File_Root = fileRoot;
                SobekCM_Database.Save_Digital_Resource(bibPackage, createTime, existed);

                // Save the behaviors if this is a new item
                if (!existed)
                {
                    // Some work here just in case the METS is missing stuff, or has old data

                    // Make sure not set to UFDC as only web skin by default (used to list UFDC on all METS files )
                    if ((bibPackage.Behaviors.Web_Skin_Count == 1) && (bibPackage.Behaviors.Web_Skins[0].ToUpper().Trim() == "UFDC"))
                    {
                        bibPackage.Behaviors.Clear_Web_Skins();
                    }

                    // Now, save the behaviors for this item
                    SobekCM_Database.Save_Behaviors(bibPackage, false, false);
                }

                //// Set the suppress endeca flag
                //if ((New_Item) && (!bibPackage.Behaviors.Suppress_Endeca))
                //{
                //    SobekCM.Library.Database.SobekCM_Database.Set_Endeca_Flag(bibPackage.BibID, bibPackage.Behaviors.Suppress_Endeca);
                //}
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        /// <summary> Returns the archive tracking information as an HTML string </summary>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Archive information about this digital resource as an HTML string</returns>
        protected string Archives_String(Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Tracking_ItemViewer.Archives_String", "Displaying archive tracking information");
            }

            StringBuilder builder = new StringBuilder(3000);

            if (!CurrentItem.Tracking.hasArchiveInformation)
            {
                builder.AppendLine("<br /><br /><br /><center><strong>ITEM HAS NO ARCHIVE INFORMATION</strong></center><br /><br /><br />");
            }
            else
            {
                // Now, pull the list of all archived files
                DataSet    data                = SobekCM_Database.Tracking_Get_History_Archives(CurrentItem.Web.ItemID, Tracer);
                DataTable  archiveTable        = data.Tables[2];
                DataColumn filenameColumn      = archiveTable.Columns["Filename"];
                DataColumn sizeColumn          = archiveTable.Columns["Size"];
                DataColumn lastWriteDateColumn = archiveTable.Columns["LastWriteDate"];
                DataColumn archiveDateColumn   = archiveTable.Columns["ArchiveDate"];


                builder.AppendLine("<br />");
                builder.AppendLine("<table border=\"1px\" cellpadding=\"1px\" cellspacing=\"0px\" rules=\"cols\" frame=\"void\" bordercolor=\"#e7e7e7\" width=\"100%\">");
                builder.AppendLine("  <tr align=\"center\" bgcolor=\"#0022a7\" height=\"25px\"><td colspan=\"4\"><span style=\"color: White\"><b>ARCHIVED FILE INFORMATION</b></span></td></tr>");
                builder.AppendLine("  <tr align=\"left\" bgcolor=\"#7d90d5\" height=\"25px\">");
                builder.AppendLine("    <th><span style=\"color: White\">FILENAME</span></th>");
                builder.AppendLine("    <th><span style=\"color: White\">SIZE</span></th>");
                builder.AppendLine("    <th><span style=\"color: White\">LAST WRITE DATE</span></th>");
                builder.AppendLine("    <th><span style=\"color: White\">ARCHIVED DATE</span></th>");
                builder.AppendLine("  </tr>");


                foreach (DataRow thisRow in archiveTable.Rows)
                {
                    builder.AppendLine("  <tr height=\"25px\" >");
                    builder.AppendLine("    <td>" + thisRow[filenameColumn] + "</td>");
                    builder.AppendLine("    <td>" + thisRow[sizeColumn] + "</td>");
                    builder.AppendLine("    <td>" + thisRow[lastWriteDateColumn] + "</td>");
                    builder.AppendLine("    <td>" + thisRow[archiveDateColumn] + "</td>");
                    builder.AppendLine("  </tr>");
                    builder.AppendLine("  <tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>");
                }

                builder.AppendLine("</table>");
            }

            builder.AppendLine("<br /> <br />");

            return(builder.ToString());
        }
예제 #23
0
        /// <summary> Adds the main view section to the page turner </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Street_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
            }

            // Build the value
            StringBuilder       builder = new StringBuilder(5000);
            Map_Streets_DataSet streets = SobekCM_Database.Get_All_Streets_By_Item(CurrentItem.Web.ItemID, Tracer);

            if (streets == null)
            {
                builder.AppendLine("<br />");
                builder.AppendLine("<center><b>UNABLE TO LOAD STREETS FROM DATABASE</b></center>");
                builder.AppendLine("<br />");
                CurrentMode.Mode = Display_Mode_Enum.Contact;
                builder.AppendLine("<center>Click <a href=\"" + CurrentMode.Redirect_URL() + "\">here</a> to report this issue.</center>");
                builder.AppendLine("<br />");
                CurrentMode.Mode = Display_Mode_Enum.Item_Display;
            }
            else
            {
                // Save the current viewer code
                string current_view_code = CurrentMode.ViewerCode;

                // Start the citation table
                builder.AppendLine("\t\t<!-- STREET VIEWER OUTPUT -->");
                builder.AppendLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Streets</b></span></td></tr>");
                builder.AppendLine("\t\t<tr><td class=\"SobekDocumentDisplay\">");
                builder.AppendLine("\t\t\t<div class=\"SobekCitation\">");

                // Get the list of streets from the database
                Create_Street_Index(builder, streets);

                // Finish the citation table
                builder.AppendLine("\t\t\t</div>");
                builder.AppendLine("\t\t</td>");
                builder.AppendLine("\t\t<!-- END STREET VIEWER OUTPUT -->");

                // Restore the mode
                CurrentMode.ViewerCode = current_view_code;
            }

            // Add the HTML for the image
            Literal mainLiteral = new Literal {
                Text = builder.ToString()
            };

            placeHolder.Controls.Add(mainLiteral);
        }
        /// <summary> Check the Bibliographic package agaist the SobekCM METS standard</summary>
        /// <param name="bibPackagetoCheck">Package to validate</param>
        /// <param name="packageDir">Directory for the package</param>
        /// <returns>TRUE is succesful, otherwise FALSE</returns>
        public bool SobekCM_Standard_Check(SobekCM_Item bibPackagetoCheck, string packageDir)
        {
            bool returnVal = true;

            validationErrors = new StringBuilder();
            thisBibPackage   = bibPackagetoCheck;
            packageDirName   = packageDir;

            // check the BibID is in the right format
            if (SobekCM_Database.is_bibid_format(thisBibPackage.Bib_Info.BibID) == false)
            {
                validationErrors.Append("Invalid BibID" + "\n");
                returnVal = false;
            }
            // check the VID is in the right format
            if (SobekCM_Database.is_vids_format(thisBibPackage.Bib_Info.VID) == false)
            {
                validationErrors.Append("Invalid VID" + "\n");
                returnVal = false;
            }
            // check the title, it is a required field
            if (thisBibPackage.Bib_Info.Main_Title.Title.Length == 0)
            {
                validationErrors.Append("Item title is required but not supplied!" + "\n");
                returnVal = false;
            }

            // check if the objid is the combination of BibID_VID
            if (thisBibPackage.METS_Header.ObjectID != thisBibPackage.Bib_Info.BibID + "_" + thisBibPackage.Bib_Info.VID)
            {
                validationErrors.Append("The METS OBJID does not match its BibID and VID" + "\n");
                returnVal = false;
            }

            // Validate the folder matches the package object id
            DirectoryInfo dirInfo = new DirectoryInfo(packageDir);
            string        dirName = dirInfo.Name;

            if (dirName.Length < 16)
            {
                dirName = dirInfo.Parent.Name + "_" + dirName;
            }
            if (!String.Equals(dirName, thisBibPackage.METS_Header.ObjectID, StringComparison.InvariantCultureIgnoreCase))
            {
                validationErrors.Append("The folder name and the METS OBJID do not match" + "\n");
                returnVal = false;
            }

            // check if file sizes and MD5 checksums match with what indicate in the mets file
            return(returnVal);
        }
        private void add_items_by_collection(TextWriter Output, string Collection, Custom_Tracer Tracer)
        {
            DataSet   itemsListSet = SobekCM_Database.Statistics_Aggregation_Titles(Collection, Tracer);
            DataTable itemsList    = itemsListSet.Tables[0];

            Tracer.Add_Trace("Usage_Statistics_AggregationViewer.add_items_by_collection", "Rendering HTML");

            Output.WriteLine("<div class=\"SobekText\">");
            Output.WriteLine("<p>The most commonly utilized items for this collection appear below.</p>");

            currentMode.Info_Browse_Mode = "definitions";
            Output.WriteLine("<p>The <a href=\"" + currentMode.Redirect_URL() + "\">Definitions page</a> provides more details about the statistics and words used below.</p>");

            Output.WriteLine();

            Output.WriteLine("<center>");
            Output.WriteLine("<table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">");
            Output.WriteLine("  <tr align=\"left\" bgcolor=\"#0022a7\" >");
            Output.WriteLine("    <th width=\"90px\" align=\"left\"><span style=\"color: White\">BIBID</span></th>");
            Output.WriteLine("    <th width=\"50px\" align=\"left\"><span style=\"color: White\">VID</span></th>");
            Output.WriteLine("    <th width=\"430px\" align=\"left\"><span style=\"color: White\">TITLE</span></th>");
            Output.WriteLine("    <th width=\"90px\" align=\"right\"><span style=\"color: White\">VIEWS</span></th>");
            Output.WriteLine("  </tr>");

            if (itemsList != null)
            {
                int itemCount = 0;
                foreach (DataRow thisRow in itemsList.Rows)
                {
                    if (itemCount == 100)
                    {
                        break;
                    }

                    Output.WriteLine("  <tr align=\"left\" >");
                    Output.WriteLine("    <td>" + thisRow[0] + "</td>");
                    Output.WriteLine("    <td>" + thisRow[1] + "</td>");
                    Output.WriteLine("    <td><a href=\"" + currentMode.Base_URL + thisRow[0] + "/" + thisRow[1] + "\">" + thisRow[2] + "</a></td>");
                    Output.WriteLine("    <td align=\"right\">" + thisRow[3] + "</td>");
                    Output.WriteLine("  </tr>");
                    Output.WriteLine("  <tr><td bgcolor=\"#e7e7e7\" colspan=\"4\"></td></tr>");
                    itemCount++;
                }
            }

            Output.WriteLine("</table>");
            Output.WriteLine("</center>");
            Output.WriteLine("<br /> <br />");
            Output.WriteLine("</div>");
        }
        private void saveButton_Button_Pressed(object sender, EventArgs e)
        {
            Connection_String = "data source=" + serverNameTextBox.Text.Trim() + ";initial catalog=" + databaseNameTextBox.Text.Trim() + ";integrated security=Yes;";

            if (SobekCM_Database.Test_Connection(Connection_String))
            {
                DialogResult = DialogResult.OK;
                Close();
            }
            else
            {
                MessageBox.Show("CONNECTION FAILED!");
            }
        }
        /// <summary> Gets a <see cref="Single_Item"/> object from the collection, by Bib ID and VID </summary>
        /// <param name="BibID"> Bibliographic identifier for the title / item group </param>
        /// <param name="VID"> Volume identifier for the individual volume within the title </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Basic information about this item as a <see cref="Single_Item"/> object. </returns>
        public Single_Item Item_By_Bib_VID(string BibID, string VID, Custom_Tracer Tracer)
        {
            // Try to look this up in the database
            lock (thisLock)
            {
                if (titleLookupByBib.ContainsKey(BibID))
                {
                    if (titleLookupByBib[BibID].Contains_VID(VID))
                    {
                        return(titleLookupByBib[BibID][VID]);
                    }
                }

                // Try to pull this from the database
                DataRow itemRow = SobekCM_Database.Get_Item_Information(BibID, VID, Tracer);

                if (itemRow != null)
                {
                    // Get a reference to the item table first
                    DataTable itemTable = itemRow.Table;

                    // Get references to the datacolumn next
                    DataColumn vidColumn         = itemTable.Columns["VID"];
                    DataColumn restrictionColumn = itemTable.Columns["IP_Restriction_Mask"];
                    DataColumn titleColumn       = itemTable.Columns["Title"];

                    // Create this item object
                    Single_Item newItem = new Single_Item(itemRow[vidColumn].ToString(), Convert.ToInt16(itemRow[restrictionColumn]), itemRow[titleColumn].ToString());

                    // Add this to the existing title, or add a new one
                    if (titleLookupByBib.ContainsKey(BibID))
                    {
                        titleLookupByBib[BibID].Add_Item(newItem);
                    }
                    else
                    {
                        Multiple_Volume_Item newTitle = new Multiple_Volume_Item(BibID);
                        newTitle.Add_Item(newItem);
                        Add_Title(newTitle);
                    }

                    // Return the newly built item as well
                    return(newItem);
                }

                return(null);
            }
        }
        /// <summary> Returns a flag indicating if an abort was requested </summary>
        /// <returns> TRUE if the flag is currently ABORT REQUESTED, ABORTING, or NO BUILDER REQUESTED</returns>
        public static bool Abort_Requested()
        {
            Dictionary <string, string> builder_settings = SobekCM_Database.Get_Settings(null);

            if (builder_settings.ContainsKey(setting_key))
            {
                switch (builder_settings[setting_key].ToUpper().Replace("_", " "))
                {
                case "ABORT REQUESTED":
                case "ABORTING":
                case "NO BUILDING REQUESTED":
                    return(true);
                }
            }

            return(false);
        }
예제 #29
0
        /// <summary> Add the HTML to be displayed below the search box </summary>
        /// <param name="Output"> Textwriter to write the HTML for this viewer</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks> This writes the HTML from the static browse or info page here  </remarks>
        public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Item_Count_AggregationViewer.Add_Secondary_HTML", "Adding HTML");
            }

            DataTable value = SobekCM_Database.Tracking_Get_Milestone_Report(currentCollection.Code, Tracer);

            Output.WriteLine("<div class=\"SobekText\">");
            Output.WriteLine("<br />");
            Output.WriteLine("<p>Below is the number of titles and items for all items within this aggregation, including currently online items as well as items in process.</p>");
            Output.WriteLine("<br />");

            Output.WriteLine("</div>");
            // Start the table
            Output.WriteLine("<table width=\"700px\" border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">");
            Output.WriteLine("  <tr align=\"left\" bgcolor=\"#0022a7\">");
            Output.WriteLine("    <th align=\"left\"><span style=\"color: White\"><b>LAST MILESTONE</b></span></th>");
            Output.WriteLine("    <th align=\"left\"><span style=\"color: White\"><b>TITLE COUNT</b></span></th>");
            Output.WriteLine("    <th align=\"left\"><span style=\"color: White\"><b>ITEM COUNT</b></span></th>");
            Output.WriteLine("    <th align=\"left\"><span style=\"color: White\"><b>PAGE COUNT</b></span></th>");
            Output.WriteLine("    <th align=\"left\"><span style=\"color: White\"><b>FILE COUNT</b></span></th>");
            Output.WriteLine("  </tr>");

            foreach (DataRow thisRow in value.Rows)
            {
                Output.WriteLine("  <tr><td bgcolor=\"#e7e7e7\" colspan=\"5\"></td></tr>");

                Output.WriteLine("  <tr align=\"left\">");
                Output.WriteLine("    <td>" + thisRow[0] + "</td>");
                Output.WriteLine("    <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[1])) + "</td>");
                Output.WriteLine("    <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[2])) + "</td>");
                Output.WriteLine("    <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[3])) + "</td>");
                Output.WriteLine("    <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[4])) + "</td>");
                Output.WriteLine("  </tr>");
            }

            // End the table
            Output.WriteLine("  <tr><td bgcolor=\"#e7e7e7\" colspan=\"5\"></td></tr>");
            Output.WriteLine("</table>");

            Output.WriteLine("<br />");
            Output.WriteLine("<br />");
        }
예제 #30
0
        /// <summary> Stream to which to write the HTML for this subwriter  </summary>
        /// <param name="Output"> Response stream for the item viewer to write directly to </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Main_Viewer_Section(TextWriter Output, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Street_ItemViewer.Write_Main_Viewer_Section", "");
            }

            // Build the value
            Map_Streets_DataSet streets = SobekCM_Database.Get_All_Streets_By_Item(CurrentItem.Web.ItemID, Tracer);

            if (streets == null)
            {
                Output.WriteLine("<br />");
                Output.WriteLine("<center><b>UNABLE TO LOAD STREETS FROM DATABASE</b></center>");
                Output.WriteLine("<br />");
                CurrentMode.Mode = Display_Mode_Enum.Contact;
                Output.WriteLine("<center>Click <a href=\"" + CurrentMode.Redirect_URL() + "\">here</a> to report this issue.</center>");
                Output.WriteLine("<br />");
                CurrentMode.Mode = Display_Mode_Enum.Item_Display;
            }
            else
            {
                // Save the current viewer code
                string current_view_code = CurrentMode.ViewerCode;

                // Start the citation table
                Output.WriteLine("\t\t<!-- STREET VIEWER OUTPUT -->");
                Output.WriteLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Streets</b></span></td></tr>");
                Output.WriteLine("\t\t<tr><td class=\"SobekDocumentDisplay\">");
                Output.WriteLine("\t\t\t<div class=\"SobekCitation\">");

                // Get the list of streets from the database
                Create_Street_Index(Output, streets);

                // Finish the citation table
                Output.WriteLine("\t\t\t</div>");
                Output.WriteLine("\t\t</td>");
                Output.WriteLine("\t\t<!-- END STREET VIEWER OUTPUT -->");

                // Restore the mode
                CurrentMode.ViewerCode = current_view_code;
            }
        }