Esempio n. 1
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);
        }