コード例 #1
0
ファイル: Converters.cs プロジェクト: rose-nneka/Dnn.Platform
 public static T ConvertToPageItem <T>(TabInfo tab, IEnumerable <TabInfo> portalTabs) where T : PageItem, new()
 {
     return(new T
     {
         Id = tab.TabID,
         Name = tab.LocalizedTabName,
         Url = tab.FullUrl,
         ChildrenCount = portalTabs?.Count(ct => ct.ParentId == tab.TabID) ?? 0,
         Status = GetTabStatus(tab),
         ParentId = tab.ParentId,
         Level = tab.Level,
         IsSpecial = TabController.IsSpecialTab(tab.TabID, PortalSettings.Current),
         TabPath = tab.TabPath.Replace("//", "/"),
         PageType = GetPageType(tab.Url),
         CanViewPage = TabPermissionController.CanViewPage(tab),
         CanManagePage = TabPermissionController.CanManagePage(tab),
         CanAddPage = TabPermissionController.CanAddPage(tab),
         CanAdminPage = TabPermissionController.CanAdminPage(tab),
         CanCopyPage = TabPermissionController.CanCopyPage(tab),
         CanDeletePage = TabPermissionController.CanDeletePage(tab),
         CanAddContentToPage = TabPermissionController.CanAddContentToPage(tab),
         CanNavigateToPage = TabPermissionController.CanNavigateToPage(tab),
         LastModifiedOnDate = tab.LastModifiedOnDate.ToString("MM/dd/yyyy h:mm:ss tt", CultureInfo.CreateSpecificCulture(tab.CultureCode ?? "en-US")),
         FriendlyLastModifiedOnDate = tab.LastModifiedOnDate.ToString("MM/dd/yyyy h:mm:ss tt"),
         PublishDate = tab.HasBeenPublished ? WorkflowHelper.GetTabLastPublishedOn(tab).ToString("MM/dd/yyyy h:mm:ss tt", CultureInfo.CreateSpecificCulture(tab.CultureCode ?? "en-US")) : "",
         PublishStatus = GetTabPublishStatus(tab),
         Tags = tab.Terms.Select(t => t.Name).ToArray(),
         TabOrder = tab.TabOrder
     });
 }
コード例 #2
0
        private void SetMode(bool update)
        {
            if (update)
            {
                SetUserMode(ddlMode.SelectedValue);
            }

            if (!TabPermissionController.CanAddContentToPage())
            {
                ddlMode.Items.Remove(ddlMode.Items.FindByValue("LAYOUT"));
            }

            if (!(new PreviewProfileController().GetProfilesByPortal(this.PortalSettings.PortalId).Count > 0))
            {
                ddlMode.Items.Remove(ddlMode.Items.FindByValue("PREVIEW"));
            }

            switch (UserMode)
            {
            case PortalSettings.Mode.View:
                ddlMode.Items.FindByValue("VIEW").Selected = true;
                break;

            case PortalSettings.Mode.Edit:
                ddlMode.Items.FindByValue("EDIT").Selected = true;
                break;

            case PortalSettings.Mode.Layout:
                ddlMode.Items.FindByValue("LAYOUT").Selected = true;
                break;
            }
        }
コード例 #3
0
ファイル: IconBar.ascx.cs プロジェクト: ryanmalone/BGDNNWEB
        private void SetMode(bool Update)
        {
            if (Update)
            {
                SetUserMode(optMode.SelectedValue);
            }
            if (!TabPermissionController.CanAddContentToPage())
            {
                optMode.Items.Remove(optMode.Items.FindByValue("LAYOUT"));
            }
            switch (UserMode)
            {
            case PortalSettings.Mode.View:
                optMode.Items.FindByValue("VIEW").Selected = true;
                break;

            case PortalSettings.Mode.Edit:
                optMode.Items.FindByValue("EDIT").Selected = true;
                break;

            case PortalSettings.Mode.Layout:
                optMode.Items.FindByValue("LAYOUT").Selected = true;
                break;
            }
        }
コード例 #4
0
        public void DeleteTabModule(int pageId, int moduleId)
        {
            var portalSettings = PortalController.Instance.GetCurrentPortalSettings();
            var tab            = _tabController.GetTab(pageId, portalSettings.PortalId);

            if (tab == null)
            {
                throw new PageModuleNotFoundException();
            }

            var tabModule = _moduleController.GetModule(moduleId, pageId, false);

            if (tabModule == null)
            {
                throw new PageModuleNotFoundException();
            }

            if (!TabPermissionController.CanAddContentToPage(tab))
            {
                throw new SecurityException("You do not have permission to delete module on this page");
            }

            _moduleController.DeleteTabModule(pageId, moduleId, true);
            _moduleController.ClearCache(pageId);
        }
コード例 #5
0
        private static bool CanAddContentToPage(ModuleInfo objModule)
        {
            bool    canManage = Null.NullBoolean;
            TabInfo objTab    = new TabController().GetTab(objModule.TabID, objModule.PortalID, false);

            canManage = TabPermissionController.CanAddContentToPage(objTab);
            return(canManage);
        }
コード例 #6
0
        protected bool IsPageAdmin()
        {
            bool _IsPageAdmin = Null.NullBoolean;

            if (TabPermissionController.CanAddContentToPage() || TabPermissionController.CanAddPage() || TabPermissionController.CanAdminPage() || TabPermissionController.CanCopyPage() || TabPermissionController.CanDeletePage() || TabPermissionController.CanExportPage() || TabPermissionController.CanImportPage() || TabPermissionController.CanManagePage())
            {
                _IsPageAdmin = true;
            }
            return(_IsPageAdmin);
        }
コード例 #7
0
        public static bool HasModuleAccess(SecurityAccessLevel AccessLevel, string permissionKey, ModuleInfo ModuleConfiguration)
        {
            bool     blnAuthorized = false;
            UserInfo objUser       = UserController.GetCurrentUserInfo();

            if (objUser != null && objUser.IsSuperUser)
            {
                blnAuthorized = true;
            }
            else
            {
                switch (AccessLevel)
                {
                case SecurityAccessLevel.Anonymous:
                    blnAuthorized = true;
                    break;

                case SecurityAccessLevel.View:
                    if (TabPermissionController.CanViewPage() || CanViewModule(ModuleConfiguration))
                    {
                        blnAuthorized = true;
                    }
                    break;

                case SecurityAccessLevel.Edit:
                    if (TabPermissionController.CanAddContentToPage())
                    {
                        blnAuthorized = true;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(permissionKey))
                        {
                            permissionKey = "CONTENT,DELETE,EDIT,EXPORT,IMPORT,MANAGE";
                        }
                        if (ModuleConfiguration != null && CanViewModule(ModuleConfiguration) && (HasModulePermission(ModuleConfiguration.ModulePermissions, permissionKey) || HasModulePermission(ModuleConfiguration.ModulePermissions, "EDIT")))
                        {
                            blnAuthorized = true;
                        }
                    }
                    break;

                case SecurityAccessLevel.Admin:
                    if (TabPermissionController.CanAddContentToPage())
                    {
                        blnAuthorized = true;
                    }
                    break;

                case SecurityAccessLevel.Host:
                    break;
                }
            }
            return(blnAuthorized);
        }
コード例 #8
0
ファイル: Pane.cs プロジェクト: misterPaul0/Curt
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ProcessPane processes the Attributes for the PaneControl
        /// </summary>
        /// <history>
        ///     [cnurse]	12/05/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void ProcessPane()
        {
            if (PaneControl != null)
            {
                //remove excess skin non-validating attributes
                PaneControl.Attributes.Remove("ContainerType");
                PaneControl.Attributes.Remove("ContainerName");
                PaneControl.Attributes.Remove("ContainerSrc");

                if (Globals.IsLayoutMode())
                {
                    PaneControl.Visible = true;

                    //display pane border
                    string cssclass = PaneControl.Attributes["class"];
                    if (string.IsNullOrEmpty(cssclass))
                    {
                        PaneControl.Attributes["class"] = CPaneOutline;
                    }
                    else
                    {
                        PaneControl.Attributes["class"] = cssclass.Replace(CPaneOutline, "").Trim().Replace("  ", " ") + " " + CPaneOutline;
                    }
                    //display pane name
                    var ctlLabel = new Label {
                        Text = "<center>" + Name + "</center><br />", CssClass = "SubHead"
                    };
                    PaneControl.Controls.AddAt(0, ctlLabel);
                }
                else
                {
                    if (TabPermissionController.CanAddContentToPage() && PaneControl.Visible == false)
                    {
                        PaneControl.Visible = true;
                    }

                    if (CanCollapsePane())
                    {
                        //This pane has no controls so set the width to 0
                        if (PaneControl.Attributes["style"] != null)
                        {
                            PaneControl.Attributes.Remove("style");
                        }
                        if (PaneControl.Attributes["class"] != null)
                        {
                            PaneControl.Attributes["class"] = PaneControl.Attributes["class"] + " DNNEmptyPane";
                        }
                        else
                        {
                            PaneControl.Attributes["class"] = "DNNEmptyPane";
                        }
                    }
                }
            }
        }
