public void AddWindow(string popMsg)
        {
            try
            {
                Window window = new Window();
                window.ID            = "ChartShow";
                window.Title         = "统计信息详细信息";
                window.Width         = Unit.Pixel(820);
                window.Height        = Unit.Pixel(600);
                window.Modal         = true;
                window.Collapsible   = true;
                window.Maximizable   = false;
                window.Resizable     = false;
                window.Hidden        = true;
                window.AutoLoad.Mode = LoadMode.Merge;

                Ext.Net.Panel tabs = new Ext.Net.Panel();
                tabs.ID     = "TabPanel1";
                tabs.IDMode = IDMode.Explicit;
                tabs.Border = false;

                Ext.Net.Panel tab = new Ext.Net.Panel();
                tab.Title            = "统计信息";
                tab.Padding          = 5;
                tab.AnchorHorizontal = "100%";
                tabs.Add(tab);
                string[] strs = popMsg.Split(',');
                double[] data = GetRowData(int.Parse(strs[1]));
                ChartDirector.WebChartViewer webChartViewer = new ChartDirector.WebChartViewer();
                Bll.Common.CreateCurvelineChart(webChartViewer, data, "小时", "识别率%", strs[0] + " - 识别率曲线");
                webChartViewer.Visible = true;
                tab.ContentControls.Add(webChartViewer);
                Toolbar     toolbar     = new Ext.Net.Toolbar();
                ToolbarFill toolbarFill = new ToolbarFill();
                toolbar.Add(toolbarFill);
                window.BottomBar.Add(toolbar);
                CommonExt.AddButton(toolbar, "butCancel", "退出", "Cancel", window.ClientID + ".hide()");
                window.Items.Add(tabs);
                window.Render(this.Form);
                window.Show();
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("PassCarOcrCount.aspx-AddWindow", ex.Message + ";" + ex.StackTrace, "AddWindow has an exception");
            }
        }
        /// <summary>
        /// 显示修改窗体
        /// </summary>
        private void AddWindowModify()
        {
            Window window = new Window();

            window.ID            = "UserModify";
            window.Title         = "密码修改";
            window.Width         = Unit.Pixel(400);
            window.Height        = Unit.Pixel(200);
            window.Modal         = true;
            window.Collapsible   = true;
            window.Maximizable   = false;
            window.Resizable     = false;
            window.Hidden        = true;
            window.AutoLoad.Mode = LoadMode.Merge;

            Ext.Net.Panel tabs = new Ext.Net.Panel();
            tabs.ID     = "TabPanel1";
            tabs.IDMode = IDMode.Explicit;
            tabs.Border = false;

            Ext.Net.Panel tab = new Ext.Net.Panel();
            tab.Title   = "";
            tab.Padding = 5;
            tab.Height  = 120;
            tabs.Add(tab);
            tab.Items.Add(CommonExt.AddTextFieldPassword("txtMFirstPassWord", "初始密码", false));
            tab.Items.Add(CommonExt.AddTextFieldPassword("txtMPassWord", "新密码", false));
            tab.Items.Add(CommonExt.AddTextFieldPassword_Confirm("txtMConfirmPassWord", "重复密码", false, "txtMPassWord"));

            Toolbar     toolbar     = new Ext.Net.Toolbar();
            ToolbarFill toolbarFill = new ToolbarFill();

            toolbar.Add(toolbarFill);
            window.BottomBar.Add(toolbar);
            CommonExt.AddButton(toolbar, "butSaveEdit2", "保存", "Disk", "UserManager.UpdateData()");
            CommonExt.AddButton(toolbar, "butCancelEdit2", "取消", "Cancel", window.ClientID + ".hide()");
            window.Items.Add(tabs);
            window.Render(this.Form);
            window.Show();
        }
Beispiel #3
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());
        }
        //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);
        }
        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);
        }
Beispiel #6
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);
        }
        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);
        }
Beispiel #8
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());
        }
Beispiel #9
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);
        }