private void Write_Single_Row(StringBuilder resultsBldr, iSearch_Title_Result titleRow, int index_in_page, string textRedirectStem, string base_url, bool internal_user) { // Start this row resultsBldr.AppendLine("\t<tr valign=\"top\">"); iSearch_Item_Result itemRow = titleRow.Get_Item(0); string identifier = titleRow.BibID.ToUpper() + "_" + itemRow.VID; // Add the actions as the first column resultsBldr.Append("\t\t<td class=\"SobekFolderActionLink\" width=\"170px\" >( "); resultsBldr.Append("<a title=\"Remove this item from your bookshelf\" href=\"javascript:remove_item( '" + identifier + "' );\">remove</a> | "); resultsBldr.Append("<a title=\"Move this item to a new bookshelf\" href=\"\" name=\"item_move_" + index_in_page + "\" id=\"item_move_" + index_in_page + "\" onclick=\"return move_form_open('item_move_" + index_in_page + "', '" + identifier + "' );\">move</a> | "); resultsBldr.Append("<a title=\"Send this item to a friend\" href=\"\" name=\"item_send_" + index_in_page + "\" id=\"item_send_" + index_in_page + "\" onclick=\"return email_form_open('item_send_" + index_in_page + "', '" + identifier + "' );\">send</a>"); if (internal_user) { resultsBldr.Append(" | <a title=\"Edit this item\" href=\"" + CurrentMode.Base_URL + "my/edit/" + titleRow.BibID + "/" + itemRow.VID + "\" name=\"item_edit_" + index_in_page + "\" id=\"item_edit_" + index_in_page + "\" >edit</a> )</td>\n"); } else { resultsBldr.AppendLine(" ) </td>"); } // Add the check box resultsBldr.AppendLine("\t\t<td><input title=\"Select or unselect this item\" type=\"checkbox\" name=\"item_select_" + index_in_page.ToString() + "\" id=\"item_select_" + index_in_page.ToString() + "\" value=\"" + identifier + "\" /></td>"); string user_notes = titleRow.UserNotes; // Add the title and user notes next resultsBldr.Append("\t\t<td><a href=\"" + base_url + titleRow.BibID + "/" + itemRow.VID + textRedirectStem + "\">" + itemRow.Title); if ((itemRow.Level1_Text.Length > 0) || (itemRow.Level2_Text.Length > 0) || (itemRow.Level3_Text.Length > 0)) { resultsBldr.Append(" ( "); if (itemRow.Level1_Text.Length > 0) resultsBldr.Append(itemRow.Level1_Text); if (itemRow.Level2_Text.Length > 0) resultsBldr.Append(" - " + itemRow.Level2_Text); if (itemRow.Level3_Text.Length > 0) resultsBldr.Append(" - " + itemRow.Level3_Text); resultsBldr.Append(" ) "); } resultsBldr.AppendLine("</a>"); if (!String.IsNullOrEmpty(user_notes)) { resultsBldr.AppendLine("<br />" + user_notes + " <span class=\"SobekFolderActionLink\">( <a href=\"\" onclick=\"return edit_notes_form_open('item_send_" + index_in_page + "', '" + identifier + "','" + user_notes.Replace("\"", "%22").Replace("'", "%27").Replace("=", "%3D").Replace("&", "%26") + "' );\">edit note</a> )</span></td>"); } else { resultsBldr.AppendLine("<br /><span class=\"SobekFolderActionLink\">( <a href=\"\" onclick=\"return edit_notes_form_open('item_send_" + index_in_page + "', '" + identifier + "','' );\" >add note</a> )</span></td>"); } // End this row resultsBldr.AppendLine("\t</tr>"); }
/// <summary> Builds the tree view control for all the issues related to a single result title and /// adds the tree view to the provided place holder </summary> /// <param name="MainPlaceHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the results are being built for display</param> /// <param name="TitleRow"> Title row for this title to be displayed, from the dataset of results </param> /// <param name="CalculatedTextRedirectStem"> Redirect string specifically for textual items, which includes the search terms to pass to the final item viewer </param> /// <param name="BaseURL"> Writer-adjusted base_url ( i.e., may include /l at the end if logged in currently ) </param> /// <param name="CurrentResultRow"> Counter indicates which result number this is within the current page of results </param> /// <remarks> This only adds the root node for the tree. Any further computations and tree-creation are left for the tree node populate event when the user requests any issue information.</remarks> protected void Add_Issue_Tree(PlaceHolder MainPlaceHolder, iSearch_Title_Result TitleRow, int CurrentResultRow, string CalculatedTextRedirectStem, string BaseURL) { // Determine term to use string single_item_term = "item"; string multi_item_term = "items"; string multiple_type_upper = TitleRow.MaterialType.ToUpper(); switch (multiple_type_upper) { case "NEWSPAPER": single_item_term = "issue"; multi_item_term = "issues"; break; case "AERIAL": case "IMAGEAERIAL": single_item_term = "flight line"; multi_item_term = "flight lines"; break; case "IMAGEMAP": case "MAP": single_item_term = "map set"; multi_item_term = "map sets"; break; case "PHOTOGRAPH": single_item_term = "photograph set"; multi_item_term = "photograph sets"; break; case "VIDEO": single_item_term = "video"; multi_item_term = "videos"; break; case "AUDIO": single_item_term = "audio"; multi_item_term = "audios"; break; case "ARTIFACT": single_item_term = "artifact"; multi_item_term = "artifacts"; break; } // Set the actual term string multi_term = multi_item_term; if (TitleRow.Item_Count <= 1) { multi_term = single_item_term; } // Create the root node first TreeNode rootNode = new TreeNode { SelectAction = TreeNodeSelectAction.Expand, Value = CurrentResultRow + "_" + TitleRow.BibID, Text = (TitleRow.GroupTitle.Length < 70) ? TitleRow.GroupTitle + " ( " + TitleRow.Item_Count + " " + multi_term + " )" : TitleRow.GroupTitle.Substring(0, 65) + "... ( " + TitleRow.Item_Count + " " + multi_term + " )" }; // Build the tree view object and tree view nodes now TreeView treeView1 = new TreeView { EnableClientScript = true, PopulateNodesFromClient = true }; treeView1.TreeNodePopulate += treeView1_TreeNodePopulate; rootNode.Expanded = false; rootNode.PopulateOnDemand = true; treeView1.Nodes.Add(rootNode); // Add this tree view to the place holder MainPlaceHolder.Controls.Add(treeView1); }
/// <summary> Builds the tree view control for all the issues related to a single result title and /// adds the tree view to the provided place holder </summary> /// <param name="MainPlaceHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the results are being built for display</param> /// <param name="TitleRow"> Title row for this title to be displayed, from the dataset of results </param> /// <param name="CalculatedTextRedirectStem"> Redirect string specifically for textual items, which includes the search terms to pass to the final item viewer </param> /// <param name="BaseURL"> Writer-adjusted base_url ( i.e., may include /l at the end if logged in currently ) </param> /// <param name="CurrentResultRow"> Counter indicates which result number this is within the current page of results </param> /// <remarks> This only adds the root node for the tree. Any further computations and tree-creation are left for the tree node populate event when the user requests any issue information.</remarks> protected void Add_Issue_Tree( PlaceHolder MainPlaceHolder, iSearch_Title_Result TitleRow, int CurrentResultRow, string CalculatedTextRedirectStem, string BaseURL ) { // Determine term to use string single_item_term = "item"; string multi_item_term = "items"; string multiple_type_upper = TitleRow.MaterialType.ToUpper(); switch (multiple_type_upper) { case "NEWSPAPER": single_item_term = "issue"; multi_item_term = "issues"; break; case "AERIAL": case "IMAGEAERIAL": single_item_term = "flight line"; multi_item_term = "flight lines"; break; case "IMAGEMAP": case "MAP": single_item_term = "map set"; multi_item_term = "map sets"; break; case "PHOTOGRAPH": single_item_term = "photograph set"; multi_item_term = "photograph sets"; break; case "VIDEO": single_item_term = "video"; multi_item_term = "videos"; break; case "AUDIO": single_item_term = "audio"; multi_item_term = "audios"; break; case "ARTIFACT": single_item_term = "artifact"; multi_item_term = "artifacts"; break; } // Set the actual term string multi_term = multi_item_term; if (TitleRow.Item_Count <= 1) multi_term = single_item_term; // Create the root node first TreeNode rootNode = new TreeNode { SelectAction = TreeNodeSelectAction.Expand, Value = CurrentResultRow + "_" + TitleRow.BibID, Text = (TitleRow.GroupTitle.Length < 70) ? TitleRow.GroupTitle + " ( " + TitleRow.Item_Count + " " + multi_term + " )" : TitleRow.GroupTitle.Substring(0, 65) + "... ( " + TitleRow.Item_Count + " " + multi_term + " )" }; // Build the tree view object and tree view nodes now TreeView treeView1 = new TreeView {EnableClientScript = true, PopulateNodesFromClient = true}; treeView1.TreeNodePopulate += treeView1_TreeNodePopulate; rootNode.Expanded = false; rootNode.PopulateOnDemand = true; treeView1.Nodes.Add(rootNode); // Add this tree view to the place holder MainPlaceHolder.Controls.Add(treeView1); }
/// <summary> Event handler loads the nodes on request to the serial hierarchy trees when the user requests them /// by expanding a node </summary> /// <param name="Sender"> TreeView object that fired this event </param> /// <param name="E"> Event arguments includes the tree node which was expanded </param> void treeView1_TreeNodePopulate(object Sender, TreeNodeEventArgs E) { // Determine the index of this result within the entire page of results string resultsIndex = E.Node.Value; string node_value = E.Node.Value; if (E.Node.Value.IndexOf("_") > 0) { resultsIndex = E.Node.Value.Substring(0, E.Node.Value.IndexOf("_")); node_value = node_value.Substring(resultsIndex.Length + 1); } // Get the appropriate title result iSearch_Title_Result titleResult = Paged_Results[Convert.ToInt32(resultsIndex)]; // Is this tree built? if (titleResult.Item_Tree == null) { titleResult.Build_Item_Tree(resultsIndex); } Search_Result_Item_TreeNode retrieved_node = titleResult.Item_Tree.Get_Node_By_Value(node_value); if (retrieved_node == null) { return; } string base_url = CurrentMode.Base_URL; if (CurrentMode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn) { base_url = CurrentMode.Base_URL + "l/"; } foreach (Search_Result_Item_TreeNode childNode in retrieved_node.ChildNodes) { TreeNode childViewNode = new TreeNode { Value = resultsIndex + "_" + childNode.Value, SelectAction = TreeNodeSelectAction.None }; string name = Translator.Get_Translation(childNode.Name, CurrentMode.Language); string tooltip = String.Empty; if (name.Length > 100) { tooltip = name; name = name.Substring(0, 100) + "..."; } if (childNode.Link.Length > 0) { childViewNode.ToolTip = tooltip; childViewNode.Text = "<a href=\"" + base_url + childNode.Link + textRedirectStem + "\">" + name + "</a>"; } else { childViewNode.ToolTip = tooltip; childViewNode.Text = name; } if (childNode.ChildNodes.Count > 0) { childViewNode.PopulateOnDemand = true; } E.Node.ChildNodes.Add(childViewNode); } }