コード例 #9
0
 private bool IsPageAdmin()
 {
     return(TabPermissionController.CanAddContentToPage() ||
            TabPermissionController.CanAddPage() ||
            TabPermissionController.CanAdminPage() ||
            TabPermissionController.CanCopyPage() ||
            TabPermissionController.CanDeletePage() ||
            TabPermissionController.CanExportPage() ||
            TabPermissionController.CanImportPage() ||
            TabPermissionController.CanManagePage());
 }
コード例 #10
0
        public List <ModuleInfo> GetDeletedModules(out int totalRecords, int pageIndex = -1, int pageSize = -1)
        {
            var deletedModules = this._moduleController.GetModules(PortalSettings.PortalId)
                                 .Cast <ModuleInfo>()
                                 .Where(module => module.IsDeleted && (
                                            TabPermissionController.CanAddContentToPage(TabController.Instance.GetTab(module.TabID, module.PortalID)) ||
                                            ModulePermissionController.CanDeleteModule(module)));

            totalRecords = deletedModules.Count();
            return(pageIndex == -1 || pageSize == -1 ? deletedModules.ToList() : deletedModules.Skip(pageIndex * pageSize).Take(pageSize).ToList());
        }
コード例 #11
0
        public List <ModuleInfo> GetDeletedModules()
        {
            var deletedModules = _moduleController.GetModules(PortalSettings.PortalId)
                                 .Cast <ModuleInfo>()
                                 .Where(module => module.IsDeleted && (
                                            TabPermissionController.CanAddContentToPage(TabController.Instance.GetTab(module.TabID, module.PortalID)) ||
                                            ModulePermissionController.CanDeleteModule(module))
                                        )
                                 .ToList();

            return(deletedModules);
        }
コード例 #12
0
        public virtual JObject GetPagePermissions(TabInfo tab)
        {
            var permissions = new JObject
            {
                { "addContentToPage", TabPermissionController.CanAddContentToPage(tab) },
                { "addPage", TabPermissionController.CanAddPage(tab) },
                { "adminPage", TabPermissionController.CanAdminPage(tab) },
                { "copyPage", TabPermissionController.CanCopyPage(tab) },
                { "deletePage", TabPermissionController.CanDeletePage(tab) },
                { "exportPage", TabPermissionController.CanExportPage(tab) },
                { "importPage", TabPermissionController.CanImportPage(tab) },
                { "managePage", TabPermissionController.CanManagePage(tab) }
            };

            return(permissions);
        }
コード例 #13
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnLoad runs just before the Skin is rendered.
        /// </summary>
        /// -----------------------------------------------------------------------------
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            this.InvokeSkinEvents(SkinEventType.OnSkinPreRender);
            var isSpecialPageMode = UrlUtils.InPopUp() || this.Request.QueryString["dnnprintmode"] == "true";

            if (TabPermissionController.CanAddContentToPage() && Globals.IsEditMode() && !isSpecialPageMode)
            {
                // Register Drag and Drop plugin
                JavaScript.RequestRegistration(CommonJs.DnnPlugins);
                ClientResourceManager.RegisterStyleSheet(this.Page, "~/resources/shared/stylesheets/dnn.dragDrop.css", FileOrder.Css.FeatureCss);
                ClientResourceManager.RegisterScript(this.Page, "~/resources/shared/scripts/dnn.dragDrop.js");

                // Register Client Script
                var sb = new StringBuilder();
                sb.AppendLine(" (function ($) {");
                sb.AppendLine("     $(document).ready(function () {");
                sb.AppendLine("         $('.dnnSortable').dnnModuleDragDrop({");
                sb.AppendLine("             tabId: " + this.PortalSettings.ActiveTab.TabID + ",");
                sb.AppendLine("             draggingHintText: '" + Localization.GetSafeJSString("DraggingHintText", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dragHintText: '" + Localization.GetSafeJSString("DragModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropHintText: '" + Localization.GetSafeJSString("DropModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropTargetText: '" + Localization.GetSafeJSString("DropModuleTarget", Localization.GlobalResourceFile) + "'");
                sb.AppendLine("         });");
                sb.AppendLine("     });");
                sb.AppendLine(" } (jQuery));");

                var script = sb.ToString();
                if (ScriptManager.GetCurrent(this.Page) != null)
                {
                    // respect MS AJAX
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "DragAndDrop", script, true);
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "DragAndDrop", script, true);
                }
            }
        }
