Inheritance: TreePanelBase, IAjaxPostBackEventHandler
Esempio n. 1
0
    public void RenderTreePanel(HtmlGenericControl ph)
    {
        // Define Ext.Net.TreePanel object
        Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
        tree.ID            = "CMSMenuTree";
        tree.Width         = Unit.Pixel(350);
        tree.AutoWidth     = true;
        tree.Title         = String.Empty;
        tree.TitleCollapse = true;
        tree.AutoScroll    = true;
        tree.RootVisible   = true;
        tree.Frame         = false;
        tree.Border        = false;

        // Create a root node
        Ext.Net.TreeNode root = new Ext.Net.TreeNode("Root");
        root.Expanded = true;
        root.Icon     = Icon.Folder;

        root.Listeners.Click.Handler = "cms.menu.selectNode({menu_id: 0, page_id: 0, parent_id: 0, sort_order: '0'})";

        tree.Root.Add(root);

        RenderTopMenuNode(root);

        ph.Controls.Add(tree);
    }
Esempio n. 2
0
    public void RenderTreePanel(HtmlGenericControl ph)
    {
        // Define Ext.Net.TreePanel object
        Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
        tree.ID        = "VerticalMenu";
        tree.Width     = Unit.Pixel(250);
        tree.AutoWidth = true;
        //tree.Height = Unit.Pixel(500);
        //tree.AutoHeight = true;
        tree.Title         = String.Empty;
        tree.TitleCollapse = true;
        tree.AutoScroll    = true;
        tree.RootVisible   = false;
        tree.Frame         = false;
        tree.Border        = false;
        tree.BodyCssClass  = "tree-back";

        // Create a root node
        Ext.Net.TreeNode root = new Ext.Net.TreeNode("Root");
        root.Expanded = true;
        tree.Root.Add(root);

        //Render Treatments
        RenderTreatments(root);

        ph.Controls.Add(tree);
    }
Esempio n. 3
0
    /*************************************************************
    *                   EDUCATION TREE MENU
    *************************************************************/

    public void RenderEduTreePanel(HtmlGenericControl ph)
    {
        // Define Ext.Net.TreePanel object
        Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
        tree.ID            = "EduTree";
        tree.Width         = Unit.Pixel(250);
        tree.AutoWidth     = true;
        tree.Title         = String.Empty;
        tree.TitleCollapse = true;
        tree.AutoScroll    = true;
        tree.RootVisible   = false;
        tree.Frame         = false;
        tree.Border        = false;

        // Create a root node
        Ext.Net.TreeNode root = new Ext.Net.TreeNode("Root");
        root.Expanded = true;
        root.Icon     = Icon.Folder;

        tree.Root.Add(root);

        RenderEduTopMenuNode(root);

        ph.Controls.Add(tree);
    }
Esempio n. 4
0
 public override void ModifyTree(TreePanel treePanel, IMainInterface mainInterface)
 {
     treePanel.Listeners.MoveNode.Handler = string.Format(@"
         {0}.showBusy();
         Ext.net.DirectMethods.Move.MoveNode(node.id, newParent.id, index,
         {{
             url: '{1}',
             success: function() {{ {0}.setStatus({{ text: 'Moved item', iconCls: '', clear: true }}); }}
         }})",
         mainInterface.StatusBar.ClientID, Context.AdminManager.GetAdminDefaultUrl());
 }
Esempio n. 5
0
        public override void ModifyTree(TreePanel treePanel, IMainInterface mainInterface)
        {
            treePanel.Listeners.ContextMenu.Handler = string.Format(@"function(node, e)
                {{
                    {0}.selectPath(node.getPath());
                    var contextMenu = new Ext.ux.menu.StoreMenu(
                    {{
                        url: '{1}',
                        baseParams: {{ node: node.id }},
                        width: 'auto'
                    }});

                    contextMenu.showAt(e.getXY());
                }}",
                treePanel.ClientID, Context.Current.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(GetType().Assembly, "Zeus.Admin.Plugins.ContextMenu.ContextMenuLoader.ashx"));
        }
Esempio n. 6
0
        protected override void OnPreLoad(EventArgs e)
        {
            Ext.Net.TreePanel treeGridCapability = (Ext.Net.TreePanel) this.Page.FindControl("TestItemStatusTreeGridPanel");

            Ext.Net.TreeColumn.Config columnCfg = new TreeColumn.Config();
            columnCfg.Text      = "User";
            columnCfg.Width     = 180;
            columnCfg.DataIndex = "name";

            Ext.Net.TreeColumn clmn = new TreeColumn(columnCfg);
            treeGridCapability.ColumnModel.Columns.Add(clmn);

            Ext.Net.Column.Config columnEmployeeBadgeCfg = new Column.Config();
            columnEmployeeBadgeCfg.Text      = "Badge";
            columnEmployeeBadgeCfg.Width     = 90;
            columnEmployeeBadgeCfg.DataIndex = "badgeNumber";

            base.OnPreLoad(e);
        }
Esempio n. 7
0
        public override void ModifyTree(TreePanel treePanel, IMainInterface mainInterface)
        {
            if (!Context.Current.Resolve<GlobalizationSection>().Enabled)
                return;

            // Setup tree bottom toolbar.
            Toolbar bottomToolbar = new Toolbar();
            treePanel.BottomBar.Add(bottomToolbar);

            ToolbarTextItem textItem = new ToolbarTextItem { Text = "Language: " };
            bottomToolbar.Items.Add(textItem);

            IconCombo comboBox = new IconCombo
            {
                EmptyText = "Select...",
                Width = Unit.Pixel(100),
                Editable = false
            };
            comboBox.Listeners.Select.Handler = string.Format(@"
                Ext.net.DirectMethods.LanguageChooser.ChangeLanguage(record.get('value'),
                {{
                    url: '{0}',
                    success: function(result)
                    {{
                        stbStatusBar.setStatus({{ text: 'Changed language', iconCls: '', clear: true }});
                    }}
                }});",
                Context.AdminManager.GetAdminDefaultUrl());

            foreach (Language language in Context.Current.Resolve<ILanguageManager>().GetAvailableLanguages())
            {
                IconComboListItem listItem = new IconComboListItem(language.Title, language.Name, language.IconUrl);
                comboBox.Items.Add(listItem);
                if (language.Name == Context.AdminManager.CurrentAdminLanguageBranch)
                {
                    comboBox.SelectedItem.Text = listItem.Text;
                    comboBox.SelectedItem.Value = listItem.Value;
                }
            }

            bottomToolbar.Items.Add(comboBox);
        }
