Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Data loader.
            var treeloader = new Ext.Net.TreeLoader
                {
                    DataUrl =
                        Engine.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(typeof(FileManagerUserControl).Assembly,
                            "Zeus.Admin.Plugins.FileManager.TreeLoader.ashx"),
                    PreloadChildren = true
                };
            treePanel.Loader.Add(treeloader);

            filesStore.DirectEventConfig.Url = Engine.AdminManager.GetAdminDefaultUrl();

            if (ExtNet.IsAjaxRequest)
                return;

            ContentItem fileManagerRootFolder = Find.StartPage;
            if (fileManagerRootFolder == null)
                return;

            TreeNodeBase treeNode = SiteTree.Between(fileManagerRootFolder, fileManagerRootFolder, true)
                .OpenTo(fileManagerRootFolder)
                .Filter(items => items.Authorized(Engine.WebContext.User, Engine.SecurityManager, Operations.Read))
                .ToTreeNode(true);
            treePanel.Root.Add(treeNode);

            filesStore.DataSource = GetFiles(fileManagerRootFolder, FileType.Both);
            filesStore.DataBind();
        }
Ejemplo n.º 2
0
        protected override void OnBeforeClientInit(Observable sender)
        {
            base.OnBeforeClientInit(sender);

            if (this.initParams)
            {
                return;
            }

            if (this.Loader.Primary != null && this.Loader.Primary.BaseParams.Count > 0)
            {
                TreeLoader loader = this.Loader.Primary as TreeLoader;

                if (loader != null)
                {
                    if (loader.Listeners.BeforeLoad.IsDefault)
                    {
                        loader.Listeners.BeforeLoad.Fn = BuildParams(this.Loader.Primary.BaseParams, null, true);
                    }
                    else
                    {
                        if (loader.Listeners.BeforeLoad.Fn.IsNotEmpty())
                        {
                            loader.Listeners.BeforeLoad.Fn = BuildParams(this.Loader.Primary.BaseParams, loader.Listeners.BeforeLoad.Fn, true);
                        }
                        else
                        {
                            loader.Listeners.BeforeLoad.Fn = BuildParams(this.Loader.Primary.BaseParams, loader.Listeners.BeforeLoad.Handler, false);
                        }
                    }
                }
            }

            if (this.RemoteExtraParams.Count > 0)
            {
                if (this.Listeners.BeforeRemoteAction.IsDefault)
                {
                    this.Listeners.BeforeRemoteAction.Fn = this.BuildRemoteParams(this.RemoteExtraParams, null, true);
                }
                else
                {
                    if (this.Listeners.BeforeRemoteAction.Fn.IsNotEmpty())
                    {
                        this.Listeners.BeforeRemoteAction.Fn = this.BuildRemoteParams(this.RemoteExtraParams, this.Listeners.BeforeRemoteAction.Fn, true);
                    }
                    else
                    {
                        this.Listeners.BeforeRemoteAction.Fn = this.BuildRemoteParams(this.RemoteExtraParams, this.Listeners.BeforeRemoteAction.Handler, false);
                    }
                }
            }

            this.initParams = true;
        }
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 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);
            }
        }