Ejemplo n.º 1
0
        private void InitializeItem(PanelBase item)
        {
            item.Title = "Title";

            if (item is TabPanel)
            {
                TabPanel tabPanel = item as TabPanel;

                Panel tab = new Panel();
                tab.Title = "Tab 1";
                tabPanel.Items.Add(tab);

                tab       = new Panel();
                tab.Title = "Tab 2";
                tabPanel.Items.Add(tab);

                tab       = new Panel();
                tab.Title = "Tab 3";
                tabPanel.Items.Add(tab);

                tabPanel.ActiveTabIndex = 0;
            }
        }
Ejemplo n.º 2
0
        private void CheckTabVisible()
        {
            TabPanel tp = (TabPanel)this;

            if (tp.AutoPostBack && tp.DeferredRender)
            {
                for (int i = 0; i < tp.Items.Count; i++)
                {
                    if (tp.Items[i] is IContent)
                    {
                        if (!tp.Items[i].HasLayout() || (tp.Items[i].HasLayout() && tp.ActiveTabIndex == i))
                        {
                            ((IContent)tp.Items[i]).ContentContainer.Visible = (tp.ActiveTabIndex == i);
                        }
                    }

                    foreach (Control control in tp.Items[i].Controls)
                    {
                        control.Visible = tp.ActiveTabIndex == i;
                    }
                }
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="component"></param>
 public override void Initialize(System.ComponentModel.IComponent component)
 {
     base.Initialize(component);
     this.SetViewFlags(ViewFlags.TemplateEditing, true);
     this.tabPanelControl = (TabPanel) component;
 }
        private void _Count_Radio(System.Web.UI.ControlCollection objcol, string radname)
        {
            try
            {
                int iID;
                int iNO;

                foreach (object obj in objcol)
                {
                    System.Type itype = obj.GetType();
                    if (itype.Namespace == "Ext.Net" || itype.Namespace == "System.Web.UI.HtmlControls")
                    {
                        switch (itype.Name)
                        {
                        case "HtmlForm":
                            System.Web.UI.HtmlControls.HtmlForm htmlform = (System.Web.UI.HtmlControls.HtmlForm)obj;
                            _Count_Radio(htmlform.Controls, radname);
                            break;

                        case "Viewport":
                            Ext.Net.Viewport viewport = (Ext.Net.Viewport)obj;
                            _Count_Radio(viewport.Controls, radname);
                            break;

                        case "FormPanel":
                            Ext.Net.FormPanel formpanel = (Ext.Net.FormPanel)obj;
                            _Count_Radio(formpanel.Controls, radname);
                            break;

                        case "Panel":
                            Ext.Net.Panel panel = (Ext.Net.Panel)obj;
                            _Count_Radio(panel.Controls, radname);
                            break;

                        case "TabPanel":
                            Ext.Net.TabPanel tabpanel = (Ext.Net.TabPanel)obj;
                            _Count_Radio(tabpanel.Controls, radname);
                            break;

                        case "Container":
                            Ext.Net.Container container = (Ext.Net.Container)obj;
                            _Count_Radio(container.Controls, radname);
                            break;

                        case "FieldSet":
                            Ext.Net.FieldSet fieldset = (Ext.Net.FieldSet)obj;
                            _Count_Radio(fieldset.Controls, radname);
                            break;

                        case "ContentContainer":
                            Ext.Net.ContentContainer contentcontainer = (Ext.Net.ContentContainer)obj;
                            _Count_Radio(contentcontainer.Controls, radname);
                            break;

                        case "RadioGroup":
                            Ext.Net.RadioGroup radioGroup = (Ext.Net.RadioGroup)obj;
                            _Count_Radio(radioGroup.Controls, radname);
                            break;

                        case "Radio":
                            Ext.Net.Radio radio = (Ext.Net.Radio)obj;

                            string[] s = radio.ID.Split('_');
                            iID = Convert.ToInt16(s[1]);
                            iNO = Convert.ToInt16(s[2]);

                            if (iID > 1 && iID < 38)
                            {
                                if (radio.Value.Equals(true))
                                {
                                    iSCORE = iSCORE + iNO - 1;
                                }
                            }
                            break;

                        case "":

                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _ErrorMsgShow(ex.Message.ToString());
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="component"></param>
 public override void Initialize(System.ComponentModel.IComponent component)
 {
     base.Initialize(component);
     this.SetViewFlags(ViewFlags.TemplateEditing, true);
     this.tabPanelControl = (TabPanel)component;
 }
Ejemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 public TabPanel.Builder TabPanel(TabPanel component)
 {
     return(new TabPanel.Builder(component));
 }
Ejemplo n.º 10
0
        private string BuildSourceTabs(string id, string wId, ExampleConfig cfg, DirectoryInfo dir)
        {
            List<string> files = cfg != null ? cfg.OuterFiles : new List<string>();

            FileInfo[] filesInfo = dir.GetFiles();
            List<FileInfo> fileList = new List<FileInfo>(filesInfo);

            int dIndex = 0;
            for (int ind = 0; ind < fileList.Count; ind++)
            {
                if (fileList[ind].Name.ToLower() == "default.aspx")
                {
                    dIndex = ind;
                }
            }

            if (dIndex>0)
            {
                FileInfo fi = fileList[dIndex];
                fileList.RemoveAt(dIndex);
                fileList.Insert(0, fi);
            }

            foreach (string file in files)
            {
                fileList.Add(new FileInfo(file));
            }

            DirectoryInfo[] resources = dir.GetDirectories("resources",SearchOption.TopDirectoryOnly);

            if (resources.Length > 0)
            {
                GetSubFiles(fileList, resources[0]); 
            }

            TabPanel tabs = new TabPanel
                                {
                                    ID = "tpw"+id,
                                    EnableTabScroll = true,
                                    Border = false,
                                    ActiveTabIndex = 0
                                };

            int i = 0;
            foreach (FileInfo fileInfo in fileList)
            {
                if (excludeList.Contains(fileInfo.Name) || excludeExtensions.Contains(fileInfo.Extension.ToLower()))
                {
                    continue;
                }

                Panel panel = new Panel();
                panel.ID = "tptw" + id + i++;
                panel.Title = fileInfo.Name;
                panel.CustomConfig.Add(new ConfigItem("url", UIHelpers.PhysicalToVirtual(fileInfo.FullName), ParameterMode.Value));
                switch (fileInfo.Extension)
                {
                    case ".aspx":
                    case ".ascx":
                        panel.Icon = Icon.PageWhiteCode;
                        break;
                    case ".cs":
                        panel.Icon = Icon.PageWhiteCsharp;
                        break;
                    case ".xml":
                    case ".xsl":
                        panel.Icon = Icon.ScriptCodeRed;
                        break;
                    case ".js":
                        panel.Icon = Icon.Script;
                        break;
                    case ".css":
                        panel.Icon = Icon.Css;
                        break;
                }
                panel.AutoLoad.Url = UIHelpers.ApplicationRoot + "/GenerateSource.ashx";
                panel.AutoLoad.Mode = LoadMode.IFrame;
                panel.AutoLoad.Params.Add(new Parameter("f", UIHelpers.PhysicalToVirtual(fileInfo.FullName), ParameterMode.Value));
                panel.AutoLoad.ShowMask = true;

                tabs.Items.Add(panel);
            }

            return tabs.ToScript(RenderMode.AddTo, wId);
        }
Ejemplo n.º 11
0
        protected override void OnClick(DesignerRegionMouseEventArgs e)
        {
            string[] parameters = e.Region.Name.Split('_');
            string   actionName = parameters[0];

            FitLayoutClickAction action =
                (FitLayoutClickAction)Enum.Parse(typeof(FitLayoutClickAction), actionName);

            switch (action)
            {
            case FitLayoutClickAction.AddPanel:
                AddItem(typeof(Panel));
                break;

            case FitLayoutClickAction.AddTabPanel:
                AddItem(typeof(TabPanel));
                break;

            case FitLayoutClickAction.Toggle:
                Panel panel = this.fitLayout.Items[0] as Panel;

                PropertyDescriptor collapsed = TypeDescriptor.GetProperties(panel)["Collapsed"];
                bool value = (bool)collapsed.GetValue(panel);
                collapsed.SetValue(panel, !value);
                panel.Collapsed = !value;

                Tag.SetDirty(true);
                this.UpdateDesignTimeHtml();

                break;

            case FitLayoutClickAction.ChangeTab:
                if (parameters.Length < 2)
                {
                    return;
                }
                int tabId = int.Parse(parameters[1]);

                if (this.fitLayout.Items.Count == 0)
                {
                    return;
                }

                TabPanel tabPanel = this.fitLayout.Items[0] as TabPanel;

                if (tabPanel == null)
                {
                    return;
                }

                if (tabPanel.ActiveTabIndex != tabId)
                {
                    IComponentChangeService changeService =
                        (IComponentChangeService)GetService(typeof(IComponentChangeService));

                    try
                    {
                        changeService.OnComponentChanging(this.fitLayout,
                                                          TypeDescriptor.GetProperties(this.fitLayout)["Items"]);
                        PropertyDescriptor activeTab = TypeDescriptor.GetProperties(tabPanel)["ActiveTabIndex"];
                        activeTab.SetValue(tabPanel, tabId);
                        tabPanel.ActiveTabIndex = tabId;
                    }
                    finally
                    {
                        changeService.OnComponentChanged(this.fitLayout,
                                                         TypeDescriptor.GetProperties(this.fitLayout)["Items"], null,
                                                         null);
                    }
                    Tag.SetDirty(true);
                    this.UpdateDesignTimeHtml();
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 12
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());
        }
Ejemplo n.º 13
0
        protected override void OnClick(DesignerRegionMouseEventArgs e)
        {
            if (e.Region == null)
            {
                return;
            }

            string[] parameters = e.Region.Name.Split('_');

            if (parameters.Length < 2)
            {
                return;
            }

            BorderLayoutRegion region = GetLayoutRegionByName(parameters[0]);

            if (region == null)
            {
                return;
            }

            BorderLayoutClickAction action =
                (BorderLayoutClickAction)Enum.Parse(typeof(BorderLayoutClickAction), parameters[1]);

            switch (action)
            {
            case BorderLayoutClickAction.AddPanel:
                this.AddPanel(region);
                break;

            case BorderLayoutClickAction.AddTabPanel:
                this.AddTabPanel(region);
                break;

            case BorderLayoutClickAction.ClearRegion:
                this.ClearRegion(region.Region);
                break;

            case BorderLayoutClickAction.TurnOffScheme:
                TypeDescriptor.GetProperties(this.layout)["SchemeMode"].SetValue(this.layout, false);
                //this.Refresh();
                break;

            case BorderLayoutClickAction.ChangeTab:
                int tabId = int.Parse(parameters[2]);

                if (region.Items.Count == 0)
                {
                    return;
                }

                TabPanel tabPanel = region.Items[0] as TabPanel;

                if (tabPanel == null)
                {
                    return;
                }

                if (tabPanel.ActiveTabIndex != tabId)
                {
                    PropertyDescriptor activeTab = TypeDescriptor.GetProperties(tabPanel)["ActiveTabIndex"];
                    activeTab.SetValue(tabPanel, tabId);
                    tabPanel.ActiveTabIndex = tabId;
                }

                break;

            case BorderLayoutClickAction.ChangeToPanel:
                this.AddPanel(region);
                break;

            case BorderLayoutClickAction.ChangeToTabPanel:
                this.AddTabPanel(region);
                break;

            case BorderLayoutClickAction.Collapse:
                CollapsePanel(region, true);
                break;

            case BorderLayoutClickAction.Expand:
                CollapsePanel(region, false);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            this.Tag.SetDirty(true);
            this.UpdateDesignTimeHtml();
            //base.OnClick(e);
        }