Esempio n. 8
0
        public void ShowDialog(string title, string subtitle, string affectedItemIDs)
        {
            var window = new Window
            {
                ID = "deleteDialog",
                Modal = true,
                Width = 500,
                Height = 300,
                Title = title,
                Layout = "fit",
                Maximizable = true
            };

            window.Listeners.Maximize.Fn = "function(el) { var v = Ext.getBody().getViewSize(); el.setSize(v.width, v.height); }";
            window.Listeners.Maximize.Scope = "this";

            FormPanel formPanel = new FormPanel
            {
                BaseCls = "x-plain",
                Layout = "absolute"
            };
            window.Items.Add(formPanel);

            formPanel.ContentControls.Add(new Label
            {
                Html = @"<div class=""x-window-dlg""><div class=""ext-mb-warning"" style=""width:32px;height:32px""></div></div>",
                X = 5,
                Y = 5
            });
            formPanel.ContentControls.Add(new Label
            {
                Html = subtitle,
                X = 42,
                Y = 6
            });

            TabPanel tabPanel = new TabPanel
            {
                ID = "deleteDialog_TabPanel",
                X = 0,
                Y = 42,
                Anchor = "100% 100%",
                AutoTabs = true,
                DeferredRender = false,
                Border = false
            };
            formPanel.ContentControls.Add(tabPanel);

            TreePanel affectedItemsTreePanel = new TreePanel
            {
                Title = "Affected Items",
                AutoScroll = true,
                RootVisible = false
            };
            tabPanel.Items.Add(affectedItemsTreePanel);

            TreeLoader treeLoader = new TreeLoader
            {
                DataUrl = Engine.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(typeof(DeleteUserControl).Assembly,
                    "Zeus.Admin.Plugins.DeleteItem.AffectedItems.ashx")
            };
            affectedItemsTreePanel.Loader.Add(treeLoader);

            treeLoader.Listeners.Load.Fn = "function(loader, node) { node.getOwnerTree().expandAll(); }";

            affectedItemsTreePanel.Root.Add(new AsyncTreeNode
            {
                Text = "Root",
                NodeID = affectedItemIDs,
                Expanded = true
            });

            TreePanel referencingItemsTreePanel = new TreePanel
            {
                Title = "Referencing Items",
                TabTip = "Items referencing the item(s) you're deleting",
                AutoScroll = true,
                RootVisible = false
            };
            tabPanel.Items.Add(referencingItemsTreePanel);

            TreeLoader referencingItemsTreeLoader = new TreeLoader
            {
                DataUrl = Engine.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(typeof(DeleteUserControl).Assembly,
                    "Zeus.Admin.Plugins.DeleteItem.ReferencingItems.ashx")
            };
            referencingItemsTreePanel.Loader.Add(referencingItemsTreeLoader);

            referencingItemsTreePanel.Root.Add(new AsyncTreeNode
            {
                Text = "Root",
                NodeID = affectedItemIDs,
                Expanded = true
            });

            Button yesButton = new Button
            {
                ID = "yesButton",
                Text = "Yes"
            };
            yesButton.Listeners.Click.Handler = string.Format(@"
                stbStatusBar.showBusy('Deleting...');
                {0}.hide();
                Ext.net.DirectMethods.Delete.DeleteItems('{1}',
                {{
                    url : '{2}',
                    success: function() {{ stbStatusBar.setStatus({{ text: 'Deleted Item(s)', iconCls: '', clear: true }}); }}
                }});",
                window.ClientID, affectedItemIDs, Engine.AdminManager.GetAdminDefaultUrl());
            window.Buttons.Add(yesButton);

            window.Buttons.Add(new Button
            {
                ID = "noButton",
                Text = "No",
                Handler = string.Format(@"function() {{ {0}.hide(); }}", window.ClientID)
            });

            window.Render(pnlContainer, RenderMode.RenderTo);
        }
Esempio n. 9
0
    private void LoadLeftMenu(bool isCollapsed)
    {
        try
        {
            Ext.Net.Panel westPanel = new Ext.Net.Panel(GlobalResourceManager.GetInstance().GetLanguageValue("MenuChucNang"), Icon.Table);
            westPanel.ID                = "WestPanel";
            westPanel.Width             = 245;
            westPanel.Layout            = "Accordion";
            westPanel.LoadMask.ShowMask = true;
            westPanel.LoadMask.Msg      = GlobalResourceManager.GetInstance().GetLanguageValue("LoadingMask");
            westPanel.Collapsed         = isCollapsed;

            BorderLayout1.West.Items.Add(westPanel);
            BorderLayout1.West.MarginsSummary  = "5 0 0 5";
            BorderLayout1.West.CMarginsSummary = "5 5 0 5";
            BorderLayout1.West.MinWidth        = 245;
            BorderLayout1.West.MaxWidth        = 400;
            BorderLayout1.West.Collapsible     = true;

            Ext.Net.ImageButton btnLogo = new Ext.Net.ImageButton();
            btnLogo.ImageUrl     = "Resource/images/logo.png";
            btnLogo.OverImageUrl = "Resource/images/logoHover.png";
            Toolbar1.Items.Insert(0, btnLogo);

            Ext.Net.Label lblApplication = new Ext.Net.Label();
            lblApplication.Html = "<b style='color:#15428B !important;font-family:verdana !important;'>" + ltrApplicationName.Text.ToUpper() + "</b>";
            Toolbar1.Items.Insert(1, lblApplication);

            List <MenuInfo> MenuPanelList = null;
            if (CurrentUser.IsSuperUser == false)
            {
                MenuPanelList = MenuController.GetInstance().GetMenus(-1, false, true, CurrentUser.ID);
            }
            else
            {
                MenuPanelList = MenuController.GetInstance().GetMenus(-1, false, true);
            }
            westPanel.Items.Clear();
            foreach (MenuInfo panel in MenuPanelList)
            {
                Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
                westPanel.Items.Add(tree);
                tree.RootVisible   = false;
                tree.IconCls       = panel.Icon;
                tree.Title         = panel.MenuName;
                tree.AutoScroll    = true;
                tree.Border        = false;
                tree.ContextMenuID = "Menu4";
                tree.Animate       = true;
                List <MenuInfo> ChildMenu = new List <MenuInfo>();
                if (CurrentUser.IsSuperUser)
                {
                    ChildMenu = MenuController.GetInstance().GetMenus(panel.ID, false, false); //Lấy các tree nằm trong panel
                }
                else
                {
                    ChildMenu = MenuController.GetInstance().GetMenus(panel.ID, false, false, CurrentUser.ID);
                }
                Ext.Net.TreeNode root = new Ext.Net.TreeNode();
                tree.Root.Add(root);
                LoadAllChildMenu(ref root, ChildMenu);
            }
        }
        catch (Exception ex)
        {
            Dialog.ShowError(ex.Message);
        }
    }