コード例 #14
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnLoad runs just before the Skin is rendered.
        /// </summary>
        /// <history>
        ///     [cnurse]    04/17/2009  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            InvokeSkinEvents(SkinEventType.OnSkinPreRender);

            if (TabPermissionController.CanAddContentToPage() && Globals.IsEditMode() && !HttpContext.Current.Request.Url.ToString().Contains("popUp=true"))
            {
                //Register Drag and Drop plugin
                jQuery.RegisterDnnJQueryPlugins(Page);
                ClientResourceManager.RegisterStyleSheet(Page, "~/resources/shared/stylesheets/dnn.dragDrop.css", FileOrder.Css.FeatureCss);
                ClientResourceManager.RegisterScript(Page, "~/resources/shared/scripts/dnn.dragDrop.js");

                //Register Client Script
                var sb = new StringBuilder();
                sb.AppendLine(" (function ($) {");
                sb.AppendLine("     $(document).ready(function () {");
                sb.AppendLine("         $('.dnnSortable').dnnModuleDragDrop({");
                sb.AppendLine("             tabId: " + PortalSettings.ActiveTab.TabID + ",");
                sb.AppendLine("             draggingHintText: '" + Localization.GetSafeJSString("DraggingHintText", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dragHintText: '" + Localization.GetSafeJSString("DragModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropHintText: '" + Localization.GetSafeJSString("DropModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropTargetText: '" + Localization.GetSafeJSString("DropModuleTarget", Localization.GlobalResourceFile) + "'");
                sb.AppendLine("         });");
                sb.AppendLine("     });");
                sb.AppendLine(" } (jQuery));");

                var script = sb.ToString();
                if (ScriptManager.GetCurrent(Page) != null)
                {
                    // respect MS AJAX
                    ScriptManager.RegisterStartupScript(Page, GetType(), "DragAndDrop", script, true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "DragAndDrop", script, true);
                }
            }
        }
コード例 #15
0
ファイル: IconBar.ascx.cs プロジェクト: ryanmalone/BGDNNWEB
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            imgAddModule.Click                 += imgAddModule_Click;
            optMode.SelectedIndexChanged       += optMode_SelectedIndexChanged;
            optModuleType.SelectedIndexChanged += optModuleType_SelectedIndexChanged;
            cboTabs.SelectedIndexChanged       += cboTabs_SelectedIndexChanged;
            cmdVisibility.Click                += cmdVisibility_Click;
            cboPanes.SelectedIndexChanged      += cboPanes_SelectedIndexChanged;
            cboPosition.SelectedIndexChanged   += cboPosition_SelectedIndexChanged;
            imgAdmin.Click     += imgAdmin_Click;
            cmdAdmin.Click     += cmdAdmin_Click;
            imgHost.Click      += imgHost_Click;
            cmdHost.Click      += cmdHost_Click;
            cmdAddModule.Click += AddModule_Click;

            cmdAddTab.Click        += PageFunctions_Click;
            cmdAddTabIcon.Click    += PageFunctions_Click;
            cmdEditTab.Click       += PageFunctions_Click;
            cmdEditTabIcon.Click   += PageFunctions_Click;
            cmdDeleteTab.Click     += PageFunctions_Click;
            cmdDeleteTabIcon.Click += PageFunctions_Click;
            cmdCopyTab.Click       += PageFunctions_Click;
            cmdCopyTabIcon.Click   += PageFunctions_Click;
            cmdExportTab.Click     += PageFunctions_Click;
            cmdExportTabIcon.Click += PageFunctions_Click;
            cmdImportTab.Click     += PageFunctions_Click;
            cmdImportTabIcon.Click += PageFunctions_Click;

            cmdExtensions.Click     += CommonTasks_Click;
            cmdExtensionsIcon.Click += CommonTasks_Click;
            cmdFiles.Click          += CommonTasks_Click;
            cmdFilesIcon.Click      += CommonTasks_Click;
            cmdRoles.Click          += CommonTasks_Click;
            cmdRolesIcon.Click      += CommonTasks_Click;
            cmdSite.Click           += CommonTasks_Click;
            cmdSiteIcon.Click       += CommonTasks_Click;
            cmdUsers.Click          += CommonTasks_Click;
            cmdUsersIcon.Click      += CommonTasks_Click;

            try
            {
                if (IsPageAdmin())
                {
                    tblControlPanel.Visible = true;
                    cmdVisibility.Visible   = true;
                    rowControlPanel.Visible = true;

                    Localize();

                    if (Globals.IsAdminControl())
                    {
                        cmdAddModule.Enabled = false;
                    }
                    if (!Page.IsPostBack)
                    {
                        optModuleType.Items.FindByValue("0").Selected = true;

                        if (!TabPermissionController.CanAddPage())
                        {
                            DisableAction(imgAddTabIcon, "iconbar_addtab_bw.gif", cmdAddTabIcon, cmdAddTab);
                        }
                        if (!TabPermissionController.CanManagePage())
                        {
                            DisableAction(imgEditTabIcon, "iconbar_edittab_bw.gif", cmdEditTabIcon, cmdEditTab);
                        }
                        if (!TabPermissionController.CanDeletePage() || TabController.IsSpecialTab(TabController.CurrentPage.TabID, PortalSettings))
                        {
                            DisableAction(imgDeleteTabIcon, "iconbar_deletetab_bw.gif", cmdDeleteTabIcon, cmdDeleteTab);
                        }
                        else
                        {
                            ClientAPI.AddButtonConfirm(cmdDeleteTab, Localization.GetString("DeleteTabConfirm", LocalResourceFile));
                            ClientAPI.AddButtonConfirm(cmdDeleteTabIcon, Localization.GetString("DeleteTabConfirm", LocalResourceFile));
                        }
                        if (!TabPermissionController.CanCopyPage())
                        {
                            DisableAction(imgCopyTabIcon, "iconbar_copytab_bw.gif", cmdCopyTabIcon, cmdCopyTab);
                        }
                        if (!TabPermissionController.CanExportPage())
                        {
                            DisableAction(imgExportTabIcon, "iconbar_exporttab_bw.gif", cmdExportTabIcon, cmdExportTab);
                        }
                        if (!TabPermissionController.CanImportPage())
                        {
                            DisableAction(imgImportTabIcon, "iconbar_importtab_bw.gif", cmdImportTabIcon, cmdImportTab);
                        }
                        if (!TabPermissionController.CanAddContentToPage())
                        {
                            pnlModules.Visible = false;
                        }
                        if (!GetModulePermission(PortalSettings.PortalId, "Site Settings"))
                        {
                            DisableAction(imgSiteIcon, "iconbar_site_bw.gif", cmdSiteIcon, cmdSite);
                        }
                        if (GetModulePermission(PortalSettings.PortalId, "User Accounts") == false)
                        {
                            DisableAction(imgUsersIcon, "iconbar_users_bw.gif", cmdUsersIcon, cmdUsers);
                        }
                        if (GetModulePermission(PortalSettings.PortalId, "Security Roles") == false)
                        {
                            DisableAction(imgRolesIcon, "iconbar_roles_bw.gif", cmdRolesIcon, cmdRoles);
                        }
                        if (GetModulePermission(PortalSettings.PortalId, "Digital Asset Management") == false)
                        {
                            DisableAction(imgFilesIcon, "iconbar_files_bw.gif", cmdFilesIcon, cmdFiles);
                        }
                        if (GetModulePermission(PortalSettings.PortalId, "Extensions") == false)
                        {
                            DisableAction(imgExtensionsIcon, "iconbar_extensions_bw.gif", cmdExtensionsIcon, cmdExtensions);
                        }
                        UserInfo objUser = UserController.GetCurrentUserInfo();
                        if (objUser != null)
                        {
                            if (objUser.IsSuperUser)
                            {
                                hypMessage.ImageUrl = Upgrade.UpgradeIndicator(DotNetNukeContext.Current.Application.Version, Request.IsLocal, Request.IsSecureConnection);
                                if (!String.IsNullOrEmpty(hypMessage.ImageUrl))
                                {
                                    hypMessage.ToolTip     = Localization.GetString("hypUpgrade.Text", LocalResourceFile);
                                    hypMessage.NavigateUrl = Upgrade.UpgradeRedirect();
                                }
                                cmdHost.Visible = true;
                            }
                            else //branding
                            {
                                if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) && Host.DisplayCopyright)
                                {
                                    hypMessage.ImageUrl    = "~/images/branding/iconbar_logo.png";
                                    hypMessage.ToolTip     = DotNetNukeContext.Current.Application.Description;
                                    hypMessage.NavigateUrl = Localization.GetString("hypMessageUrl.Text", LocalResourceFile);
                                }
                                else
                                {
                                    hypMessage.Visible = false;
                                }
                                cmdHost.Visible  = false;
                                cmdAdmin.Visible = GetModulePermission(PortalSettings.PortalId, "Console");
                            }
                            imgHost.Visible  = cmdHost.Visible;
                            imgAdmin.Visible = cmdAdmin.Visible;
                        }
                        BindData();
                        int intItem;
                        for (intItem = 0; intItem <= PortalSettings.ActiveTab.Panes.Count - 1; intItem++)
                        {
                            cboPanes.Items.Add(Convert.ToString(PortalSettings.ActiveTab.Panes[intItem]));
                        }
                        if (cboPanes.Items.FindByValue(Globals.glbDefaultPane) != null)
                        {
                            cboPanes.Items.FindByValue(Globals.glbDefaultPane).Selected = true;
                        }
                        if (cboPermission.Items.Count > 0)
                        {
                            cboPermission.SelectedIndex = 0; //view
                        }
                        LoadPositions();

                        if (!string.IsNullOrEmpty(Host.HelpURL))
                        {
                            var version = Globals.FormatVersion(DotNetNukeContext.Current.Application.Version, false);
                            cmdHelp.NavigateUrl     = Globals.FormatHelpUrl(Host.HelpURL, PortalSettings, version);
                            cmdHelpIcon.NavigateUrl = cmdHelp.NavigateUrl;
                            cmdHelp.Enabled         = true;
                            cmdHelpIcon.Enabled     = true;
                        }
                        else
                        {
                            cmdHelp.Enabled     = false;
                            cmdHelpIcon.Enabled = false;
                        }
                        SetMode(false);
                        SetVisibility(false);
                    }

                    //Register jQuery
                    jQuery.RequestRegistration();
                }
                else if (IsModuleAdmin())
                {
                    tblControlPanel.Visible = true;
                    cmdVisibility.Visible   = false;
                    rowControlPanel.Visible = false;
                    if (!Page.IsPostBack)
                    {
                        SetMode(false);
                        SetVisibility(false);
                    }
                }
                else
                {
                    tblControlPanel.Visible = false;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #16
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            ddlMode.SelectedIndexChanged      += ddlMode_SelectedIndexChanged;
            ddlUICulture.SelectedIndexChanged += ddlUICulture_SelectedIndexChanged;

            try
            {
                AdminPanel.Visible         = false;
                AdvancedToolsPanel.Visible = false;

                if (ControlPanel.Visible)
                {
                    ClientResourceManager.RegisterStyleSheet(this.Page, "~/admin/ControlPanel/module.css");
                    jQuery.RequestHoverIntentRegistration();
                    ClientResourceManager.RegisterScript(this.Page, "~/Resources/ControlPanel/ControlPanel.debug.js");
                }

                jQuery.RequestDnnPluginsRegistration();

                Control copyPageButton = CurrentPagePanel.FindControl("CopyPage");
                if ((copyPageButton != null))
                {
                    copyPageButton.Visible = LocaleController.Instance.IsDefaultLanguage(LocaleController.Instance.GetCurrentLocale(PortalSettings.PortalId).Code);
                }


                if ((Request.IsAuthenticated))
                {
                    UserInfo user = UserController.GetCurrentUserInfo();
                    if (((user != null)))
                    {
                        bool isAdmin = user.IsInRole(PortalSettings.Current.AdministratorRoleName);
                        AdminPanel.Visible = isAdmin;
                    }
                }

                if (IsPageAdmin())
                {
                    ControlPanel.Visible = true;
                    BodyPanel.Visible    = true;

                    if ((DotNetNukeContext.Current.Application.Name == "DNNCORP.CE"))
                    {
                        //Hide Support icon in CE
                        AdminPanel.FindControl("SupportTickets").Visible = false;
                    }
                    else
                    {
                        //Show PE/XE tools
                        AdvancedToolsPanel.Visible = true;
                    }

                    Localize();

                    if (!Page.IsPostBack)
                    {
                        UserInfo objUser = UserController.GetCurrentUserInfo();
                        if ((objUser != null))
                        {
                            if (objUser.IsSuperUser)
                            {
                                hypMessage.ImageUrl = Upgrade.UpgradeIndicator(DotNetNukeContext.Current.Application.Version, Request.IsLocal, Request.IsSecureConnection);
                                if (!string.IsNullOrEmpty(hypMessage.ImageUrl))
                                {
                                    hypMessage.ToolTip     = Localization.GetString("hypUpgrade.Text", LocalResourceFile);
                                    hypMessage.NavigateUrl = Upgrade.UpgradeRedirect();
                                }
                            }
                            else
                            {
                                if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) && Host.DisplayCopyright)
                                {
                                    hypMessage.ImageUrl    = "~/images/branding/iconbar_logo.png";
                                    hypMessage.ToolTip     = DotNetNukeContext.Current.Application.Description;
                                    hypMessage.NavigateUrl = Localization.GetString("hypMessageUrl.Text", LocalResourceFile);
                                }
                                else
                                {
                                    hypMessage.Visible = false;
                                }

                                if (!TabPermissionController.CanAddContentToPage())
                                {
                                    CommonTasksPanel.Visible = false;
                                }
                            }
                            if (PortalSettings.AllowUserUICulture)
                            {
                                object oCulture = DotNetNuke.Services.Personalization.Personalization.GetProfile("Usability", "UICulture");
                                string currentCulture;
                                if (oCulture != null)
                                {
                                    currentCulture = oCulture.ToString();
                                }
                                else
                                {
                                    Localization l = new Localization();
                                    currentCulture = l.CurrentUICulture;
                                }
                                Localization.LoadCultureDropDownList(ddlUICulture, CultureDropDownTypes.NativeName, currentCulture);
                                //only show language selector if more than one language
                                if (ddlUICulture.Items.Count > 1)
                                {
                                    lblUILanguage.Visible = true;
                                    ddlUICulture.Visible  = true;

                                    if (oCulture == null)
                                    {
                                        SetLanguage(true);
                                    }
                                }
                            }
                        }
                        SetMode(false);
                    }
                }
                else if (IsModuleAdmin())
                {
                    ControlPanel.Visible = true;
                    BodyPanel.Visible    = false;
                    adminMenus.Visible   = false;
                    if (!Page.IsPostBack)
                    {
                        SetMode(false);
                    }
                }
                else
                {
                    ControlPanel.Visible = false;
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #17
0
        protected void CmdAddModuleClick(object sender, EventArgs e)
        {
            if (TabPermissionController.CanAddContentToPage() && this.CanAddModuleToPage())
            {
                int permissionType;
                try
                {
                    permissionType = int.Parse(this.VisibilityLst.SelectedValue);
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);

                    permissionType = 0;
                }

                int position = -1;
                switch (this.PositionLst.SelectedValue)
                {
                case "TOP":
                    position = 0;
                    break;

                case "ABOVE":
                    if (!string.IsNullOrEmpty(this.PaneModulesLst.SelectedValue))
                    {
                        try
                        {
                            position = int.Parse(this.PaneModulesLst.SelectedValue) - 1;
                        }
                        catch (Exception exc)
                        {
                            Logger.Error(exc);

                            position = -1;
                        }
                    }
                    else
                    {
                        position = 0;
                    }

                    break;

                case "BELOW":
                    if (!string.IsNullOrEmpty(this.PaneModulesLst.SelectedValue))
                    {
                        try
                        {
                            position = int.Parse(this.PaneModulesLst.SelectedValue) + 1;
                        }
                        catch (Exception exc)
                        {
                            Logger.Error(exc);

                            position = -1;
                        }
                    }
                    else
                    {
                        position = -1;
                    }

                    break;

                case "BOTTOM":
                    position = -1;
                    break;
                }

                int moduleLstID;
                try
                {
                    moduleLstID = int.Parse(this.ModuleLst.SelectedValue);
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);

                    moduleLstID = -1;
                }

                if (moduleLstID > -1)
                {
                    if (this.AddExistingModule.Checked)
                    {
                        int pageID;
                        try
                        {
                            pageID = int.Parse(this.PageLst.SelectedValue);
                        }
                        catch (Exception exc)
                        {
                            Logger.Error(exc);

                            pageID = -1;
                        }

                        if (pageID > -1)
                        {
                            this.DoAddExistingModule(moduleLstID, pageID, this.PaneLst.SelectedValue, position, string.Empty, this.chkCopyModule.Checked);
                        }
                    }
                    else
                    {
                        DoAddNewModule(this.Title.Text, moduleLstID, this.PaneLst.SelectedValue, position, permissionType, string.Empty);
                    }
                }

                // set view mode to edit after add module.
                if (this.PortalSettings.UserMode != PortalSettings.Mode.Edit)
                {
                    Personalization.SetProfile("Usability", "UserMode" + this.PortalSettings.PortalId, "EDIT");
                }

                this.Response.Redirect(this.Request.RawUrl, true);
            }
        }
