CollapseAll() 공개 메소드

public CollapseAll ( ) : void
리턴 void
        //protected override void RenderFieldForDisplay(System.Web.UI.HtmlTextWriter output)
        //{
        //    string[] valueArray;
        //    List<SPListItem> objNodeCollectionForDisplay = new List<SPListItem>();
        //    string objNodeTitle = string.Empty;
        //    string objLookupColumn = string.Empty;
        //    StringBuilder Query = new StringBuilder();
        //    SPList objTaskList;


        //    objLookupColumn = objTreeViewControlField.ParentLookup;


        //    if (this.ListItemFieldValue != null)
        //    {
        //        objTaskList = SPContext.Current.Web.Lists[objTreeViewControlField.ListName];
        //        if (objTaskList != null)
        //        {

        //            valueArray = this.ListItemFieldValue.ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries);
        //            if (this.ControlMode == SPControlMode.Display)
        //            {
        //                objNodeCollectionForDisplay = CreateNodeCollectionForDisplay(valueArray);
        //            }
        //            List<SPListItem> results = (from SPListItem item in objNodeCollectionForDisplay
        //                                        where (new SPFieldLookupValue(Convert.ToString(item[objTreeViewControlField.ParentLookup])).LookupValue == null)
        //                                        orderby item.ID
        //                                        select item).ToList();

        //            foreach (SPListItem objLstItem in results)
        //            {
        //                CreateTree(objLstItem["Title"].ToString(), null, objNodeCollectionForDisplay, objLstItem[objTreeViewControlField.ValueColumn].ToString());
        //            }
        //            objTreeView.RenderControl(output);

        //        }
        //    }
        //}

        #endregion Overridden RenderFieldForDisplay Method for Display Mode


        #region CreateTree Method

        private void CreateTree(string RootNode, string[] valueArray, List <SPListItem> objNodeCollection, string DisplayValue)
        {
            TreeNode objTreeNode;

            objTreeView.ShowLines = true;

            objTreeNode = new TreeNode(DisplayValue, RootNode);
            objTreeView.Nodes.Add(objTreeNode);
            objTreeNode.SelectAction = TreeNodeSelectAction.None;
            /*******Check for parent node if no child exists Show Checkbox -- Start***************/
            if (this.ControlMode != SPControlMode.Display)
            {
                if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(objTreeNode.Value))
                {
                    objTreeNode.ShowCheckBox = true;
                    objTreeNode.Checked      = true;
                }
                else
                {
                    objTreeNode.ShowCheckBox = true;
                }
            }
            /*******Check for parent node if no child exists Show Checkbox -- End***************/
            TreeNodeCollection objTreenodeColn = GetChildNode(RootNode, valueArray, objNodeCollection);

            foreach (TreeNode childnode in objTreenodeColn)
            {
                objTreeNode.ChildNodes.Add(childnode);
                childnode.SelectAction = TreeNodeSelectAction.None;
                if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(objTreeNode.Value))
                {
                    objTreeNode.ShowCheckBox = true;
                    objTreeNode.Checked      = true;
                }
                else if (this.ControlMode == SPControlMode.Display)
                {
                    objTreeNode.ShowCheckBox = false;
                }
                else
                {
                    objTreeNode.ShowCheckBox = true;
                }
            }

            objExpandValue = objTreeViewControlField.ExpandCollapse.ToString();
            if (objExpandValue.Equals("True"))
            {
                objTreeView.ExpandAll();
            }
            else
            {
                objTreeView.CollapseAll();
            }
        }
예제 #2
0
        /// <summary>
        /// 节点展开
        /// </summary>
        /// <param name="Tree_left">树</param>
        /// <param name="Url">Url</param>
        public void ExplandNode(ref System.Web.UI.WebControls.TreeView Tree_left, string Url)
        {
            TreeNode node = FindNode(ref Tree_left, Url);

            Tree_left.CollapseAll();
            node = FindBootNode(node);
            if (node != null)
            {
                node.ExpandAll();
            }
        }