Esempio n. 10
0
        /// <summary>
        /// Constructs the online users tree.
        /// </summary>
        private void ConstructOnlineUsersTree()
        {
            var activeOnlineUsers = this.GetActiveUsers();
            var friendsList = this.GetBuddiesList();
            var tree = new TreePanel
            {
                RootVisible = false,
                ID = "OnlineUsersTree",
                ContextMenuID = "OnlineUsersMenu",
            };
            var root = new Node {NodeID = "root", Expanded = true};
            tree.Root.Add(root);
            var friendsNode = new Node { Text = this.Text("FRIENDS", "LIST"), Expanded = true };
            foreach (var friend in friendsList)
            {
                friendsNode.Children.Add(new Node()
                {
                    Text = friend.UserName,
                    Icon =
                        (activeOnlineUsers.Exists(x => x.UserId == friend.UserId))
                            ? Icon.StatusOnline
                            : Icon.StatusOffline,
                    Leaf = true
                });
            }
            if (!friendsList.Any())
            {
                friendsNode.Children.Add(new Node()
                {
                    Text = this.Text("FRIENDS", "NONE"),
                    Icon = Icon.None,
                    Leaf = true,
                });
                this.OnlineUsersMenu.Visible = false;
            }
            root.Children.Add(friendsNode);
            //TODO: Optimize friends list due to performance issue
            //var usersHood = this.GetCore<classes.Core.UserData>().GetUsersHoods(this.PageContext.PageUserID);
            //foreach (var h in usersHood)
            //{
            //    var hoodNode = new Node { Text = h.Name, Expanded = false };
            //    foreach (var u in h.Users.Where(x => x.UserId != this.PageContext.PageUserID))
            //    {
            //        hoodNode.Children.Add(new Node()
            //        {
            //            Text = UserMembershipHelper.GetDisplayNameFromID(u.UserId),
            //            Icon =
            //                (activeOnlineUsers.Exists(x => x.UserId == u.UserId))
            //                    ? Icon.StatusOnline
            //                    : Icon.StatusOffline,
            //            Leaf = true
            //        });
            //    }
            //    root.Children.Add(hoodNode);
            //}
            FriendWindow = new Window
            {
                ID = "friendsWindow",
                AutoRender = false,
                Hidden = true,
                Width = Unit.Pixel(250),
                Height = Unit.Pixel(400),
                Maximizable = false,
                BodyBorder = 0,
                Layout = "Accordion"
            };

            this.FriendWindow.Items.Add(tree);
            this.FriendsAspPlaceHolder.Controls.Add(this.FriendWindow);
        }
Esempio n. 11
0
 private void InitTreePanel(TreePanel treePanel, TreeStore treeStore, Model model)
 {
     treePanel.RootVisible = false;
     treePanel.AutoDataBind = true;
     Ext.Net.Parameter parameters = new Ext.Net.Parameter
     {
         Name = "id",
         Value = "record.data.id",
         Mode = ParameterMode.Raw
     };
     treePanel.DirectEvents.ItemDblClick.ExtraParams.Add(parameters);
     treePanel.DirectEvents.ItemDblClick.EventMask.ShowMask = true;
     treePanel.DirectEvents.ItemDblClick.EventMask.Msg = "正在添加";
     treeStore.AutoDataBind = true;
     treeStore.AutoLoad = true;
     model.Fields.Add(new ModelField("Id", ModelFieldType.Int));
     model.Fields.Add(new ModelField("Name", ModelFieldType.String));
     treeStore.Model.Add(model);
     treeStore.Proxy.Add(new PageProxy());
     treePanel.Store.Add(treeStore);
     Ext.Net.Node item = new Ext.Net.Node
     {
         NodeID = "0",
         Text = "根",
         Expanded = true
     };
     treeStore.Root.Add(item);
     Add(treePanel);
 }
Esempio n. 12
0
        // public event TreeStoreBase.ReadDataEventHandler RightReadData;

        //private void _treePanelLeft_Submit(object sender, SubmitEventArgs e)
        //{
        //    List<SubmittedNode> children = e.RootNode.Children;
        //    foreach (SubmittedNode node in children)
        //    {
        //        Ext.Net.Node node2 = new Ext.Net.Node
        //        {
        //            NodeID = node.NodeID,
        //            Text = node.Text,
        //            Leaf = true
        //        };
        //        this._treePanelRight.GetRootNode().InsertChild(0, node2);
        //        this._treePanelLeft.GetNodeById(node.NodeID).Remove();
        //        this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID));
        //    }
        //}

        //private void _treePanelRight_Submit(object sender, SubmitEventArgs e)
        //{
        //    List<SubmittedNode> children = e.RootNode.Children;
        //    foreach (SubmittedNode node in children)
        //    {
        //        Ext.Net.Node node2 = new Ext.Net.Node
        //        {
        //            NodeID = node.NodeID,
        //            Text = node.Text,
        //            Leaf = true
        //        };
        //        this._treePanelLeft.GetRootNode().InsertChild(0, node2);
        //        this._treePanelRight.GetNodeById(node.NodeID).Remove();
        //        this._selectedIds.Remove(ConvertHelper.ToInt32(node.NodeID));
        //    }
        //}

        //private void _treeStoreLeft_ReadData(object sender, NodeLoadEventArgs e)
        //{
        //    if (this.LeftReadData != null)
        //    {
        //        this.LeftReadData(sender, e);
        //    }
        //}

        //private void _treeStoreRight_ReadData(object sender, NodeLoadEventArgs e)
        //{
        //    if (this.RightReadData != null)
        //    {
        //        this.RightReadData(sender, e);
        //        foreach (Ext.Net.Node node in e.Nodes)
        //        {
        //            this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID));
        //        }
        //    }
        //}

        //public void AddSelected()
        //{
        //    MoveNode(this._treePanelLeft, this._treePanelRight);
        //}

        //private void btnAddSelected_DirectClick(object sender, DirectEventArgs e)
        //{
        //    this.MoveNode(this._treePanelLeft, this._treePanelRight);
        //}

        //private void btnRemoveSelected_DirectClick(object sender, DirectEventArgs e)
        //{
        //    this.MoveNode(this._treePanelRight, this._treePanelLeft);
        //}

        /// <summary>
        /// 获取已选择的记录
        /// </summary>
        /// <returns></returns>
        //public int[] GetSelected(bool clearCahce = true)
        //{
        //    int[] numArray = this._selectedIds.ToArray();
        //    if (clearCahce)
        //    {
        //        this.Context.Cache.Remove("_selectedIds");
        //    }
        //    return numArray;
        //}

        private void InitTreePanel(TreePanel treePanel, TreeStore treeStore, Model model)
        {
            treePanel.RootVisible = false;
            treePanel.AutoDataBind = true;
            Ext.Net.Parameter parameters = new Ext.Net.Parameter
            {
                Name = "id",
                Value = "record.data.id",
                Mode = ParameterMode.Raw
            };
            var view = new Ext.Net.TreeView();
            view.Plugins.Add(new TreeViewDragDrop()
            {
                AppendOnly = true
            });
            treePanel.View.Add(view);
            //treePanel.DirectEvents.ItemDblClick.ExtraParams.Add(parameters);
            //treePanel.DirectEvents.ItemDblClick.EventMask.ShowMask = true;
            //treePanel.DirectEvents.ItemDblClick.EventMask.Msg = "正在添加";
            treeStore.AutoDataBind = true;
            treeStore.AutoLoad = true;
            model.Fields.Add(new ModelField("Id", ModelFieldType.Int));
            model.Fields.Add(new ModelField("Name", ModelFieldType.String));
            treeStore.Model.Add(model);
            treePanel.Store.Add(treeStore);
            Ext.Net.Node item = new Ext.Net.Node
            {
                NodeID = "0",
                Text = "根"
            };
            treeStore.Root.Add(item);
            Add(treePanel);
        }