コード例 #18
0
        public HttpResponseMessage AddModule(AddModuleDTO dto)
        {
            if (TabPermissionController.CanAddContentToPage() && CanAddModuleToPage())
            {
                int permissionType;
                try
                {
                    permissionType = int.Parse(dto.Visibility);
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);
                    permissionType = 0;
                }

                int positionID = -1;
                if (!string.IsNullOrEmpty(dto.Sort))
                {
                    int sortID = 0;
                    try
                    {
                        sortID = int.Parse(dto.Sort);
                        if (sortID >= 0)
                        {
                            positionID = GetPaneModuleOrder(dto.Pane, sortID);
                        }
                    }
                    catch (Exception exc)
                    {
                        Logger.Error(exc);
                    }
                }

                if (positionID == -1)
                {
                    switch (dto.Position)
                    {
                    case "TOP":
                    case "0":
                        positionID = 0;
                        break;

                    case "BOTTOM":
                    case "-1":
                        positionID = -1;
                        break;
                    }
                }

                int moduleLstID;
                try
                {
                    moduleLstID = int.Parse(dto.Module);
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);
                    moduleLstID = -1;
                }

                try
                {
                    int tabModuleId = -1;
                    if ((moduleLstID > -1))
                    {
                        if ((dto.AddExistingModule == "true"))
                        {
                            int pageID;
                            try
                            {
                                pageID = int.Parse(dto.Page);
                            }
                            catch (Exception exc)
                            {
                                Logger.Error(exc);
                                pageID = -1;
                            }

                            if ((pageID > -1))
                            {
                                tabModuleId = DoAddExistingModule(moduleLstID, pageID, dto.Pane, positionID, "", dto.CopyModule == "true");
                            }
                        }
                        else
                        {
                            tabModuleId = DoAddNewModule("", moduleLstID, dto.Pane, positionID, permissionType, "");
                        }
                    }

                    return(Request.CreateResponse(HttpStatusCode.OK, new { TabModuleID = tabModuleId }));
                }
                catch
                {
                }
            }

            return(Request.CreateResponse(HttpStatusCode.InternalServerError));
        }
コード例 #19
0
ファイル: AddModule.ascx.cs プロジェクト: misterPaul0/Curt
        protected void CmdAddModuleClick(object sender, EventArgs e)
        {
            if (TabPermissionController.CanAddContentToPage() && CanAddModuleToPage())
            {
                int permissionType;
                try
                {
                    permissionType = int.Parse(VisibilityLst.SelectedValue);
                }
                catch (Exception exc)
                {
                    DnnLog.Error(exc);

                    permissionType = 0;
                }

                int position = -1;
                switch (PositionLst.SelectedValue)
                {
                case "TOP":
                    position = 0;
                    break;

                case "ABOVE":
                    if (!string.IsNullOrEmpty(PaneModulesLst.SelectedValue))
                    {
                        try
                        {
                            position = int.Parse(PaneModulesLst.SelectedValue) - 1;
                        }
                        catch (Exception exc)
                        {
                            DnnLog.Error(exc);

                            position = -1;
                        }
                    }
                    else
                    {
                        position = 0;
                    }
                    break;

                case "BELOW":
                    if (!string.IsNullOrEmpty(PaneModulesLst.SelectedValue))
                    {
                        try
                        {
                            position = int.Parse(PaneModulesLst.SelectedValue) + 1;
                        }
                        catch (Exception exc)
                        {
                            DnnLog.Error(exc);

                            position = -1;
                        }
                    }
                    else
                    {
                        position = -1;
                    }
                    break;

                case "BOTTOM":
                    position = -1;
                    break;
                }

                int moduleLstID;
                try
                {
                    moduleLstID = int.Parse(ModuleLst.SelectedValue);
                }
                catch (Exception exc)
                {
                    DnnLog.Error(exc);

                    moduleLstID = -1;
                }

                if ((moduleLstID > -1))
                {
                    if ((AddExistingModule.Checked))
                    {
                        int pageID;
                        try
                        {
                            pageID = int.Parse(PageLst.SelectedValue);
                        }
                        catch (Exception exc)
                        {
                            DnnLog.Error(exc);

                            pageID = -1;
                        }

                        if ((pageID > -1))
                        {
                            DoAddExistingModule(moduleLstID, pageID, PaneLst.SelectedValue, position, "", chkCopyModule.Checked);
                        }
                    }
                    else
                    {
                        DoAddNewModule(Title.Text, moduleLstID, PaneLst.SelectedValue, position, permissionType, "");
                    }
                }

                Response.Redirect(Request.RawUrl, true);
            }
        }