예제 #3
0
 private void Click_menuweb(object sender, System.EventArgs e)
 {
     System.Web.UI.WebControls.TreeView objtrvmenu = new System.Web.UI.WebControls.TreeView();
     if (sender is System.Web.UI.WebControls.TreeView)
     {
         objtrvmenu = (System.Web.UI.WebControls.TreeView)sender;
         if (objtrvmenu.SelectedNode.NavigateUrl == "")
         {
             objtrvmenu.CollapseAll();
             objtrvmenu.SelectedNode.Expand();
         }
     }
 }
예제 #4
0
 private void UpdateFileSystemTree(TreeView control, bool singleRoot, string rootName)
 {
     string path = RootDir;
     if (Directory.Exists(path))
     {
         control.Nodes.Clear();
         TreeNodeCollection rootNodes;
         if (singleRoot)
         {
             if (Cache[path + rootName] != null)
             {
                 rootNodes = (TreeNodeCollection)Cache[path + rootName];
             }
             else
             {
                 rootNodes = GetFileSystemTree(path);
                 Cache.Insert(path + rootName, rootNodes, null, DateTime.MaxValue, TimeSpan.FromMinutes(10));
             }
             TreeNode root = new TreeNode(rootName);
             foreach (TreeNode tn in rootNodes)
             {
                 root.ChildNodes.Add(tn);
             }
             control.Nodes.Add(root);
         }
         else
         {
             if (Cache[path] != null)
             {
                 rootNodes = (TreeNodeCollection)Cache[path];
             }
             else
             {
                 rootNodes = GetFileSystemTree(path);
                 Cache.Insert(path, rootNodes, null, DateTime.MaxValue, TimeSpan.FromMinutes(10));
             }
             foreach (TreeNode tn in rootNodes)
             {
                 control.Nodes.Add(tn);
             }
         }
         control.CollapseAll();
     }
     else
     {
         FileManagerFooterBlock.InnerText = "Путь " + RequestedPath + " не существует";
     }
 }
        private void Create_TreeView_From_Collections(TreeView treeView1)
        {
            // Save the current home type
            TreeNode rootNode = new TreeNode("Collection Hierarchy") {SelectAction = TreeNodeSelectAction.None};
            treeView1.Nodes.Add(rootNode);

            // Step through each node under this
            SortedList<string, TreeNode> sorted_node_list = new SortedList<string, TreeNode>();
            foreach (Item_Aggregation_Related_Aggregations childAggr in Hierarchy_Object.Children)
            {
                if ((!childAggr.Hidden) && ( childAggr.Active ))
                {
                    // Set the aggregation value, for the redirect URL
                    currentMode.Aggregation = childAggr.Code.ToLower();

                    // Set some default interfaces
                    if (currentMode.Aggregation == "dloc1")
                        currentMode.Skin = "dloc";
                    if (currentMode.Aggregation == "edlg")
                        currentMode.Skin = "edl";

                    // Create this tree node
                    TreeNode childNode = new TreeNode("<a href=\"" + currentMode.Redirect_URL() + "\"><abbr title=\"" + childAggr.Description + "\">" + childAggr.Name + "</abbr></a>");
                    if (currentMode.Internal_User)
                    {
                        childNode.Text = string.Format("<a href=\"{0}\"><abbr title=\"{1}\">{2} ( {3} )</abbr></a>", currentMode.Redirect_URL(), childAggr.Description, childAggr.Name, childAggr.Code);
                    }
                    childNode.SelectAction = TreeNodeSelectAction.None;
                    childNode.NavigateUrl = currentMode.Redirect_URL();

                    // Add to the sorted list
                    if ((childAggr.Name.Length > 4) && (childAggr.Name.IndexOf("The ") == 0 ))
                        sorted_node_list.Add(childAggr.Name.Substring(4).ToUpper(), childNode);
                    else
                        sorted_node_list.Add(childAggr.Name.ToUpper(), childNode);

                    // Check the children nodes recursively
                    add_children_to_tree(childAggr, childNode);

                    currentMode.Skin = String.Empty;
                }
            }

            // Now add the sorted nodes to the tree
            foreach( TreeNode childNode in sorted_node_list.Values )
            {
                rootNode.ChildNodes.Add(childNode);
            }

            currentMode.Aggregation = String.Empty;

            if ((currentMode.Home_Type == Home_Type_Enum.Tree_Expanded) || ( currentMode.Is_Robot ))
            {
                treeView1.ExpandAll();
            }
            else
            {
                treeView1.CollapseAll();
                rootNode.Expand();
            }
        }
		public static void pageLoadNodeExpandAll (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.CollapseAll ();
			tv.Nodes[0].ChildNodes[0].ExpandAll ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
        /// <summary> Adds the main view section to the page turner </summary>
        /// <param name="MainPlaceHolder"> 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 MainPlaceHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("EAD_Container_List_ItemViewer.Add_Main_Viewer_Section", "");
            }

            // Get the metadata module for EADs
            EAD_Info eadInfo = (EAD_Info) CurrentItem.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY);

            // Build any search terms
            List<string> terms = new List<string>();
            if ( !String.IsNullOrWhiteSpace(CurrentMode.Text_Search))
            {
                // Get any search terms
                if (CurrentMode.Text_Search.Trim().Length > 0)
                {
                    string[] splitter = CurrentMode.Text_Search.Replace("\"", "").Split(" ".ToCharArray());
                    terms.AddRange(from thisSplit in splitter where thisSplit.Trim().Length > 0 select thisSplit.Trim());
                }
            }

            // Build the value
            StringBuilder builder = new StringBuilder(15000);
            builder.AppendLine("          <td><div id=\"sbkEad_ViewerTitle\">Container List</div></td>");
            builder.AppendLine("        </tr>");
            builder.AppendLine("        <tr>");
            builder.AppendLine("          <td id=\"sbkEad_MainArea\">");

            // Step through the top level first
            foreach (Container_Info container in eadInfo.Container_Hierarchy.Containers)
            {
                // Add this container title and date information first
                builder.Append("<h2>" + container.Unit_Title);
                if (container.Unit_Date.Length > 0)
                    builder.Append(", " + container.Unit_Date);
                builder.AppendLine("</h2>");

                // Add physical extent, if it exists
                if (container.Extent.Length > 0)
                    builder.AppendLine("<strong>" + container.Extent + "</strong><br />");

                // Add the scope content next
                if (container.Scope_And_Content.Length > 0)
                    builder.AppendLine(container.Scope_And_Content);

                // Add any bioghist next
                if (container.Biographical_History.Length > 0)
                    builder.AppendLine(container.Biographical_History);

                // Are there children to this top container
                if (container.Children.Count > 0)
                {
                    // Dump the current builder into a literal
                    Literal newLiteral = new Literal
                                             { Text = Text_Search_Term_Highlighter.Hightlight_Term_In_HTML( builder.ToString(), terms) };
                    MainPlaceHolder.Controls.Add(newLiteral);

                    // Clear the contents of the builder
                    builder.Remove(0, builder.Length);

                    // Now, add this as a tree
                    TreeView treeView1 = new TreeView
                                             { Width = new Unit(700), NodeWrap = true, EnableClientScript = true, PopulateNodesFromClient = false };

                    // Set some tree view properties
                    treeView1.TreeNodePopulate += treeView1_TreeNodePopulate;

                    // Add each child tree node
                    foreach (Container_Info child in container.Children)
                    {
                        // Add this node
                        TreeNode childNode = new TreeNode(child.Unit_Title) {SelectAction = TreeNodeSelectAction.None};
                        if (child.DAO_Link.Length > 0)
                        {
                            if (child.DAO_Title.Length > 0)
                            {
                                childNode.Text = child.Unit_Title + " &nbsp; <a href=\"" + child.DAO_Link + "\">" + child.DAO_Title + "</a>";
                            }
                            else
                            {
                                childNode.Text = "<a href=\"" + child.DAO_Link + "\">" + child.Unit_Title + "</a>";
                            }
                        }

                        treeView1.Nodes.Add(childNode);

                        // Add the description, if there is one
                        if (child.Scope_And_Content.Length > 0)
                        {
                            TreeNode scopeContentNode = new TreeNode(child.Scope_And_Content)
                                                            {SelectAction = TreeNodeSelectAction.None};
                            childNode.ChildNodes.Add(scopeContentNode);
                        }

                        // Add the grand children
                        if (child.Children_Count > 0)
                        {
                            foreach (Container_Info grandChild in child.Children)
                            {
                                // Add this node
                                TreeNode grandChildNode = new TreeNode(grandChild.Unit_Title)
                                                              {SelectAction = TreeNodeSelectAction.None};
                                if (grandChild.DAO_Link.Length > 0)
                                {
                                    if (grandChild.DAO_Title.Length > 0)
                                    {
                                        grandChildNode.Text = grandChild.Unit_Title + " &nbsp; <a href=\"" + grandChild.DAO_Link + "\">" + grandChild.DAO_Title + "</a>";
                                    }
                                    else
                                    {
                                        grandChildNode.Text = "<a href=\"" + grandChild.DAO_Link + "\">" + grandChild.Unit_Title + "</a>";
                                    }
                                }
                                childNode.ChildNodes.Add(grandChildNode);
                            }
                        }
                    }

                    // Configure the tree view collapsed nodes
                    treeView1.CollapseAll();

                    // Add this tree view to the place holder
                    MainPlaceHolder.Controls.Add(treeView1);
                }

                // Put some spaces for now
                builder.AppendLine("<br /><br />");
            }
            builder.AppendLine("            </div>");
            builder.AppendLine("          </td>");

            // Add the HTML for the image
            Literal mainLiteral = new Literal {Text = builder.ToString()};
            MainPlaceHolder.Controls.Add(mainLiteral);
        }
        /// <summary> Add controls directly to the form in the main control area placeholder </summary>
        /// <param name="MainPlaceHolder"> Main place holder to which all main controls are added </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 MainPlaceHolder, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Folder_Mgmt_MySobekViewer.Add_Controls", String.Empty);

            // If this is submitted items, don't show the folders
            string redirect_url = String.Empty;
            if ( properFolderName != "Submitted Items")
            {
                // Determine the redirect
                RequestSpecificValues.Current_Mode.My_Sobek_SubMode = "XXXXXXXXXXXXXXXXXX";
                Result_Display_Type_Enum currentDisplayType = RequestSpecificValues.Current_Mode.Result_Display_Type;
                RequestSpecificValues.Current_Mode.Result_Display_Type = Result_Display_Type_Enum.Bookshelf;
                redirect_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                RequestSpecificValues.Current_Mode.My_Sobek_SubMode = String.Empty;
                RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Saved_Searches;
                string saved_search_url = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Aggregation;
                RequestSpecificValues.Current_Mode.Aggregation_Type = Aggregation_Type_Enum.Home;
                RequestSpecificValues.Current_Mode.Home_Type = Home_Type_Enum.Personalized;
                RequestSpecificValues.Current_Mode.Aggregation = String.Empty;
                string personalized_home = UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode);
                RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.My_Sobek;
                RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Folder_Management;
                RequestSpecificValues.Current_Mode.My_Sobek_SubMode = properFolderName;
                RequestSpecificValues.Current_Mode.Result_Display_Type = currentDisplayType;

                // Build the tree view object and tree view nodes now
                TreeView treeView1 = new TreeView
                                         {
                                             CssClass = "tree",
                                             EnableClientScript = true,
                                             PopulateNodesFromClient = false,
                                             ShowLines = false
                                         };
                treeView1.NodeStyle.NodeSpacing = new Unit(2);
                treeView1.NodeStyle.CssClass = "TreeNode";

                // Add the root my bookshelves node
                TreeNode rootNode = new TreeNode
                                        {
                                            Text = "&nbsp; <a title=\"Manage my library\" href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", String.Empty) + "\">My Library  (Manage my bookshelves)</a>",
                                            ImageUrl = Static_Resources_Gateway.Bookshelf_Img,
                                            SelectAction = TreeNodeSelectAction.None
                                        };
                treeView1.Nodes.Add(rootNode);

                // Add the personalized home page
                TreeNode homeNode = new TreeNode
                                        {
                                            Text = "&nbsp; <a title=\"View my collections home page\" href=\"" + personalized_home + "\">My Collections Home</a>",
                                            SelectAction = TreeNodeSelectAction.None,
                                            ImageUrl = Static_Resources_Gateway.Home_Folder_Gif
                                        };
                rootNode.ChildNodes.Add(homeNode);

                // Add the saved searches node
                TreeNode savedSearchesNode = new TreeNode
                                                 {
                                                     Text ="&nbsp; <a title=\"View my saved searches\" href=\"" + saved_search_url + "\">My Saved Searches</a>",
                                                     SelectAction = TreeNodeSelectAction.None,
                                                     ImageUrl = Static_Resources_Gateway.Saved_Searches_Img
                                                 };
                rootNode.ChildNodes.Add(savedSearchesNode);

               // StringBuilder literalBuilder = new StringBuilder();
                List<TreeNode> selectedNodes = new List<TreeNode>();
                foreach (User_Folder thisFolder in RequestSpecificValues.Current_User.Folders)
                {
                    if (thisFolder.Folder_Name != "Submitted Items")
                    {
                        TreeNode folderNode = new TreeNode
                                                  { Text ="&nbsp; <a href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">" + thisFolder.Folder_Name + "</a>" };
                        if (thisFolder.Folder_Name == properFolderName)
                        {
                            selectedNodes.Add(folderNode);
                            if (thisFolder.IsPublic)
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Open_Folder_Public_Jpg;
                                folderNode.ImageToolTip = "Public folder";
                            }
                            else
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Open_Folder_Jpg;
                            }
                            folderNode.Text = "&nbsp; <span class=\"Selected_TreeNode_Text\">" + thisFolder.Folder_Name + "</span>";
                            folderNode.SelectAction = TreeNodeSelectAction.None;
                        }
                        else
                        {
                            if (thisFolder.IsPublic)
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Closed_Folder_Public_Jpg;
                                folderNode.ImageToolTip = "Public folder";
                            }
                            else
                            {
                                folderNode.ImageUrl = Static_Resources_Gateway.Closed_Folder_Jpg;
                            }
                            folderNode.Text = "&nbsp; <a href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">" + thisFolder.Folder_Name + "</a>";
                        }
                        rootNode.ChildNodes.Add(folderNode);

                        // Add all the children nodes as well
                        add_children_nodes(folderNode, thisFolder, properFolderName, redirect_url, selectedNodes);
                    }
                }

                // Collapse the treeview
                treeView1.CollapseAll();
                if (selectedNodes.Count > 0)
                {
                    TreeNode selectedNodeExpander = selectedNodes[0];
                    while (selectedNodeExpander.Parent != null)
                    {
                        (selectedNodeExpander.Parent).Expand();
                        selectedNodeExpander = selectedNodeExpander.Parent;
                    }
                }
                else
                {
                    rootNode.Expand();
                }

                MainPlaceHolder.Controls.Add(treeView1);
            }

            if (RequestSpecificValues.Current_Mode.My_Sobek_SubMode.Length > 0)
            {
                if ( RequestSpecificValues.Results_Statistics.Total_Titles == 0)
                {
                    Literal literal = new Literal();

                    string folder_name = RequestSpecificValues.Current_User.Folder_Name(RequestSpecificValues.Current_Mode.My_Sobek_SubMode);
                    RequestSpecificValues.Current_Mode.My_Sobek_SubMode = String.Empty;
                    if (folder_name.Length == 0)
                    {
                        UrlWriterHelper.Redirect(RequestSpecificValues.Current_Mode);
                        return;
                    }

                    if (properFolderName != "Submitted Items")
                        literal.Text = "<br /><br /><h1>" + folder_name + "</h1><br /><br /><div class=\"SobekHomeText\" ><center><b>This bookshelf is currently empty</b></center><br /><br /><br /></div></div>";
                    else
                        literal.Text = "<h1>" + folder_name + "</h1><br /><br /><div class=\"SobekHomeText\" ><center><b>This bookshelf is currently empty</b></center><br /><br /><br /></div></div>";
                    MainPlaceHolder.Controls.Add(literal);

                }
                else
                {

                    writeResult = new PagedResults_HtmlSubwriter(RequestSpecificValues, RequestSpecificValues.Results_Statistics, RequestSpecificValues.Paged_Results)
                                      {
                                          Browse_Title = properFolderName,
                                          Outer_Form_Name = "itemNavForm"
                                      };
                    if (properFolderName != "Submitted Items")
                        writeResult.Include_Bookshelf_View = true;

                    // Add some space and then the view type selection box
                    StringBuilder view_type_selection_builder = new StringBuilder( 2000);
                    if (properFolderName != "Submitted Items")
                        view_type_selection_builder.AppendLine("<br /><br />");

                    StringWriter writer = new StringWriter(view_type_selection_builder);
                    writeResult.Write_HTML(writer, Tracer);

                    Literal view_type_selection_literal = new Literal {Text = view_type_selection_builder.ToString()};
                    MainPlaceHolder.Controls.Add(view_type_selection_literal);

                    // Now, add the results controls as well
                    writeResult.Add_Controls(MainPlaceHolder, Tracer);

                    // Close the div
                    Literal final_literal = new Literal {Text = "<br />\n"};
                    MainPlaceHolder.Controls.Add(final_literal);
                }

                //if (( pagedResults != null ) && ( pagedResults.Count > 0))
                //{
                //	Literal literal = new Literal();
                //	literal.Text = "<div class=\"sbkPrsw_ResultsNavBar\">" + Environment.NewLine + "  " + writeResult.Buttons + Environment.NewLine + "  " + writeResult.Showing_Text + Environment.NewLine + "</div>" + Environment.NewLine + "<br />" + Environment.NewLine;
                //	MainPlaceHolder.Controls.Add(literal);
                //}
            }
            else
            {
                // Add the folder management piece here
                StringBuilder bookshelfManageBuilder = new StringBuilder();
                bookshelfManageBuilder.AppendLine("<br /><br />\n<h1>Manage My Bookshelves</h1>\n<div class=\"SobekHomeText\" >");
                bookshelfManageBuilder.AppendLine("  <blockquote>");
                bookshelfManageBuilder.AppendLine("  <table width=\"630px\">");
                bookshelfManageBuilder.AppendLine("    <tr valign=\"middle\">");
                bookshelfManageBuilder.AppendLine("      <td align=\"left\" width=\"30px\"><a href=\"?\" id=\"new_bookshelf_link\" name=\"new_bookshelf_link\" onclick=\"return open_new_bookshelf_folder();\" title=\"Click to add a new bookshelf\" ><img title=\"Click to add a new bookshelf\" src=\"" + Static_Resources_Gateway.New_Folder_Jpg + "\" /></a><td>");
                bookshelfManageBuilder.AppendLine("      <td align=\"left\"><a href=\"?\" id=\"new_bookshelf_link\" name=\"new_bookshelf_link\" onclick=\"return open_new_bookshelf_folder();\" title=\"Click to add a new bookshelf\" >Add New Bookshelf</a><td>");
                bookshelfManageBuilder.AppendLine("      <td align=\"right\" width=\"40px\"><a href=\"?\" id=\"refresh_bookshelf_link\" name=\"refresh_bookshelf_link\" onclick=\"return refresh_bookshelves();\" title=\"Refresh bookshelf list\" ><img title=\"Refresh bookshelf list\" src=\"" + Static_Resources_Gateway.Refresh_Folder_Jpg + "\" /></a><td>");
                bookshelfManageBuilder.AppendLine("      <td align=\"left\" width=\"150px\"><a href=\"?\" id=\"refresh_bookshelf_link\" name=\"refresh_bookshelf_link\" onclick=\"return refresh_bookshelves();\" title=\"Refresh bookshelf list\" >Refresh Bookshelves</a><td>");
                bookshelfManageBuilder.AppendLine("    </tr>");
                bookshelfManageBuilder.AppendLine("  </table>");
                bookshelfManageBuilder.AppendLine("  <br /><br />");
                bookshelfManageBuilder.AppendLine("  <table border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">");
                bookshelfManageBuilder.AppendLine("    <tr align=\"left\" bgcolor=\"#0022a7\" >");
                bookshelfManageBuilder.AppendLine("      <th width=\"210px\" align=\"left\"><span style=\"color: White\"> &nbsp; ACTIONS</span></th>");
                bookshelfManageBuilder.AppendLine("      <th width=\"40px\" align=\"left\">&nbsp;</th>");
                bookshelfManageBuilder.AppendLine("      <th width=\"380px\" align=\"left\"><span style=\"color: White\">BOOKSHELF NAME</span></th>");
                bookshelfManageBuilder.AppendLine("     </tr>");
                bookshelfManageBuilder.AppendLine("    <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>");

                // Write the data for each interface
                int folder_number = 1;
                foreach ( User_Folder thisFolder in RequestSpecificValues.Current_User.All_Folders )
                {
                    if (thisFolder.Folder_Name != "Submitted Items")
                    {
                        // Build the action links
                        bookshelfManageBuilder.AppendLine("    <tr align=\"left\" valign=\"center\" >");
                        bookshelfManageBuilder.Append("      <td class=\"SobekFolderActionLink\" >( ");
                        if (thisFolder.Child_Count == 0)
                        {
                            if (RequestSpecificValues.Current_User.All_Folders.Count == 1)
                            {
                                bookshelfManageBuilder.Append("<a title=\"Click to delete this bookshelf\" id=\"DELETE_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"alert('You cannot delete your last bookshelf');return false;\">delete</a> | ");
                            }
                            else
                            {
                                bookshelfManageBuilder.Append("<a title=\"Click to delete this bookshelf\" id=\"DELETE_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return delete_folder('" + thisFolder.Folder_ID + "');\">delete</a> | ");
                            }
                        }
                        else
                        {
                            bookshelfManageBuilder.Append("<a title=\"Click to delete this bookshelf\" id=\"DELETE_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"alert('You cannot delete bookshelves which contain other bookshelves');return false;\">delete</a> | ");
                        }
                        if (thisFolder.IsPublic)
                        {
                            bookshelfManageBuilder.Append("<a title=\"Make this bookshelf private\" id=\"PUBLIC_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return change_folder_visibility('" + thisFolder.Folder_Name_Encoded + "', 'private');\">make private</a> | ");
                        }
                        else
                        {
                            bookshelfManageBuilder.Append("<a title=\"Make this bookshelf public\" id=\"PUBLIC_" + folder_number + "\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "l/technical/javascriptrequired\" onclick=\"return change_folder_visibility('" + thisFolder.Folder_Name_Encoded + "', 'public');\">make public</a> | ");
                        }
                        bookshelfManageBuilder.AppendLine("<a title=\"Click to manage this bookshelf\" href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">manage</a> )</td>");
                        if (thisFolder.IsPublic)
                        {
                            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Public_Folder;
                            RequestSpecificValues.Current_Mode.FolderID = thisFolder.Folder_ID;
                            bookshelfManageBuilder.AppendLine("      <td><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\"><img title=\"Public folder\" src=\"" + Static_Resources_Gateway.Closed_Folder_Public_Jpg + "\" /><a/></td>");
                            bookshelfManageBuilder.AppendLine("      <td><a href=\"" + UrlWriterHelper.Redirect_URL(RequestSpecificValues.Current_Mode) + "\">" + thisFolder.Folder_Name + "</a></td>");
                            RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.My_Sobek;
                        }
                        else
                        {
                            bookshelfManageBuilder.AppendLine("      <td><img title=\"Private folder\" src=\"" + Static_Resources_Gateway.Closed_Folder_Jpg + "\" /></td>");
                            bookshelfManageBuilder.AppendLine("      <td>" + thisFolder.Folder_Name + "</td>");
                        }
                        bookshelfManageBuilder.AppendLine("     </tr>");
                        bookshelfManageBuilder.AppendLine("    <tr><td bgcolor=\"#e7e7e7\" colspan=\"3\"></td></tr>");

                        // Increment the folder number
                        folder_number++;
                    }
                }

                bookshelfManageBuilder.AppendLine("  </table>");
                bookshelfManageBuilder.AppendLine("  </blockquote>");
                bookshelfManageBuilder.AppendLine("</div>");

                // Add this as a literal
                Literal mgmtLiteral = new Literal {Text = bookshelfManageBuilder.ToString()};
                MainPlaceHolder.Controls.Add(mgmtLiteral);
            }
        }