Esempio n. 13
0
        //private void LeftItemDblClick_Event(object sender, DirectEventArgs e)
        //{
        //    this.MoveNode(this._treePanelLeft, this._treePanelRight);
        //}

        //private void MoveNode(TreePanel source, TreePanel target)
        //{
        //    List<SubmittedNode> selectedNodes = source.SelectedNodes;
        //    if (selectedNodes != null)
        //    {
        //        if (NodesAdding != null)
        //        {
        //            var nodeIds = selectedNodes.Select(x => Convert.ToInt32(x.NodeID));
        //            var args = new NodesAddEventArgs();
        //            args.NodeIds.AddRange(nodeIds);
        //            NodesAdding(this, args);
        //            if (args.CancelAdd)
        //            {
        //                Ext.Net.X.Msg.Alert("提示", args.ErrorMessage).Show();
        //                return;
        //            }
        //        }
        //        foreach (SubmittedNode node in selectedNodes)
        //        {
        //            target.GetRootNode().InsertChild(0, node.ToProxyNode());
        //            source.GetNodeById(node.NodeID).Remove();
        //            if (target.ID.Contains("Right"))
        //            {
        //                //增加
        //                this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID));
        //            }
        //            else
        //            {
        //                this._selectedIds.Remove(ConvertHelper.ToInt32(node.NodeID));
        //            }
        //        }
        //    }
        //}

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            var addNodes = "function(){var nodes=App." + leftPanelId + ".getSelectionModel().getSelection();App." + rightPanelId + ".getRootNode().appendChild(nodes);App." + leftPanelId + ".getRootNode().removeChild(nodes);}";
            var removeNodes = "function(){var nodes=App." + rightPanelId + ".getSelectionModel().getSelection();App." + leftPanelId + ".getRootNode().appendChild(nodes);App." + rightPanelId + ".getRootNode().removeChild(nodes);}";
            this._selectedIds = (List<int>)this.Context.Cache["_selectedIds"];
            if (this._selectedIds == null)
            {
                this._selectedIds = new List<int>();
                this.Context.Cache["_selectedIds"] = this._selectedIds;
            }
            this.Layout = "hbox";
            HBoxLayoutConfig item = new HBoxLayoutConfig
            {
                Align = HBoxAlign.Middle,
                DefaultMargins = "0"
            };

            this.LayoutConfig.Add(item);
            this._treePanelLeft = new TreePanel();
            this._treePanelLeft.ID = leftPanelId;
            //_treePanelLeft.DirectEvents.ItemDblClick.Url = LeftItemDblClickUrl;
            //this._treePanelLeft.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.LeftItemDblClick_Event);
            // this._treePanelLeft.SubmitUrl = LeftSubmitUrl;// += new TreePanel.SubmitEventHandler(this._treePanelLeft_Submit);
            //this._treePanelLeft.DirectEvents.Submit.EventMask.Set("正在添加");
            this._treePanelLeft.Title = "可添加";
            _treePanelLeft.MultiSelect = EnableBatchAdd;
            this._treePanelLeft.Height = this.Height;
            double width = (this.Width.Value - 75.0) / 2.0;
            this._treePanelLeft.Width = new Unit(width);
            this._treeStoreLeft = new TreeStore();
            //var ajaxProxy = new AjaxProxy();
            //ajaxProxy.ActionMethods.Read = HttpMethod.POST;
            //ajaxProxy.Reader.Add(new JsonReader());
            //ajaxProxy.Url = LeftReadUrl;
            this._treeStoreLeft.Proxy.Add(LeftReadProxy);// += new TreeStoreBase.ReadDataEventHandler(this._treeStoreLeft_ReadData);
            this._treeModelLeft = new Model();
            this.InitTreePanel(this._treePanelLeft, this._treeStoreLeft, this._treeModelLeft);
            Ext.Net.Panel component = new Ext.Net.Panel
            {
                Width = 75,
                ButtonAlign = Alignment.Center,
                Layout = "vbox"
            };
            if (!Ext.Net.X.IsAjaxRequest)
            {
                component.Border = false;
            }
            var buttons = new List<Ext.Net.Button>();
            if (EnableBatchAdd)
            {
                Ext.Net.Button button = new Ext.Net.Button
                {
                    Text = "全部添加 >>",
                    TextAlign = ButtonTextAlign.Center
                };
                button.Listeners.Click.Handler = "function(){var nodes=Ext.Array.clone(App." + leftPanelId + ".getRootNode().childNodes);App." + leftPanelId + ".getRootNode().removeAll(false);App." + rightPanelId + ".getRootNode().appendChild(nodes);}";
                buttons.Add(button);
            }
            Ext.Net.Button btnAdd = new Ext.Net.Button
            {
                Text = "添  加 > ",
                TextAlign = ButtonTextAlign.Center
            };
            buttons.Add(btnAdd);
            //btnAdd.DirectClickUrl = AddUrl;
            //btnAdd.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnAddSelected_DirectClick);
            //btnAdd.DirectEvents.Click.EventMask.Set("正在添加"); 
            this._treePanelRight = new TreePanel();
            this._treePanelRight.ID = rightPanelId;
            this._treePanelRight.Title = "已添加";
            //_treePanelRight.SubmitUrl = RightSubmitUrl;
            //this._treePanelRight.DirectEvents.Submit.EventMask.Set("正在移除");
            //this._treePanelRight.Submit += new TreePanel.SubmitEventHandler(this._treePanelRight_Submit);
            _treePanelRight.MultiSelect = EnableBatchRemove;
            this._treePanelRight.Height = this.Height;
            _treePanelRight.Listeners.ItemDblClick.Fn = removeNodes;
            //this._treePanelRight.DirectEvents.ItemDblClick.Url = RightItemDblClick;//.Event += new ComponentDirectEvent.DirectEventHandler(this.RightItemDblClick_Event);
            this._treePanelRight.Width = new Unit(width);
            this._treeStoreRight = new TreeStore();
            _treeStoreRight.Proxy.Add(RightReadProxy);
            //this._treeStoreRight.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreRight_ReadData);
            this._treeModelRight = new Model();
            if (EnableBatchRemove)
            {
                Ext.Net.Button btnRemoveAll = new Ext.Net.Button
                {
                    Text = "<< 全部移除",
                    TextAlign = ButtonTextAlign.Center
                };
                btnRemoveAll.Listeners.Click.Handler = "function(){var nodes=Ext.Array.clone(App." + rightPanelId + ".getRootNode().childNodes);App." + leftPanelId + ".getRootNode().removeAll(false);App." + leftPanelId + ".getRootNode().appendChild(nodes);}";
                buttons.Add(btnRemoveAll);
            }
            Ext.Net.Button btnRemove = new Ext.Net.Button
            {
                Text = "< 移  除",
                TextAlign = ButtonTextAlign.Center
            };
            buttons.Add(btnRemove);
            btnAdd.Handler = addNodes;
            _treePanelLeft.Listeners.ItemDblClick.Fn = addNodes;
            btnRemove.Listeners.Click.Fn = removeNodes;
            //btnRemove.DirectClickUrl = RemoveRightUrl;// += new ComponentDirectEvent.DirectEventHandler(this.btnRemoveSelected_DirectClick);
            //btnRemove.DirectEvents.Click.EventMask.Set("正在移除");
            component.Add(buttons.ToArray());
            this.Add(component);
            this.InitTreePanel(this._treePanelRight, this._treeStoreRight, this._treeModelRight);
        }