コード例 #20
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            chkAllTabs.CheckedChanged            += OnAllTabsCheckChanged;
            chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged;
            chkWebSlice.CheckedChanged           += OnWebSliceCheckChanged;
            cboCacheProvider.TextChanged         += OnCacheProviderIndexChanged;
            cmdDelete.Click         += OnDeleteClick;
            cmdUpdate.Click         += OnUpdateClick;
            dgOnTabs.NeedDataSource += OnPagesGridNeedDataSource;

            jQuery.RequestDnnPluginsRegistration();

            //get ModuleId
            if ((Request.QueryString["ModuleId"] != null))
            {
                _moduleId = Int32.Parse(Request.QueryString["ModuleId"]);
            }
            if (Module.ContentItemId == Null.NullInteger && Module.ModuleID != Null.NullInteger)
            {
                //This tab does not have a valid ContentItem
                ModuleController.Instance.CreateContentItem(Module);

                ModuleController.Instance.UpdateModule(Module);
            }

            //Verify that the current user has access to edit this module
            if (!ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "MANAGE", Module))
            {
                if (!(IsSharedViewOnly() && TabPermissionController.CanAddContentToPage()))
                {
                    Response.Redirect(Globals.AccessDeniedURL(), true);
                }
            }
            if (Module != null)
            {
                //get module
                TabModuleId = Module.TabModuleID;

                //get Settings Control
                ModuleControlInfo moduleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID);

                if (moduleControlInfo != null)
                {
                    _control = ControlUtilities.LoadControl <Control>(Page, moduleControlInfo.ControlSrc);

                    var settingsControl = _control as ISettingsControl;
                    if (settingsControl != null)
                    {
                        //Set ID
                        var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(moduleControlInfo.ControlSrc);
                        if (fileNameWithoutExtension != null)
                        {
                            _control.ID = fileNameWithoutExtension.Replace('.', '-');
                        }

                        //add module settings
                        settingsControl.ModuleContext.Configuration = Module;

                        hlSpecificSettings.Text = Localization.GetString("ControlTitle_settings", settingsControl.LocalResourceFile);
                        if (String.IsNullOrEmpty(hlSpecificSettings.Text))
                        {
                            hlSpecificSettings.Text = String.Format(Localization.GetString("ControlTitle_settings", LocalResourceFile), Module.DesktopModule.FriendlyName);
                        }
                        pnlSpecific.Controls.Add(_control);
                    }
                }
            }
        }
