Пример #1
0
        protected void tvwMain_SelectedNodeChanged(object sender, System.EventArgs e)
        {
            TreeViewNodeClickEventArgs args = (TreeViewNodeClickEventArgs)e;

            squishyWARE.WebComponents.squishyTREE.TreeNode node = args.Node;
            ShowByDirectoryID(Int32.Parse(node.Key));
        }
Пример #2
0
        /// <summary>
        /// Recursively adds a collection of directories to the treeview.
        /// </summary>
        /// <param name="directoryLookup">A cache of all the PhotoDirectory objects.</param>
        /// <param name="dirBrowser">A reference to a DirectoryBrowser object.</param>
        /// <param name="dirs">A collection of PhotoDirectory objects.</param>
        /// <param name="parentNode">A reference to the parent tree node object, or null if at the root of the tree view.</param>
        private void addDirectoryNodes(Hashtable directoryLookup, DirectoryBrowser dirBrowser,
                                       PhotoDirectories dirs, squishyWARE.WebComponents.squishyTREE.TreeNode parentNode)
        {
            IEnumerator enumerator = dirs.GetEnumerator();

            while (enumerator.MoveNext())
            {
                PhotoDirectory dir = (PhotoDirectory)enumerator.Current;

                squishyWARE.WebComponents.squishyTREE.TreeNode node;
                if (parentNode == null)
                {
                    node = tvwMain.AddNode(HttpUtility.HtmlEncode(dir.Name), dir.Id.ToString());
                }
                else
                {
                    node = parentNode.AddNode(HttpUtility.HtmlEncode(dir.Name), dir.Id.ToString());
                }

                addDirectoryNodes(directoryLookup, dirBrowser, dir.GetDirectories(), node);

                if (!directoryLookup.Contains(dir.Id))
                {
                    directoryLookup.Add(dir.Id, dir);
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Expands a given treeview node. Recursively walks up the node's parent's
 /// nodes, expanding these as well.
 /// </summary>
 /// <param name="node">The node to expand.</param>
 private void ExpandNode(squishyWARE.WebComponents.squishyTREE.TreeNode node)
 {
     node.IsExpanded = true;
     if (node.ParentNode != null)
     {
         ExpandNode(node.ParentNode);
     }
 }
Пример #4
0
        private void InitPage(HttpRequest request)
        {
            DirectoryBrowser dirBrowser       = (DirectoryBrowser)Session["photo_DirectoryBrowser"];
            PhotoDirectory   CurrentDirectory = (PhotoDirectory)Session["photo_CurrentDirectory"];

            if (dirBrowser == null || request.Params["method"] == null)
            {
//                string photosPath = request.ApplicationPath + Path.DirectorySeparatorChar;
                string mappedPhotosDbPath = request.MapPath("") + "\\photos";
                if (Session["photo_rootpath"] == null)
                {
                    Response.Write("错误的参数,通知管理员此异常现象");
                    Response.End();
                }
                string path = (string)Session["photo_rootpath"];
                dirBrowser = new DirectoryBrowser(mappedPhotosDbPath, path);
            }
            Hashtable directoryLookup = (Hashtable)Session["photo_DirectoryLookup"];

            if (directoryLookup == null)
            {
                directoryLookup = new Hashtable();
            }

            DisplayTreeview(dirBrowser, directoryLookup);
            // expand out the current directory node
            int directoryID = -1;

            if (CurrentDirectory != null)
            {
                directoryID = CurrentDirectory.Id;
            }
            else if (request.Params["directoryID"] != null)
            {
                directoryID = Int32.Parse(request.Params["directoryID"]);
            }
            else
            {
                PhotoObjectBase pd1 = dirBrowser.rootDir.GetByIndex(0);
                directoryID = pd1.Id;
            }
            squishyWARE.WebComponents.squishyTREE.TreeNode node = tvwMain.FindTreeNode(directoryID.ToString());
            ExpandNode(node);

            Session.Add("photo_DirectoryBrowser", dirBrowser);
            Session.Add("photo_DirectoryLookup", directoryLookup);

            // Must be called after DisplayTreeview
            ProcessMethod(request, directoryLookup, directoryID);
        }
Пример #5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            HttpRequest request = Context.Request;

            tvwMain.WindowsLafImageBase = @"PhotoBrowserRes\Treeview\";
            tvwMain.TreeOutputStyle     = TreeOutputStyle.WindowsLookAndFeel;
            tvwMain.NodeDisplayStyle    = NodeDisplayStyle.Standard;

            // We only get a post back if the user is navigating via the treeview control.
            // If we've not got a postback then we need to display correct state of the
            // control.
            if (!IsPostBack)
            {
                DirectoryBrowser dirBrowser = (DirectoryBrowser)Session["DirectoryBrowser"];
                if (dirBrowser == null || request.Params["method"] == null)
                {
                    string photosPath       = request.ApplicationPath + Path.DirectorySeparatorChar;
                    string mappedPhotosPath = request.MapPath(photosPath) + "photos";

                    dirBrowser = new DirectoryBrowser(mappedPhotosPath);
                }

                Hashtable directoryLookup = (Hashtable)Session["DirectoryLookup"];
                if (directoryLookup == null)
                {
                    directoryLookup = new Hashtable();
                }

                DisplayTreeview(dirBrowser, directoryLookup);

                // Must be called after DisplayTreeview
                ProcessMethod(request, directoryLookup);

                // expand out the current directory node
                if (request.Params["directoryID"] != null)
                {
                    int directoryID = Int32.Parse(request.Params["directoryID"]);
                    squishyWARE.WebComponents.squishyTREE.TreeNode node = tvwMain.FindTreeNode(directoryID.ToString());
                    ExpandNode(node);
                }

                Session.Add("DirectoryBrowser", dirBrowser);
                Session.Add("DirectoryLookup", directoryLookup);
            }

            pnlImageNavigationBottom.Visible = DISPLAY_BOTTOM_IMAGE_NAVIGATION;
        }
Пример #6
0
        private void tvwMain_SelectedNodeChanged(object sender, System.EventArgs e)
        {
            pnlComments.Visible = false;

            TreeViewNodeClickEventArgs args = (TreeViewNodeClickEventArgs)e;

            squishyWARE.WebComponents.squishyTREE.TreeNode node = args.Node;

            // Retrieve the relevant PhotoDirectory object from the lookup, keyed on the
            // unique ID
            Hashtable      directoryLookup = (Hashtable)Context.Session["DirectoryLookup"];
            PhotoDirectory dir             = (PhotoDirectory)directoryLookup[Int32.Parse(node.Key)];

            GeneratePhotosTable(dir, 1);

            Session.Add("CurrentDirectory", dir);
        }