Esempio n. 14
0
 private void MoveNode(TreePanel source, TreePanel target)
 {
     List<SubmittedNode> selectedNodes = source.SelectedNodes;
     if (selectedNodes != null)
     {
         if (NodesAdding != null)
         {
             var nodeIds = selectedNodes.Select(x => Convert.ToInt32(x.NodeID));
             var args = new NodesAddEventArgs();
             args.NodeIds.AddRange(nodeIds);
             NodesAdding(this, args);
             if (args.CancelAdd)
             {
                 Ext.Net.X.Msg.Alert("提示", args.ErrorMessage).Show();
                 return;
             }
         }
         foreach (SubmittedNode node in selectedNodes)
         {
             target.GetRootNode().InsertChild(0, node.ToProxyNode());
             source.GetNodeById(node.NodeID).Remove();
             if (target.ID.Contains("Right"))
             {
                 //增加
                 this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID));
             }
             else
             {
                 this._selectedIds.Remove(ConvertHelper.ToInt32(node.NodeID));
             }
         }
     }
 }
Esempio n. 15
0
        public override void ModifyInterface(IMainInterface mainInterface)
        {
            // Add tree.
            TreePanel treePanel = new TreePanel
            {
                ID = "stpNavigation",
                Width = 200,
                Icon = Icon.SitemapColor,
                Title = "Site",
                AutoScroll = true,
                PathSeparator = "|",
                EnableDD = true,
                UseArrows = true,
                BodyStyle = "padding-top:5px",
                Region = Region.West,
                MinWidth = 175,
                MaxWidth = 400,
                Split = true,
                CollapseFirst = false
            };
            mainInterface.Viewport.Items.Add(treePanel);

            // Setup tree top toolbar.
            Toolbar topToolbar = new Toolbar();
            treePanel.TopBar.Add(topToolbar);

            TriggerField filterField = new TriggerField
            {
                EnableKeyEvents = true,
                Width = 100,
                EmptyText = "Filter..."
            };
            filterField.Triggers.Add(new FieldTrigger
            {
                Icon = TriggerIcon.Clear,
                HideTrigger = true
            });
            filterField.Listeners.KeyUp.Fn = "keyUp";
            filterField.Listeners.KeyUp.Buffer = 100;
            filterField.Listeners.TriggerClick.Fn = "clearFilter";
            topToolbar.Items.Add(filterField);

            topToolbar.Items.Add(new ToolbarFill());

            Button refreshButton = new Button { Icon = Icon.Reload };
            refreshButton.ToolTips.Add(new ToolTip { Html = "Refresh" });
            refreshButton.Listeners.Click.Handler = string.Format("{0}.getLoader().load({0}.getRootNode());", treePanel.ClientID);
            topToolbar.Items.Add(refreshButton);

            Button expandAllButton = new Button { IconCls = "icon-expand-all" };
            expandAllButton.ToolTips.Add(new ToolTip { Html = "Expand All" });
            expandAllButton.Listeners.Click.Handler = string.Format("{0}.expandAll();", treePanel.ClientID);
            topToolbar.Items.Add(expandAllButton);

            Button collapseAllButton = new Button { IconCls = "icon-collapse-all" };
            collapseAllButton.ToolTips.Add(new ToolTip { Html = "Collapse All" });
            collapseAllButton.Listeners.Click.Handler = string.Format("{0}.collapseAll();", treePanel.ClientID);
            topToolbar.Items.Add(collapseAllButton);

            topToolbar.Items.Add(new ToolbarSeparator());

            Window helpWindow = new Window
                {
                    Modal = true,
                    Icon = Icon.Help,
                    Title = "Help",
                    Hidden = true,
                    Html = "This is the site tree. You can use this to view all the pages on your site. Right-click any item to edit or delete it, as well as create additional pages.<br /><br />The main branches of the root node tree are the main sections of the admin system. Each section is broken down into smaller sections, accessed by expanding the + sign. (Wherever you see a + sign, the section can be broken down into further sections).<br /><br />When you receive your admin system, you will notice the first main section (after the Root Node) will be divided into the main sections of your website. (Example sections may include: Homepage, About Us, News, Links and Contact pages.) To see these pages, as they appear on the website, simply click the relevant node – it will then appear in the right hand pane.",
                    BodyStyle = "padding:5px",
                    Width = 300,
                    Height = 200,
                    AutoScroll = true
                };
            mainInterface.AddControl(helpWindow);

            Button helpButton = new Button();
            helpButton.Icon = Icon.Help;
            helpButton.ToolTips.Add(new ToolTip { Html = "Help" });
            helpButton.Listeners.Click.Handler = string.Format("{0}.show();", helpWindow.ClientID);
            topToolbar.Items.Add(helpButton);

            // Data loader.
            var treeLoader = new Ext.Net.TreeLoader
                {
                    DataUrl = Context.Current.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(GetType().Assembly,
                        "Zeus.Admin.Plugins.Tree.TreeLoader.ashx"),
                    PreloadChildren = true
                };
            treeLoader.Listeners.Load.Handler = "if (response.getResponseHeader['Content-Type'] == 'text/html; charset=utf-8') { Ext.Msg.alert('Timeout', 'Your session has timed out. Please refresh your browser to login again.'); }";
            treePanel.Loader.Add(treeLoader);

            // Call tree modification plugins and load tree plugin user controls.
            foreach (ITreePlugin treePlugin in Context.Current.ResolveAll<ITreePlugin>())
            {
                string[] requiredUserControls = treePlugin.RequiredUserControls;
                if (requiredUserControls != null)
                    mainInterface.LoadUserControls(requiredUserControls);

                treePlugin.ModifyTree(treePanel, mainInterface);
            }

            if (!ExtNet.IsAjaxRequest)
            {
                TreeNodeBase treeNode = SiteTree.Between(Find.StartPage, Find.RootItem, true)
                    .OpenTo(Find.StartPage)
                    .Filter(items => items.Authorized(Context.Current.WebContext.User, Context.SecurityManager, Operations.Read))
                    .ToTreeNode(true);
                treePanel.Root.Add(treeNode);
            }
        }