コード例 #21
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        ///     [cnurse]	10/19/2004	modified to support custm module specific settings
        ///     [vmasanas]  11/28/2004  modified to support modules in admin tabs
        /// </history>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            chkAllTabs.CheckedChanged            += OnAllTabsCheckChanged;
            chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged;
            chkWebSlice.CheckedChanged           += OnWebSliceCheckChanged;
            cboCacheProvider.TextChanged         += OnCacheProviderIndexChanged;
            cmdDelete.Click         += OnDeleteClick;
            cmdUpdate.Click         += OnUpdateClick;
            dgOnTabs.NeedDataSource += OnPagesGridNeedDataSource;

            try
            {
                cancelHyperLink.NavigateUrl = Globals.NavigateURL();

                if (_moduleId != -1)
                {
                    ctlAudit.Entity = Module;
                }
                if (Page.IsPostBack == false)
                {
                    ctlIcon.FileFilter = Globals.glbImageFileTypes;

                    dgPermissions.TabId    = PortalSettings.ActiveTab.TabID;
                    dgPermissions.ModuleID = _moduleId;


                    cboTab.DataSource = TabController.GetPortalTabs(PortalId, -1, false, Null.NullString, true, false, true, false, true);
                    cboTab.DataBind();

                    //if tab is a  host tab, then add current tab
                    if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
                    {
                        cboTab.Items.Insert(0, new ListItem(PortalSettings.ActiveTab.LocalizedTabName, PortalSettings.ActiveTab.TabID.ToString()));
                    }
                    if (Module != null)
                    {
                        //parent tab might not be loaded in cbotab if user does not have edit rights on it
                        if (cboTab.Items.FindByValue(Module.TabID.ToString()) == null)
                        {
                            var objtabs = new TabController();
                            var objTab  = objtabs.GetTab(Module.TabID, Module.PortalID, false);
                            cboTab.Items.Add(new ListItem(objTab.LocalizedTabName, objTab.TabID.ToString()));
                        }
                    }

                    //only Portal Administrators can manage the visibility on all Tabs
                    rowAllTabs.Visible = PortalSecurity.IsInRole("Administrators");

                    //tab administrators can only manage their own tab
                    if (!TabPermissionController.CanAdminPage())
                    {
                        chkNewTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllModules.Enabled = false;
                        chkSearchOnce.Enabled = false;
                        cboTab.Enabled        = false;
                    }
                    if (_moduleId != -1)
                    {
                        BindData();
                        cmdDelete.Visible = ModulePermissionController.CanDeleteModule(Module) || TabPermissionController.CanAddContentToPage();
                    }
                    else
                    {
                        cboVisibility.SelectedIndex = 0; //maximized
                        chkAllTabs.Checked          = false;
                        chkSearchOnce.Checked       = false;
                        cmdDelete.Visible           = false;
                    }
                    cmdUpdate.Visible      = ModulePermissionController.HasModulePermission(Module.ModulePermissions, "EDIT,MANAGE") || TabPermissionController.CanAddContentToPage();
                    permissionsRow.Visible = ModulePermissionController.CanAdminModule(Module) || TabPermissionController.CanAddContentToPage();

                    //Set visibility of Specific Settings
                    if (SettingsControl == null == false)
                    {
                        //Get the module settings from the PortalSettings and pass the
                        //two settings hashtables to the sub control to process
                        SettingsControl.LoadSettings();
                        specificSettingsTab.Visible = true;
                        fsSpecific.Visible          = true;
                    }
                    else
                    {
                        specificSettingsTab.Visible = false;
                        fsSpecific.Visible          = false;
                    }

                    termsSelector.PortalId = Module.PortalID;
                    termsSelector.Terms    = Module.Terms;
                    termsSelector.DataBind();
                }
                cultureLanguageLabel.Language = Module.CultureCode;
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #22
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.ddlMode.SelectedIndexChanged      += this.ddlMode_SelectedIndexChanged;
            this.ddlUICulture.SelectedIndexChanged += this.ddlUICulture_SelectedIndexChanged;

            try
            {
                this.AdminPanel.Visible         = false;
                this.AdvancedToolsPanel.Visible = false;

                if (this.ControlPanel.Visible && this.IncludeInControlHierarchy)
                {
                    ClientResourceManager.RegisterStyleSheet(this.Page, "~/admin/ControlPanel/module.css");
                    ClientResourceManager.RegisterScript(this.Page, "~/Resources/ControlPanel/ControlPanel.debug.js");
                }

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);

                Control copyPageButton = this.CurrentPagePanel.FindControl("CopyPage");
                if (copyPageButton != null)
                {
                    copyPageButton.Visible = LocaleController.Instance.IsDefaultLanguage(LocaleController.Instance.GetCurrentLocale(this.PortalSettings.PortalId).Code);
                }

                if (this.Request.IsAuthenticated)
                {
                    UserInfo user = UserController.Instance.GetCurrentUserInfo();
                    if (user != null)
                    {
                        bool isAdmin = user.IsInRole(PortalSettings.Current.AdministratorRoleName);
                        this.AdminPanel.Visible = isAdmin;
                    }
                }

                if (this.IsPageAdmin())
                {
                    this.ControlPanel.Visible = true;
                    this.BodyPanel.Visible    = true;

                    if (DotNetNukeContext.Current.Application.Name == "DNNCORP.CE")
                    {
                        // Hide Support icon in CE
                        this.AdminPanel.FindControl("SupportTickets").Visible = false;
                    }
                    else
                    {
                        // Show PE/XE tools
                        this.AdvancedToolsPanel.Visible = true;
                    }

                    this.Localize();

                    if (!this.Page.IsPostBack)
                    {
                        UserInfo objUser = UserController.Instance.GetCurrentUserInfo();
                        if (objUser != null)
                        {
                            if (objUser.IsSuperUser)
                            {
                                this.hypMessage.ImageUrl = Upgrade.UpgradeIndicator(DotNetNukeContext.Current.Application.Version, this.Request.IsLocal, this.Request.IsSecureConnection);
                                if (!string.IsNullOrEmpty(this.hypMessage.ImageUrl))
                                {
                                    this.hypMessage.ToolTip     = Localization.GetString("hypUpgrade.Text", this.LocalResourceFile);
                                    this.hypMessage.NavigateUrl = Upgrade.UpgradeRedirect();
                                }
                            }
                            else
                            {
                                if (PortalSecurity.IsInRole(this.PortalSettings.AdministratorRoleName) && Host.DisplayCopyright)
                                {
                                    this.hypMessage.ImageUrl    = "~/images/branding/iconbar_logo.png";
                                    this.hypMessage.ToolTip     = DotNetNukeContext.Current.Application.Description;
                                    this.hypMessage.NavigateUrl = Localization.GetString("hypMessageUrl.Text", this.LocalResourceFile);
                                }
                                else
                                {
                                    this.hypMessage.Visible = false;
                                }

                                if (!TabPermissionController.CanAddContentToPage())
                                {
                                    this.CommonTasksPanel.Visible = false;
                                }
                            }

                            if (this.PortalSettings.AllowUserUICulture)
                            {
                                object oCulture = DotNetNuke.Services.Personalization.Personalization.GetProfile("Usability", "UICulture");
                                string currentCulture;
                                if (oCulture != null)
                                {
                                    currentCulture = oCulture.ToString();
                                }
                                else
                                {
                                    Localization l = new Localization();
                                    currentCulture = l.CurrentUICulture;
                                }

                                // Localization.LoadCultureDropDownList(ddlUICulture, CultureDropDownTypes.NativeName, currentCulture);
                                IEnumerable <ListItem> cultureListItems = Localization.LoadCultureInListItems(CultureDropDownTypes.NativeName, currentCulture, string.Empty, false);
                                foreach (var cultureItem in cultureListItems)
                                {
                                    this.ddlUICulture.AddItem(cultureItem.Text, cultureItem.Value);
                                }

                                var selectedCultureItem = this.ddlUICulture.FindItemByValue(currentCulture);
                                if (selectedCultureItem != null)
                                {
                                    selectedCultureItem.Selected = true;
                                }

                                // only show language selector if more than one language
                                if (this.ddlUICulture.Items.Count > 1)
                                {
                                    this.lblUILanguage.Visible = true;
                                    this.ddlUICulture.Visible  = true;

                                    if (oCulture == null)
                                    {
                                        this.SetLanguage(true);
                                    }
                                }
                            }
                        }

                        this.SetMode(false);
                    }
                }
                else if (this.IsModuleAdmin())
                {
                    this.ControlPanel.Visible = true;
                    this.BodyPanel.Visible    = false;
                    this.adminMenus.Visible   = false;
                    if (!this.Page.IsPostBack)
                    {
                        this.SetMode(false);
                    }
                }
                else
                {
                    this.ControlPanel.Visible = false;
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #23
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.cmdUpdate.Click += this.OnUpdateClick;

            try
            {
                this.cancelHyperLink.NavigateUrl = this.ReturnURL;

                if (this.Page.IsPostBack == false)
                {
                    this.dgPermissions.TabId    = this.PortalSettings.ActiveTab.TabID;
                    this.dgPermissions.ModuleID = this._moduleId;

                    if (this.Module != null)
                    {
                        this.cmdUpdate.Visible      = ModulePermissionController.HasModulePermission(this.Module.ModulePermissions, "EDIT,MANAGE") || TabPermissionController.CanAddContentToPage();
                        this.permissionsRow.Visible = ModulePermissionController.CanAdminModule(this.Module) || TabPermissionController.CanAddContentToPage();
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #24
0
            public static int AddModule(PortalSettings PortalSettings, int VisualizerID, int DesktopModuleId)
            {
                int tabModuleId = Null.NullInteger;

                if (TabPermissionController.CanAddContentToPage())
                {
                    foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(DesktopModuleId).Values)
                    {
                        ModuleInfo objModule = new ModuleInfo();
                        objModule.Initialize(PortalSettings.ActiveTab.PortalID);
                        objModule.PortalID     = PortalSettings.ActiveTab.PortalID;
                        objModule.TabID        = PortalSettings.ActiveTab.TabID;
                        objModule.ModuleOrder  = -1;
                        objModule.ModuleTitle  = objModuleDefinition.FriendlyName;
                        objModule.PaneName     = "ContentPane";
                        objModule.ModuleDefID  = objModuleDefinition.ModuleDefID;
                        objModule.ContainerSrc = "[g]containers/vanjaro/base.ascx";
                        objModule.DisplayTitle = true;

                        if (objModuleDefinition.DefaultCacheTime > 0)
                        {
                            objModule.CacheTime = objModuleDefinition.DefaultCacheTime;
                            if (PortalSettings.DefaultModuleId > Null.NullInteger && PortalSettings.DefaultTabId > Null.NullInteger)
                            {
                                ModuleInfo defaultModule = ModuleController.Instance.GetModule(PortalSettings.DefaultModuleId, PortalSettings.DefaultTabId, true);
                                if ((defaultModule != null))
                                {
                                    objModule.CacheTime = defaultModule.CacheTime;
                                }
                            }
                        }
                        ModuleController.Instance.InitialModulePermission(objModule, objModule.TabID, 0);
                        if (PortalSettings.ContentLocalizationEnabled)
                        {
                            Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.PortalId);
                            //set the culture of the module to that of the tab
                            TabInfo tabInfo = DotNetNuke.Entities.Tabs.TabController.Instance.GetTab(objModule.TabID, PortalSettings.PortalId, false);
                            objModule.CultureCode = tabInfo != null ? tabInfo.CultureCode : defaultLocale.Code;
                        }
                        else
                        {
                            objModule.CultureCode = Null.NullString;
                        }

                        objModule.AllTabs = false;
                        ModuleController.Instance.AddModule(objModule);
                        if (tabModuleId == Null.NullInteger)
                        {
                            tabModuleId = objModule.ModuleID;
                        }
                    }
                    if (VisualizerID > 0 && tabModuleId > 0)
                    {
                        dynamic visuInstance = GetInstance("VisualizerFactory");
                        if (visuInstance != null)
                        {
                            visuInstance.GetMethod("ActivateVisualizer", new Type[] { typeof(int), typeof(int) }).Invoke(null, new object[] { VisualizerID, tabModuleId });
                        }
                    }
                }
                return(tabModuleId);
            }
コード例 #25
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            try
            {
                chkAllTabs.CheckedChanged            += OnAllTabsCheckChanged;
                chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged;
                chkWebSlice.CheckedChanged           += OnWebSliceCheckChanged;
                cboCacheProvider.TextChanged         += OnCacheProviderIndexChanged;
                cmdDelete.Click += OnDeleteClick;
                cmdUpdate.Click += OnUpdateClick;

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);

                //get ModuleId
                if ((Request.QueryString["ModuleId"] != null))
                {
                    _moduleId = Int32.Parse(Request.QueryString["ModuleId"]);
                }
                if (Module.ContentItemId == Null.NullInteger && Module.ModuleID != Null.NullInteger)
                {
                    //This tab does not have a valid ContentItem
                    ModuleController.Instance.CreateContentItem(Module);

                    ModuleController.Instance.UpdateModule(Module);
                }

                //Verify that the current user has access to edit this module
                if (!ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "MANAGE", Module))
                {
                    if (!(IsSharedViewOnly() && TabPermissionController.CanAddContentToPage()))
                    {
                        Response.Redirect(Globals.AccessDeniedURL(), true);
                    }
                }
                if (Module != null)
                {
                    //get module
                    TabModuleId = Module.TabModuleID;

                    //get Settings Control
                    ModuleControlInfo moduleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID);

                    if (moduleControlInfo != null)
                    {
                        _control = ModuleControlFactory.LoadSettingsControl(Page, Module, moduleControlInfo.ControlSrc);

                        var settingsControl = _control as ISettingsControl;
                        if (settingsControl != null)
                        {
                            hlSpecificSettings.Text = Localization.GetString("ControlTitle_settings",
                                                                             settingsControl.LocalResourceFile);
                            if (String.IsNullOrEmpty(hlSpecificSettings.Text))
                            {
                                hlSpecificSettings.Text =
                                    String.Format(Localization.GetString("ControlTitle_settings", LocalResourceFile),
                                                  Module.DesktopModule.FriendlyName);
                            }
                            pnlSpecific.Controls.Add(_control);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                Exceptions.ProcessModuleLoadException(this, err);
            }
        }
コード例 #26
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ProcessPane processes the Attributes for the PaneControl.
        /// </summary>
        /// -----------------------------------------------------------------------------
        public void ProcessPane()
        {
            if (this.PaneControl != null)
            {
                // remove excess skin non-validating attributes
                this.PaneControl.Attributes.Remove("ContainerType");
                this.PaneControl.Attributes.Remove("ContainerName");
                this.PaneControl.Attributes.Remove("ContainerSrc");

                if (Globals.IsLayoutMode())
                {
                    this.PaneControl.Visible = true;

                    // display pane border
                    string cssclass = this.PaneControl.Attributes["class"];
                    if (string.IsNullOrEmpty(cssclass))
                    {
                        this.PaneControl.Attributes["class"] = CPaneOutline;
                    }
                    else
                    {
                        this.PaneControl.Attributes["class"] = cssclass.Replace(CPaneOutline, string.Empty).Trim().Replace("  ", " ") + " " + CPaneOutline;
                    }

                    // display pane name
                    var ctlLabel = new Label {
                        Text = "<center>" + this.Name + "</center><br />", CssClass = "SubHead"
                    };
                    this.PaneControl.Controls.AddAt(0, ctlLabel);
                }
                else
                {
                    if (this.PaneControl.Visible == false && TabPermissionController.CanAddContentToPage())
                    {
                        this.PaneControl.Visible = true;
                    }

                    if (this.CanCollapsePane())
                    {
                        // This pane has no controls so set the width to 0
                        if (this.PaneControl.Attributes["style"] != null)
                        {
                            this.PaneControl.Attributes.Remove("style");
                        }

                        if (this.PaneControl.Attributes["class"] != null)
                        {
                            this.PaneControl.Attributes["class"] = this.PaneControl.Attributes["class"] + " DNNEmptyPane";
                        }
                        else
                        {
                            this.PaneControl.Attributes["class"] = "DNNEmptyPane";
                        }
                    }

                    // Add support for drag and drop
                    if (Globals.IsEditMode()) // this call also checks for permission
                    {
                        if (this.PaneControl.Attributes["class"] != null)
                        {
                            this.PaneControl.Attributes["class"] = this.PaneControl.Attributes["class"] + " dnnSortable";
                        }
                        else
                        {
                            this.PaneControl.Attributes["class"] = "dnnSortable";
                        }
                    }
                }
            }
        }
コード例 #27
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadActions loads the Actions collections.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        private void LoadActions(HttpRequest request)
        {
            this._actions = new ModuleActionCollection();
            if (this.PortalSettings.IsLocked)
            {
                return;
            }

            this._moduleGenericActions = new ModuleAction(this.GetNextActionID(), Localization.GetString("ModuleGenericActions.Action", Localization.GlobalResourceFile), string.Empty, string.Empty, string.Empty);
            int maxActionId = Null.NullInteger;

            // check if module Implements Entities.Modules.IActionable interface
            var actionable = this._moduleControl as IActionable;

            if (actionable != null)
            {
                this._moduleSpecificActions = new ModuleAction(this.GetNextActionID(), Localization.GetString("ModuleSpecificActions.Action", Localization.GlobalResourceFile), string.Empty, string.Empty, string.Empty);

                ModuleActionCollection moduleActions = actionable.ModuleActions;

                foreach (ModuleAction action in moduleActions)
                {
                    if (ModulePermissionController.HasModuleAccess(action.Secure, "CONTENT", this.Configuration))
                    {
                        if (string.IsNullOrEmpty(action.Icon))
                        {
                            action.Icon = "edit.gif";
                        }

                        if (action.ID > maxActionId)
                        {
                            maxActionId = action.ID;
                        }

                        this._moduleSpecificActions.Actions.Add(action);

                        if (!UIUtilities.IsLegacyUI(this.ModuleId, action.ControlKey, this.PortalId) && action.Url.Contains("ctl"))
                        {
                            action.ClientScript = UrlUtils.PopUpUrl(action.Url, this._moduleControl as Control, this.PortalSettings, true, false);
                        }
                    }
                }

                if (this._moduleSpecificActions.Actions.Count > 0)
                {
                    this._actions.Add(this._moduleSpecificActions);
                }
            }

            // Make sure the Next Action Id counter is correct
            int actionCount = GetActionsCount(this._actions.Count, this._actions);

            if (this._nextActionId < maxActionId)
            {
                this._nextActionId = maxActionId;
            }

            if (this._nextActionId < actionCount)
            {
                this._nextActionId = actionCount;
            }

            // Custom injection of Module Settings when shared as ViewOnly
            if (this.Configuration != null && (this.Configuration.IsShared && this.Configuration.IsShareableViewOnly) &&
                TabPermissionController.CanAddContentToPage())
            {
                this._moduleGenericActions.Actions.Add(
                    this.GetNextActionID(),
                    Localization.GetString("ModulePermissions.Action", Localization.GlobalResourceFile),
                    "ModulePermissions",
                    string.Empty,
                    "action_settings.gif",
                    this.NavigateUrl(this.TabId, "ModulePermissions", false, "ModuleId=" + this.ModuleId, "ReturnURL=" + FilterUrl(request)),
                    false,
                    SecurityAccessLevel.ViewPermissions,
                    true,
                    false);
            }
            else
            {
                if (!Globals.IsAdminControl() && ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE,MANAGE", this.Configuration))
                {
                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", this.Configuration))
                    {
                        this._moduleGenericActions.Actions.Add(
                            this.GetNextActionID(),
                            Localization.GetString(ModuleActionType.ModuleSettings, Localization.GlobalResourceFile),
                            ModuleActionType.ModuleSettings,
                            string.Empty,
                            "action_settings.gif",
                            this.NavigateUrl(this.TabId, "Module", false, "ModuleId=" + this.ModuleId, "ReturnURL=" + FilterUrl(request)),
                            false,
                            SecurityAccessLevel.Edit,
                            true,
                            false);
                    }
                }
            }

            if (!string.IsNullOrEmpty(this.Configuration.DesktopModule.BusinessControllerClass))
            {
                // check if module implements IPortable interface, and user has Admin permissions
                if (this.Configuration.DesktopModule.IsPortable)
                {
                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "EXPORT", this.Configuration))
                    {
                        this._moduleGenericActions.Actions.Add(
                            this.GetNextActionID(),
                            Localization.GetString(ModuleActionType.ExportModule, Localization.GlobalResourceFile),
                            ModuleActionType.ExportModule,
                            string.Empty,
                            "action_export.gif",
                            this.NavigateUrl(this.PortalSettings.ActiveTab.TabID, "ExportModule", false, "moduleid=" + this.ModuleId, "ReturnURL=" + FilterUrl(request)),

                            string.Empty,
                            false,
                            SecurityAccessLevel.View,
                            true,
                            false);
                    }

                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "IMPORT", this.Configuration))
                    {
                        this._moduleGenericActions.Actions.Add(
                            this.GetNextActionID(),
                            Localization.GetString(ModuleActionType.ImportModule, Localization.GlobalResourceFile),
                            ModuleActionType.ImportModule,
                            string.Empty,
                            "action_import.gif",
                            this.NavigateUrl(this.PortalSettings.ActiveTab.TabID, "ImportModule", false, "moduleid=" + this.ModuleId, "ReturnURL=" + FilterUrl(request)),
                            string.Empty,
                            false,
                            SecurityAccessLevel.View,
                            true,
                            false);
                    }
                }

                if (this.Configuration.DesktopModule.IsSearchable && this.Configuration.DisplaySyndicate)
                {
                    this.AddSyndicateAction();
                }
            }

            // help module actions available to content editors and administrators
            const string permisisonList = "CONTENT,DELETE,EDIT,EXPORT,IMPORT,MANAGE";

            if (ModulePermissionController.HasModulePermission(this.Configuration.ModulePermissions, permisisonList) &&
                request.QueryString["ctl"] != "Help" &&
                !Globals.IsAdminControl())
            {
                this.AddHelpActions();
            }

            // Add Print Action
            if (this.Configuration.DisplayPrint)
            {
                // print module action available to everyone
                this.AddPrintAction();
            }

            if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Host, "MANAGE", this.Configuration) && !Globals.IsAdminControl())
            {
                this._moduleGenericActions.Actions.Add(
                    this.GetNextActionID(),
                    Localization.GetString(ModuleActionType.ViewSource, Localization.GlobalResourceFile),
                    ModuleActionType.ViewSource,
                    string.Empty,
                    "action_source.gif",
                    this.NavigateUrl(this.TabId, "ViewSource", false, "ModuleId=" + this.ModuleId, "ctlid=" + this.Configuration.ModuleControlId, "ReturnURL=" + FilterUrl(request)),
                    false,
                    SecurityAccessLevel.Host,
                    true,
                    false);
            }

            if (!Globals.IsAdminControl() && ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE,MANAGE", this.Configuration))
            {
                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE", this.Configuration))
                {
                    // Check if this is the owner instance of a shared module.
                    string confirmText = "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteModule.Confirm")) + "')";
                    if (!this.Configuration.IsShared)
                    {
                        var portal = PortalController.Instance.GetPortal(this.PortalSettings.PortalId);
                        if (PortalGroupController.Instance.IsModuleShared(this.Configuration.ModuleID, portal))
                        {
                            confirmText = "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteSharedModule.Confirm")) + "')";
                        }
                    }

                    this._moduleGenericActions.Actions.Add(
                        this.GetNextActionID(),
                        Localization.GetString(ModuleActionType.DeleteModule, Localization.GlobalResourceFile),
                        ModuleActionType.DeleteModule,
                        this.Configuration.ModuleID.ToString(),
                        "action_delete.gif",
                        string.Empty,
                        confirmText,
                        false,
                        SecurityAccessLevel.View,
                        true,
                        false);
                }

                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", this.Configuration))
                {
                    this._moduleGenericActions.Actions.Add(
                        this.GetNextActionID(),
                        Localization.GetString(ModuleActionType.ClearCache, Localization.GlobalResourceFile),
                        ModuleActionType.ClearCache,
                        this.Configuration.ModuleID.ToString(),
                        "action_refresh.gif",
                        string.Empty,
                        false,
                        SecurityAccessLevel.View,
                        true,
                        false);
                }

                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", this.Configuration))
                {
                    // module movement
                    this.AddMenuMoveActions();
                }
            }

            if (this._moduleGenericActions.Actions.Count > 0)
            {
                this._actions.Add(this._moduleGenericActions);
            }

            if (this._moduleMoveActions != null && this._moduleMoveActions.Actions.Count > 0)
            {
                this._actions.Add(this._moduleMoveActions);
            }

            foreach (ModuleAction action in this._moduleGenericActions.Actions)
            {
                if (!UIUtilities.IsLegacyUI(this.ModuleId, action.ControlKey, this.PortalId) && action.Url.Contains("ctl"))
                {
                    action.ClientScript = UrlUtils.PopUpUrl(action.Url, this._moduleControl as Control, this.PortalSettings, true, false);
                }
            }
        }