예제 #9
0
        protected override void CreateChildControls()
        {
            menuTree = new TreeView();
            menuTree.SelectedNodeStyle.Font.Bold = true;
            foreach (HierarchyRow r in (hierarchyDataset.Tables[0]).Rows)
            {
                if (r.ParentId == null)
                {
                    TreeNode item = new TreeNode(r.Caption, r.Id.ToString());
                    menuTree.Nodes.Add(item);
                    AddSubtreeForItem(r, item);
                }
            }

            //inList.EnableViewState = true;
            //outList.EnableViewState = true;
            panelList.DataSource = panelsTable;
            panelList.DataValueField = "Id";
            panelList.DataTextField = "Name";
            panelList.DataBind();
            panelList.ID = "panelList";
            removeButton.Text = "Remove selected";
            renameButton.Text = "Rename selected";
            addButton.Text = "AddNode";
            bindButton.Text = "Bind To Panel";
            unbindButton.Text = "Unbind Panel";

            menuTree.SelectedNodeChanged += OnSelectedNodeChanged;
            bindButton.Click += OnBindButtonClicked;
            unbindButton.Click += OnUnbindButtonClicked;
            addButton.Click += OnAddButtonClicked;
            removeButton.Click += OnRemoveButtonClicked;
            renameButton.Click += OnRenameButtonClicked;

            panelList.Height = 500;
            menuTree.ShowLines = true;
            menuTree.CollapseAll();
            this.Controls.Clear();
            this.Controls.Add(menuTree);
            this.Controls.Add(panelList);
            this.Controls.Add(bindButton);
            this.Controls.Add(unbindButton);
            this.Controls.Add(newLabelTB);
            this.Controls.Add(addButton);
            this.Controls.Add(removeButton);
            this.Controls.Add(renameButton);
        }
        /// <summary>
        /// Create Tree method in real create the tree based on the parameters.
        /// </summary>
        /// <param name="RootNode"></param>
        /// <param name="valueArray"></param>
        /// <param name="objNodeCollection"></param>
        /// <param name="DisplayValue"></param>
        /// <param name="KeyValue"></param>
        private void CreateTree(string RootNode, string[] valueArray, List <SPListItem> objNodeCollection, string DisplayValue, string KeyValue)
        {
            TreeNode           objTreeNode;
            TreeNodeCollection objChildNodeColn;

            try
            {
                objTreeView.ShowLines = true;
                objTreeNode           = new TreeNode(DisplayValue, KeyValue);
                objTreeView.Nodes.Add(objTreeNode);
                objTreeNode.SelectAction = TreeNodeSelectAction.None;

                //Check for parent node if no child exists Show Checkbox
                //Start
                if (this.ControlMode != SPControlMode.Display)
                {
                    if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(objTreeNode.Value))
                    {
                        objTreeNode.ShowCheckBox = true;
                        objTreeNode.Checked      = true;
                    }
                    else
                    {
                        objTreeNode.ShowCheckBox = true;
                    }
                }
                //End

                objChildNodeColn = GetChildNode(RootNode, valueArray, objNodeCollection);
                foreach (TreeNode childnode in objChildNodeColn)
                {
                    objTreeNode.ChildNodes.Add(childnode);
                    childnode.SelectAction = TreeNodeSelectAction.None;
                    if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(objTreeNode.Value))
                    {
                        objTreeNode.ShowCheckBox = true;
                        objTreeNode.Checked      = true;
                    }
                    else if (this.ControlMode == SPControlMode.Display)
                    {
                        objTreeNode.ShowCheckBox = false;
                    }
                    else
                    {
                        objTreeNode.ShowCheckBox = true;
                    }
                }

                objExpandValue = objTreeViewControlField.ExpandCollapse.ToString();
                if (objExpandValue.Equals(GlobalConstants.VALUE_TRUE))
                {
                    objTreeView.ExpandAll();
                }
                else
                {
                    objTreeView.CollapseAll();
                }
            }
            catch (Exception ex)
            {
                if (string.IsNullOrEmpty(Convert.ToString(ex.InnerException)))
                {
                    throw new Exception(GlobalConstants.ERROR_MESSAGE_TREE_CREATION_FAILED + GlobalConstants.HTML_BR + ex.Message);
                }
                else
                {
                    throw new Exception(Convert.ToString(ex.InnerException));
                }
            }
        }
 //========================================================= remplirTreeview() ============================================================
 private void remplirTreeview(TreeView tree, SPList list, string libelle)
 {
     treeViewList = new List<TreeViewItem>();
     SPQuery myquery = new SPQuery();
     myquery.Query = "";
     SPListItemCollection items = list.GetItems(myquery);
     foreach (SPListItem item in items)
     {
         treeViewList.Add(new TreeViewItem()
         {
             ParentID = item["Service Parent"].ToString(),
             ID = item[libelle].ToString(),
             Text = item[libelle].ToString()
         });
     }
     PopulateTreeView("CASA", null);
     tree.CollapseAll();
 }