Esempio n. 16
0
        public void OpenZonesPanel(int id)
        {
            ContentItem contentItem = Engine.Persister.Get(id);

            TreePanel treePanel = new TreePanel
            {
                ID = "trpManageZones",
                Icon = Icon.ApplicationSideBoxes,
                Title = contentItem.Title + " Zones",
                Region = Region.East,
                AutoScroll = true,
                UseArrows = true,
                RootVisible = false,
                BodyStyle="padding-top:5px",
                Split = true,
                MinWidth = 150,
                Width = 175,
                MaxWidth = 300,
                Collapsible = true,
                CloseAction = CloseAction.Close,
                EnableDD = true
            };

            IMainInterface mainInterface = (IMainInterface) Page;
            mainInterface.Viewport.Items.Add(treePanel);

            treePanel.Tools.Add(new Tool(ToolType.Close, "panel.hide(); " + mainInterface.Viewport.ClientID + ".doLayout();", string.Empty));

            // Setup tree top toolbar.
            var topToolbar = new Toolbar();
            treePanel.TopBar.Add(topToolbar);

            var addButton = new Button
            {
                ID = "addButton",
                Icon = Icon.Add,
                Disabled = true
            };
            addButton.ToolTips.Add(new ToolTip { Html = "Add New Widget" });
            addButton.Listeners.Click.Fn = "function(button) { top.zeus.reloadContentPanel('New Widget', " + treePanel.ClientID + ".getSelectionModel().getSelectedNode().attributes['newItemUrl']); }";
            topToolbar.Items.Add(addButton);

            treePanel.Listeners.Click.Handler = "Ext.getCmp('" + addButton.ClientID + "').setDisabled(node.isLeaf());";

            if (Engine.SecurityManager.IsAuthorized(contentItem, Context.User, Operations.Delete))
            {
                var deleteButton = new Button
                {
                    ID = "deleteButton",
                    Icon = Icon.Delete,
                    Disabled = true
                };
                deleteButton.ToolTips.Add(new ToolTip { Html = "Delete Widget" });
                deleteButton.Listeners.Click.Fn = string.Format(@"
                    function(button)
                    {{
                        var node = {0}.getSelectionModel().getSelectedNode();
                        stbStatusBar.showBusy('Deleting...');
                        Ext.net.DirectMethods.ManageZones.DeleteWidget(node.id,
                        {{
                            url : '{1}',
                            success: function()
                            {{
                                node.parentNode.removeChild(node);
                                stbStatusBar.setStatus({{ text: 'Deleted Widget', iconCls: '', clear: true }});
                                top.zeus.reloadContentPanel('Preview', '{2}');
                            }}
                        }});
                    }}",
                    treePanel.ClientID,
                    Engine.AdminManager.GetAdminDefaultUrl(),
                    contentItem.Url);
                topToolbar.Items.Add(deleteButton);

                treePanel.Listeners.Click.Handler += "Ext.getCmp('" + deleteButton.ClientID + "').setDisabled(!node.isLeaf());";
            }

            treePanel.Listeners.MoveNode.Handler = string.Format(@"
                {0}.showBusy();
                Ext.net.DirectMethods.ManageZones.MoveWidget(node.id, newParent.id, index,
                {{
                    url: '{1}',
                    success: function() {{ {0}.setStatus({{ text: 'Moved Widget', iconCls: '', clear: true }}); }}
                }})",
                mainInterface.StatusBar.ClientID,
                Engine.AdminManager.GetAdminDefaultUrl());

            ContentType definition = Zeus.Context.ContentTypes.GetContentType(contentItem.GetType());

            var rootNode = new TreeNode { Expanded = true };
            foreach (var availableZone in definition.AvailableZones)
            {
                var zoneNode = new TreeNode
                {
                    NodeID = availableZone.ZoneName,
                    Expanded = true,
                    IconFile = Utility.GetCooliteIconUrl(Icon.ApplicationSideList),
                    Text = availableZone.Title,
                    Leaf = false
                };
                zoneNode.CustomAttributes.Add(new ConfigItem("newItemUrl",
                    GetPageUrl(typeof(ManageZonesUserControl), "Zeus.Admin.Plugins.NewItem.Default.aspx") + "?selected=" + contentItem.Path + "&zoneName=" + availableZone.ZoneName,
                    ParameterMode.Value));
                rootNode.Nodes.Add(zoneNode);

                foreach (var widget in GetItemsInZone(contentItem, availableZone))
                {
                    var widgetNode = new TreeNode
                    {
                        NodeID = widget.ID.ToString(),
                        Leaf = true,
                        Text = widget.Title,
                        IconFile = widget.IconUrl,
                        Href = string.Format("javascript: top.zeus.reloadContentPanel('Edit', '{0}');",
                            GetPageUrl(typeof(ManageZonesUserControl), "Zeus.Admin.Plugins.EditItem.Default.aspx") + "?selected=" + widget.Path)
                    };
                    zoneNode.Nodes.Add(widgetNode);
                }
            }
            treePanel.Root.Add(rootNode);

            treePanel.Render();
        }