コード例 #28
0
ファイル: IconBar.ascx.cs プロジェクト: ryanmalone/BGDNNWEB
        protected void AddModule_Click(object sender, EventArgs e)
        {
            try
            {
                if (TabPermissionController.CanAddContentToPage())
                {
                    string title = txtTitle.Text;

                    ViewPermissionType permissionType = ViewPermissionType.View;
                    if (cboPermission.SelectedItem != null)
                    {
                        permissionType = (ViewPermissionType)Enum.Parse(typeof(ViewPermissionType), cboPermission.SelectedItem.Value);
                    }
                    int position = -1;
                    if (cboPosition.SelectedItem != null)
                    {
                        switch (cboPosition.SelectedItem.Value)
                        {
                        case "TOP":
                            position = 0;
                            break;

                        case "ABOVE":
                            if (!string.IsNullOrEmpty(cboInstances.SelectedValue))
                            {
                                position = int.Parse(cboInstances.SelectedItem.Value) - 1;
                            }
                            else
                            {
                                position = 0;
                            }
                            break;

                        case "BELOW":
                            if (!string.IsNullOrEmpty(cboInstances.SelectedValue))
                            {
                                position = int.Parse(cboInstances.SelectedItem.Value) + 1;
                            }
                            else
                            {
                                position = -1;
                            }
                            break;

                        case "BOTTOM":
                            position = -1;
                            break;
                        }
                    }
                    switch (optModuleType.SelectedItem.Value)
                    {
                    case "0":     //new module
                        if (cboDesktopModules.SelectedIndex > 0)
                        {
                            AddNewModule(title, int.Parse(cboDesktopModules.SelectedItem.Value), cboPanes.SelectedItem.Text, position, permissionType, "");

                            //Redirect to the same page to pick up changes
                            Response.Redirect(Request.RawUrl, true);
                        }
                        break;

                    case "1":     //existing module
                        if (cboModules.SelectedItem != null)
                        {
                            AddExistingModule(int.Parse(cboModules.SelectedItem.Value), int.Parse(cboTabs.SelectedItem.Value), cboPanes.SelectedItem.Text, position, "");

                            //Redirect to the same page to pick up changes
                            Response.Redirect(Request.RawUrl, true);
                        }
                        break;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #29
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                cancelHyperLink.NavigateUrl = ReturnURL;

                if (_moduleId != -1)
                {
                    ctlAudit.Entity = Module;
                }
                if (Page.IsPostBack == false)
                {
                    ctlIcon.FileFilter = Globals.glbImageFileTypes;

                    dgPermissions.TabId    = PortalSettings.ActiveTab.TabID;
                    dgPermissions.ModuleID = _moduleId;

                    var tabsByModule = TabController.Instance.GetTabsByModuleID(_moduleId);
                    tabsByModule.Remove(TabId);
                    dgOnTabs.DataSource = tabsByModule.Values;
                    dgOnTabs.DataBind();

                    cboTab.DataSource = TabController.GetPortalTabs(PortalId, -1, false, Null.NullString, true, false, true, false, true);
                    cboTab.DataBind();

                    //if tab is a  host tab, then add current tab
                    if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
                    {
                        cboTab.InsertItem(0, PortalSettings.ActiveTab.LocalizedTabName, PortalSettings.ActiveTab.TabID.ToString());
                    }
                    if (Module != null)
                    {
                        if (cboTab.FindItemByValue(Module.TabID.ToString()) == null)
                        {
                            var objTab = TabController.Instance.GetTab(Module.TabID, Module.PortalID, false);
                            cboTab.AddItem(objTab.LocalizedTabName, objTab.TabID.ToString());
                        }
                    }

                    //only Portal Administrators can manage the visibility on all Tabs
                    var isAdmin = PermissionProvider.Instance().IsPortalEditor();
                    rowAllTabs.Visible    = isAdmin;
                    chkAllModules.Enabled = isAdmin;

                    if (HideCancelButton)
                    {
                        cancelHyperLink.Visible = false;
                    }

                    //tab administrators can only manage their own tab
                    if (!TabPermissionController.CanAdminPage())
                    {
                        chkNewTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllowIndex.Enabled = false;
                        cboTab.Enabled        = false;
                    }

                    if (_moduleId != -1)
                    {
                        BindData();
                        cmdDelete.Visible = (ModulePermissionController.CanDeleteModule(Module) ||
                                             TabPermissionController.CanAddContentToPage()) && !HideDeleteButton;
                    }
                    else
                    {
                        isShareableCheckBox.Checked         = true;
                        isShareableViewOnlyCheckBox.Checked = true;
                        isShareableRow.Visible = true;

                        cboVisibility.SelectedIndex = 0; //maximized
                        chkAllTabs.Checked          = false;
                        cmdDelete.Visible           = false;
                    }
                    if (Module != null)
                    {
                        cmdUpdate.Visible      = ModulePermissionController.HasModulePermission(Module.ModulePermissions, "EDIT,MANAGE") || TabPermissionController.CanAddContentToPage();
                        permissionsRow.Visible = ModulePermissionController.CanAdminModule(Module) || TabPermissionController.CanAddContentToPage();
                    }

                    //Set visibility of Specific Settings
                    if (SettingsControl == null == false)
                    {
                        //Get the module settings from the PortalSettings and pass the
                        //two settings hashtables to the sub control to process
                        SettingsControl.LoadSettings();
                        specificSettingsTab.Visible = true;
                        fsSpecific.Visible          = true;
                    }
                    else
                    {
                        specificSettingsTab.Visible = false;
                        fsSpecific.Visible          = false;
                    }

                    if (Module != null)
                    {
                        termsSelector.PortalId = Module.PortalID;
                        termsSelector.Terms    = Module.Terms;
                    }
                    termsSelector.DataBind();
                }
                if (Module != null)
                {
                    cultureLanguageLabel.Language = Module.CultureCode;
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #30
0
 public void ProcessPane()
 {
     if (PaneControl != null)
     {
         PaneControl.Attributes.Remove("ContainerType");
         PaneControl.Attributes.Remove("ContainerName");
         PaneControl.Attributes.Remove("ContainerSrc");
         if (Globals.IsLayoutMode())
         {
             PaneControl.Visible = true;
             string cssclass = PaneControl.Attributes["class"];
             if (string.IsNullOrEmpty(cssclass))
             {
                 PaneControl.Attributes["class"] = c_PaneOutline;
             }
             else
             {
                 PaneControl.Attributes["class"] = cssclass.Replace(c_PaneOutline, "").Trim().Replace("  ", " ") + " " + c_PaneOutline;
             }
             Label ctlLabel = new Label();
             ctlLabel.Text     = "<center>" + Name + "</center><br>";
             ctlLabel.CssClass = "SubHead";
             PaneControl.Controls.AddAt(0, ctlLabel);
         }
         else
         {
             if (TabPermissionController.CanAddContentToPage() && PaneControl.Visible == false)
             {
                 PaneControl.Visible = true;
             }
             bool collapsePanes = true;
             if (Containers.Count > 0)
             {
                 collapsePanes = false;
             }
             else if (PaneControl.Controls.Count == 0)
             {
                 collapsePanes = true;
             }
             else if (PaneControl.Controls.Count == 1)
             {
                 collapsePanes = false;
                 LiteralControl literal = PaneControl.Controls[0] as LiteralControl;
                 if (literal != null)
                 {
                     if (String.IsNullOrEmpty(HtmlUtils.StripWhiteSpace(literal.Text, false)))
                     {
                         collapsePanes = true;
                     }
                 }
             }
             else
             {
                 collapsePanes = false;
             }
             if (collapsePanes)
             {
                 if (PaneControl.Attributes["style"] != null)
                 {
                     PaneControl.Attributes.Remove("style");
                 }
                 if (PaneControl.Attributes["class"] != null)
                 {
                     PaneControl.Attributes["class"] = PaneControl.Attributes["class"] + " EmptyPane";
                 }
                 else
                 {
                     PaneControl.Attributes["class"] = "EmptyPane";
                 }
             }
         }
     }
 }