Esempio n. 17
0
        public override void RenderView(System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer)
        {
            writer.Write("<!DOCTYPE html>");
            writer.Write("<head>");
            writer.Write("<title>后台管理中心 - " + AppConfig.WebTitle + "</title>");
            writer.Write("</head><body></body>");
            var x = Html.X();
            writer.Write(x.ResourceManager().ToHtmlString());
            #region 总体布局
            var viewPort = new Viewport();
            viewPort.Layout = "border";
            var _copyright = new Panel();
            _copyright.Title = AppConfig.WebName + " 版权所有";
            _copyright.TitleAlign = TitleAlign.Center;
            _copyright.Collapsible = false;
            _copyright.Region = Region.South;
            _copyright.Split = true;
            var _menu = new Panel();
            _menu.Title = "导航菜单";
            _menu.Collapsible = true;
            _menu.Region = Region.West;
            _menu.Split = true;
            _menu.Width = 200;
            var _workArea = new Ext.Net.TabPanel();
            _workArea.Title = "欢迎使用";
            _workArea.Region = Region.Center;
            _workArea.ID = "tabWork";
            var _title = new Panel();
            _title.Title = AppConfig.WebTitle;
            _title.Collapsible = false;
            _title.Region = Region.North;
            _title.Split = true;
            viewPort.Items.Add(_title);
            viewPort.Items.Add(_workArea);
            viewPort.Items.Add(_copyright);
            viewPort.Items.Add(_menu);
            #endregion

            #region 个人区
            var _personPanel = new Ext.Net.Panel();
            _personPanel.Collapsed = true;
            _personPanel.Collapsible = true;
            _personPanel.Title = "欢迎使用";
            _personPanel.Height = 110;
            _personPanel.BodyPadding = 10;
            _personPanel.Layout = "table";
            _personPanel.LayoutConfig.Add(new TableLayoutConfig()
            {
                Columns = 2
            });
            Image avatarImg = new Image();
            avatarImg.RowSpan = 2;
            avatarImg.Width = avatarImg.Height = 70;
            //avatarImg.ImageUrl = BaseResource.avatar;
            _personPanel.Add(avatarImg);
            _personPanel.Add(new Label(UserInfo.Username));

            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.Width = 80;
            buttonGroup.Layout = "vbox";
            buttonGroup.Add(new Button()
            {
                Icon= Ext.Net.Icon.Key,
                Text = "修改密码",
                ID = "btnChangePassword",
                OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();"
            });

            var btnExit = new Button()
            {
                Text = "安全退出",
                ID = "btnExit",
                Icon = Icon.KeyDelete
            };

            buttonGroup.Add(btnExit);
            _personPanel.Add(buttonGroup);
            _menu.Add(_personPanel);
            var winChangePassword = new Window()
            {
                Icon = Icon.Key,
                BodyPadding = 10,
                Width = 300,
                Height = 210,
                Modal = true,
                Hidden = true,
                AutoShow = false,
                ID = "winChangePassword",
                Title = "修改密码",
                Loader = new ComponentLoader()
                {
                    Url = Url.Action("changePassword", "account"),
                    Mode = LoadMode.Frame
                }
            };
            #endregion

            var _menuPanel = new TreePanel()
            {
                Title = "功能菜单",
                Height = 500,
                RootVisible = false,
                ID = "mainMenu"
            };

            var _menuStore = new TreeStore()
             {
                 NodeParam = "parentId"
             };
            _menuStore.Proxy.Add(x.AjaxProxy().Url(Url.Action("GetMenus")).ActionMethods(y => y.Read = HttpMethod.POST));
            //_menuStore.ReadData += _menuStore_ReadData;
            _menuPanel.Store.Add(_menuStore);
            _menuPanel.Root.Add(new Node()
            {
                NodeID = "0",
                Text = "Root",
                Expanded = true
            });
            _menu.Add(_menuPanel);
            var itemClick = _menuPanel.DirectEvents.ItemClick;
            itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.menuid);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.menuid).isLeaf();";
            itemClick.Url = Url.Action("OpenPage");
            itemClick.ExtraParams.Add(new Parameter("menuid", "record.data.id", ParameterMode.Raw));
            writer.Write(viewPort.ToBuilder().ToHtmlString());
        }
Esempio n. 18
0
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);

            #region 总体布局
            _viewPort = new Viewport();
            _viewPort.Layout = "border";
            _copyright = new Panel();
            _copyright.Title = "版权";
            _copyright.TitleAlign = TitleAlign.Center;
            _copyright.Collapsible = false;
            _copyright.Region = Region.South;
            _copyright.Split = true;
            _menu = new Panel();
            _menu.Title = "导航菜单";
            _menu.Collapsible = true;
            _menu.Region = Region.West;
            _menu.Split = true;
            _menu.Width = 200;
            _workArea = new Ext.Net.TabPanel();
            _workArea.Title = "欢迎使用";
            _workArea.Region = Region.Center;
            _workArea.ID = "tabWork";
            _title = new Panel();
            _title.Title = WebName;
            _title.Collapsible = false;
            _title.Region = Region.North;
            _title.Split = true;
            _viewPort.Items.Add(_title);
            _viewPort.Items.Add(_workArea);
            _viewPort.Items.Add(_copyright);
            _viewPort.Items.Add(_menu);
            #endregion

            #region 个人区
            _personPanel = new Ext.Net.Panel();
            _personPanel.Collapsed = true;
            _personPanel.Collapsible = true;
            _personPanel.Title = "欢迎使用";
            _personPanel.Height = 110;
            _personPanel.BodyPadding = 10;
            _personPanel.Layout = "table";
            _personPanel.LayoutConfig.Add(new TableLayoutConfig()
            {
                Columns = 2
            });
            Image avatarImg = new Image();
            avatarImg.RowSpan = 2;
            avatarImg.Width = avatarImg.Height = 70;
            avatarImg.ImageUrl = BaseResource.avatar;
            _personPanel.Add(avatarImg);
            _personPanel.Add(new Label(userInfo.Username));

            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.Width = 80;
            buttonGroup.Layout = "vbox";
            buttonGroup.Add(new KeyButton()
            {
                Text = "修改密码",
                ID = "btnChangePassword",
                OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();"
            });

            btnExit = new Button()
            {
                Text = "安全退出",
                ID = "btnExit",
                Icon = Icon.KeyDelete
            };
            var clickEvent = btnExit.DirectEvents.Click;
            clickEvent.Event += clickEvent_Event;
            clickEvent.EventMask.Set("正在退出");
            clickEvent.Confirmation.ConfirmRequest = true;
            clickEvent.Confirmation.Title = "提示";
            clickEvent.Confirmation.Message = "确定退出?";
            buttonGroup.Add(btnExit);
            _personPanel.Add(buttonGroup);
            _menu.Add(_personPanel);
            winChangePassword = new Window()
            {
                Icon = Icon.Key,
                BodyPadding = 10,
                Width = 300,
                Height = 210,
                Modal = true,
                Hidden = true,
                AutoShow = false,
                ID = "winChangePassword",
                Title = "修改密码",
                Loader = new ComponentLoader()
                {
                    Url = ResolveClientUrl("~/user/changepassword.aspx"),
                    Mode = LoadMode.Frame
                }
            };
            winChangePassword.Loader.LoadMask.Set("正在加载");
            Controls.Add(winChangePassword);
            #endregion

            _menuPanel = new TreePanel()
            {
                Title = "功能菜单",
                Height = 500,
                RootVisible = false,
                ID = "mainMenu"
            };

            _menuStore = new TreeStore()
            {
                NodeParam = "parentId"
            };
            _menuStore.ReadData += _menuStore_ReadData;
            _menuPanel.Store.Add(_menuStore);
            _menuPanel.Root.Add(new Node()
            {
                NodeID = "0",
                Text = "Root",
                Expanded = true
            });
            _menu.Add(_menuPanel);
            var itemClick = _menuPanel.DirectEvents.ItemClick;
            itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.id);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.id).isLeaf();";
            itemClick.EventMask.Set("正在加载");
            itemClick.Event += itemClick_Event;
            itemClick.ExtraParams.Add(new Parameter("id", "record.data.id", ParameterMode.Raw));

            #region 隐藏顶级窗口
            _winParentWindow = new Window();
            _winParentWindow.Hidden = true;
            _winParentWindow.Loader = new ComponentLoader();
            _winParentWindow.Loader.Mode = LoadMode.Frame;
            _winParentWindow.Width = 800;
            _winParentWindow.Modal = true;
            _winParentWindow.Height = 600;
            _winParentWindow.ID = "_topWin";
            Controls.Add(_winParentWindow);
            #endregion

            Controls.Add(_viewPort);
        }
Esempio n. 19
0
 public abstract void ModifyTree(TreePanel treePanel, IMainInterface mainInterface);
Esempio n. 20
0
        protected override void OnInit(EventArgs e)
        {
            this._selectedIds = (List<int>)this.Context.Cache["_selectedIds"];
            if (this._selectedIds == null)
            {
                this._selectedIds = new List<int>();
                this.Context.Cache["_selectedIds"] = this._selectedIds;
            }
            this.Layout = "hbox";
            HBoxLayoutConfig item = new HBoxLayoutConfig
            {
                Align = HBoxAlign.Middle,
                DefaultMargins = "0"
            };

            this.LayoutConfig.Add(item);
            this._treePanelLeft = new TreePanel();
            this._treePanelLeft.ID = "_treePanelLeft";
            this._treePanelLeft.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.LeftItemDblClick_Event);
            this._treePanelLeft.Submit += new TreePanel.SubmitEventHandler(this._treePanelLeft_Submit);
            this._treePanelLeft.DirectEvents.Submit.EventMask.Set("正在添加");
            this._treePanelLeft.Title = "可添加";
            _treePanelLeft.MultiSelect = EnableBatchAdd;
            this._treePanelLeft.Height = this.Height;
            double width = (this.Width.Value - 75.0) / 2.0;
            this._treePanelLeft.Width = new Unit(width);
            this._treeStoreLeft = new TreeStore();
            this._treeStoreLeft.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreLeft_ReadData);
            this._treeModelLeft = new Model();
            this.InitTreePanel(this._treePanelLeft, this._treeStoreLeft, this._treeModelLeft);
            Ext.Net.Panel component = new Ext.Net.Panel
            {
                Width = 75,
                ButtonAlign = Alignment.Center,
                Layout = "vbox"
            };
            if (!Ext.Net.X.IsAjaxRequest)
            {
                component.Border = false;
            }
            var buttons = new List<Ext.Net.Button>();
            if (EnableBatchAdd)
            {
                Ext.Net.Button button = new Ext.Net.Button
                {
                    Text = "全部添加 >>",
                    TextAlign = ButtonTextAlign.Center
                };
                button.Listeners.Click.Handler = "#{" + this._treePanelLeft.ID + "}.submitNodes();";
                button.DirectEvents.Click.EventMask.Set("正在添加");
                buttons.Add(button);
            }
            Ext.Net.Button button2 = new Ext.Net.Button
            {
                Text = "添  加 > ",
                TextAlign = ButtonTextAlign.Center
            };
            buttons.Add(button2);
            button2.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnAddSelected_DirectClick);
            button2.DirectEvents.Click.EventMask.Set("正在添加");
            this._treePanelRight = new TreePanel();
            this._treePanelRight.ID = "_treePanelRight";
            this._treePanelRight.Title = "已添加";
            this._treePanelRight.DirectEvents.Submit.EventMask.Set("正在移除");
            this._treePanelRight.Submit += new TreePanel.SubmitEventHandler(this._treePanelRight_Submit);
            _treePanelRight.MultiSelect = EnableBatchRemove;
            this._treePanelRight.Height = this.Height;
            this._treePanelRight.DirectEvents.ItemDblClick.Event += new ComponentDirectEvent.DirectEventHandler(this.RightItemDblClick_Event);
            this._treePanelRight.Width = new Unit(width);
            this._treeStoreRight = new TreeStore();
            this._treeStoreRight.ReadData += new TreeStoreBase.ReadDataEventHandler(this._treeStoreRight_ReadData);
            this._treeModelRight = new Model();
            if (EnableBatchRemove)
            {
                Ext.Net.Button button3 = new Ext.Net.Button
                {
                    Text = "<< 全部移除",
                    TextAlign = ButtonTextAlign.Center
                };
                button3.Listeners.Click.Handler = "#{" + this._treePanelRight.ID + "}.submitNodes();";
                buttons.Add(button3);
            }
            Ext.Net.Button button4 = new Ext.Net.Button
            {
                Text = "< 移  除",
                TextAlign = ButtonTextAlign.Center
            };
            buttons.Add(button4);
            button4.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnRemoveSelected_DirectClick);
            button4.DirectEvents.Click.EventMask.Set("正在移除");
            component.Add(buttons.ToArray());
            this.Add(component);
            this.InitTreePanel(this._treePanelRight, this._treeStoreRight, this._treeModelRight);
            base.OnInit(e);
        }