protected override void OnPreRender(EventArgs evt)
        {
            base.OnPreRender(evt);

            //process the current request
            if (!Globals.IsAdminControl())
            {
                ManageRequest();
            }

            //Set the Head tags
            metaPanel.Visible = !UrlUtils.InPopUp();
            if (!UrlUtils.InPopUp())
            {
                MetaGenerator.Content = Generator;
                MetaGenerator.Visible = (!String.IsNullOrEmpty(Generator));
                MetaAuthor.Content    = PortalSettings.PortalName;

                /*
                 * Never show to be html5 compatible and stay backward compatible
                 *
                 * MetaCopyright.Content = Copyright;
                 * MetaCopyright.Visible = (!String.IsNullOrEmpty(Copyright));
                 */
                MetaKeywords.Content    = KeyWords;
                MetaKeywords.Visible    = (!String.IsNullOrEmpty(KeyWords));
                MetaDescription.Content = Description;
                MetaDescription.Visible = (!String.IsNullOrEmpty(Description));
            }
            Page.Header.Title = Title;
            if (!string.IsNullOrEmpty(PortalSettings.AddCompatibleHttpHeader))
            {
                Page.Response.AddHeader("X-UA-Compatible", PortalSettings.AddCompatibleHttpHeader);
            }
        }
Esempio n. 2
0
        /// ----------------------------------------------------------------------------
        /// <summary>
        /// Gets a flag that indicates whether the Module Content should be displayed
        /// </summary>
        /// <returns>A Boolean</returns>
        private bool DisplayContent()
        {
            //module content visibility options
            var content = PortalSettings.UserMode != PortalSettings.Mode.Layout;

            if (Page.Request.QueryString["content"] != null)
            {
                switch (Page.Request.QueryString["Content"].ToLowerInvariant())
                {
                case "1":
                case "true":
                    content = true;
                    break;

                case "0":
                case "false":
                    content = false;
                    break;
                }
            }
            if (Globals.IsAdminControl())
            {
                content = true;
            }
            return(content);
        }
Esempio n. 3
0
        protected override void OnPreRender(EventArgs evt)
        {
            base.OnPreRender(evt);

            //process the current request
            if (!Globals.IsAdminControl())
            {
                ManageRequest();
            }

            //Set the Head tags
            metaPanel.Visible = !UrlUtils.InPopUp();
            if (!UrlUtils.InPopUp())
            {
                MetaGenerator.Content   = Generator;
                MetaGenerator.Visible   = (!String.IsNullOrEmpty(Generator));
                MetaAuthor.Content      = PortalSettings.PortalName;
                MetaCopyright.Content   = Copyright;
                MetaCopyright.Visible   = (!String.IsNullOrEmpty(Copyright));
                MetaKeywords.Content    = KeyWords;
                MetaKeywords.Visible    = (!String.IsNullOrEmpty(KeyWords));
                MetaDescription.Content = Description;
                MetaDescription.Visible = (!String.IsNullOrEmpty(Description));
            }
            Page.Header.Title = Title;
        }
Esempio n. 4
0
        private void InjectModuleContent(Control content)
        {
            if (_moduleConfiguration.IsWebSlice && !Globals.IsAdminControl())
            {
                //Assign the class - hslice to the Drag-N-Drop Panel
                CssClass = "hslice";
                var titleLabel = new Label
                {
                    CssClass = "entry-title Hidden",
                    Text     = !string.IsNullOrEmpty(_moduleConfiguration.WebSliceTitle) ? _moduleConfiguration.WebSliceTitle : _moduleConfiguration.ModuleTitle
                };
                Controls.Add(titleLabel);

                var websliceContainer = new Panel {
                    CssClass = "entry-content"
                };
                websliceContainer.Controls.Add(content);

                var expiry = new HtmlGenericControl {
                    TagName = "abbr"
                };
                expiry.Attributes["class"] = "endtime";
                if (!Null.IsNull(_moduleConfiguration.WebSliceExpiryDate))
                {
                    expiry.Attributes["title"] = _moduleConfiguration.WebSliceExpiryDate.ToString("o");
                    websliceContainer.Controls.Add(expiry);
                }
                else if (_moduleConfiguration.EndDate < DateTime.MaxValue)
                {
                    expiry.Attributes["title"] = _moduleConfiguration.EndDate.ToString("o");
                    websliceContainer.Controls.Add(expiry);
                }

                var ttl = new HtmlGenericControl {
                    TagName = "abbr"
                };
                ttl.Attributes["class"] = "ttl";
                if (_moduleConfiguration.WebSliceTTL > 0)
                {
                    ttl.Attributes["title"] = _moduleConfiguration.WebSliceTTL.ToString();
                    websliceContainer.Controls.Add(ttl);
                }
                else if (_moduleConfiguration.CacheTime > 0)
                {
                    ttl.Attributes["title"] = (_moduleConfiguration.CacheTime / 60).ToString();
                    websliceContainer.Controls.Add(ttl);
                }

                Controls.Add(websliceContainer);
            }
            else
            {
                Controls.Add(content);
            }
        }
Esempio n. 5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnInit runs when the Skin is initialised.
        /// </summary>
        /// -----------------------------------------------------------------------------
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // Load the Panes
            this.LoadPanes();

            // Load the Module Control(s)
            bool success = Globals.IsAdminControl() ? this.ProcessSlaveModule() : this.ProcessMasterModules();

            // Load the Control Panel
            this.InjectControlPanel();

            // Register any error messages on the Skin
            if (this.Request.QueryString["error"] != null && Host.ShowCriticalErrors)
            {
                AddPageMessage(this, Localization.GetString("CriticalError.Error"), " ", ModuleMessage.ModuleMessageType.RedError);

                if (UserController.Instance.GetCurrentUserInfo().IsSuperUser)
                {
                    ServicesFramework.Instance.RequestAjaxScriptSupport();
                    ServicesFramework.Instance.RequestAjaxAntiForgerySupport();

                    JavaScript.RequestRegistration(CommonJs.jQueryUI);
                    JavaScript.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn_dom);
                    ClientResourceManager.RegisterScript(this.Page, "~/resources/shared/scripts/dnn.logViewer.js");
                }
            }

            if (!TabPermissionController.CanAdminPage() && !success)
            {
                // only display the warning to non-administrators (administrators will see the errors)
                AddPageMessage(this, Localization.GetString("ModuleLoadWarning.Error"), string.Format(Localization.GetString("ModuleLoadWarning.Text"), this.PortalSettings.Email), ModuleMessage.ModuleMessageType.YellowWarning);
            }

            this.InvokeSkinEvents(SkinEventType.OnSkinInit);

            if (HttpContext.Current != null && HttpContext.Current.Items.Contains(OnInitMessage))
            {
                var messageType = ModuleMessage.ModuleMessageType.YellowWarning;
                if (HttpContext.Current.Items.Contains(OnInitMessageType))
                {
                    messageType = (ModuleMessage.ModuleMessageType)Enum.Parse(typeof(ModuleMessage.ModuleMessageType), HttpContext.Current.Items[OnInitMessageType].ToString(), true);
                }

                AddPageMessage(this, string.Empty, HttpContext.Current.Items[OnInitMessage].ToString(), messageType);

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);
                ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
            }

            // Process the Panes attributes
            this.ProcessPanes();
        }
Esempio n. 6
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	9/8/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            // Verify if portal has a customized login page
            if (!Null.IsNull(PortalSettings.LoginTabId) && Globals.IsAdminControl())
            {
                // login page exists and trying to access this control directly with url param -> not allowed
                Response.Redirect(Globals.NavigateURL(PortalSettings.LoginTabId));
            }

            ClientAPI.RegisterKeyCapture(this.Parent, this.cmdLogin, '\r');

            if (Request.UserHostAddress != null)
            {
                ipAddress = Request.UserHostAddress;
            }

            if (Page.IsPostBack == false)
            {
                try
                {
                    if (Request.QueryString["verificationcode"] != null)
                    {
                        if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration)
                        {
                            //Display Verification Rows
                            rowVerification1.Visible = true;
                            rowVerification2.Visible = true;
                            txtVerification.Text     = Request.QueryString["verificationcode"];
                        }
                    }

                    PageNo = 0;
                    if (Request.QueryString["username"] != null)
                    {
                        txtUsername.Text = Request.QueryString["username"];
                        Globals.SetFormFocus(txtPassword);
                    }
                    else
                    {
                        Globals.SetFormFocus(txtUsername);
                    }
                }
                catch
                {
                    //control not there or error setting focus
                }
            }

            ShowPanel();
        }
Esempio n. 7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // process the current request
            if (!Globals.IsAdminControl())
            {
                ManageRequest();
            }

            //Set the Head tags
            Page.Header.Title       = Title;
            MetaGenerator.Content   = Generator;
            MetaAuthor.Content      = PortalSettings.PortalName;
            MetaCopyright.Content   = Copyright;
            MetaKeywords.Content    = KeyWords;
            MetaDescription.Content = Description;
        }
        protected override void OnPreRender(EventArgs evt)
        {
            base.OnPreRender(evt);

            //process the current request
            if (!Globals.IsAdminControl())
            {
                ManageRequest();
            }

            //Set the Head tags
            metaPanel.Visible = !UrlUtils.InPopUp();
            if (!UrlUtils.InPopUp())
            {
                MetaGenerator.Content = Generator;
                MetaGenerator.Visible = (!String.IsNullOrEmpty(Generator));
                MetaAuthor.Content    = PortalSettings.PortalName;

                /*
                 * Never show to be html5 compatible and stay backward compatible
                 *
                 * MetaCopyright.Content = Copyright;
                 * MetaCopyright.Visible = (!String.IsNullOrEmpty(Copyright));
                 */
                MetaKeywords.Content    = KeyWords;
                MetaKeywords.Visible    = (!String.IsNullOrEmpty(KeyWords));
                MetaDescription.Content = Description;
                MetaDescription.Visible = (!String.IsNullOrEmpty(Description));
            }
            Page.Header.Title = Title;
            if (!string.IsNullOrEmpty(PortalSettings.AddCompatibleHttpHeader))
            {
                Page.Response.AddHeader("X-UA-Compatible", PortalSettings.AddCompatibleHttpHeader);
            }

            if (!string.IsNullOrEmpty(CanonicalLinkUrl))
            {
                //Add Canonical <link> using the primary alias
                var canonicalLink = new HtmlLink();
                canonicalLink.Href = CanonicalLinkUrl;
                canonicalLink.Attributes.Add("rel", "canonical");

                // Add the HtmlLink to the Head section of the page.
                Page.Header.Controls.Add(canonicalLink);
            }
        }
Esempio n. 9
0
        private bool CanAddAction(SecurityAccessLevel access, bool checkAdminControl)
        {
            bool   canAdd;
            string userName = Null.NullString;

            if (UserInfo != null)
            {
                userName = UserInfo.Username;
            }
            canAdd = PortalSecurity.HasNecessaryPermission(access, PortalSettings, ModuleConfiguration, userName);
            if (canAdd && checkAdminControl)
            {
                canAdd = EditMode && !ModuleConfiguration.IsAdmin && !(Globals.IsAdminControl());
            }

            return(canAdd);
        }
Esempio n. 10
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnInit runs when the Skin is initialised.
        /// </summary>
        /// <history>
        ///     [cnurse]	07/04/2005	Documented
        ///     [cnurse]    12/05/2007  Refactored
        ///     [cnurse]    04/17/2009  Refactored to use SkinAdapter
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //Load the Panes
            LoadPanes();

            bool success;

            //Load the Module Control(s)
            success = Globals.IsAdminControl() ? ProcessSlaveModule() : ProcessMasterModules();

            //Load the Control Panel
            InjectControlPanel();

            //Register any error messages on the Skin
            if (Request.QueryString["error"] != null)
            {
                AddPageMessage(this, Localization.GetString("CriticalError.Error"), Server.HtmlEncode(Request.QueryString["error"]), ModuleMessage.ModuleMessageType.RedError);
            }

            if (!TabPermissionController.CanAdminPage() && !success)
            {
                //only display the warning to non-administrators (administrators will see the errors)
                AddPageMessage(this, Localization.GetString("ModuleLoadWarning.Error"), string.Format(Localization.GetString("ModuleLoadWarning.Text"), PortalSettings.Email), ModuleMessage.ModuleMessageType.YellowWarning);
            }

            InvokeSkinEvents(SkinEventType.OnSkinInit);

            if (HttpContext.Current != null && HttpContext.Current.Items.Contains(OnInitMessage))
            {
                var messageType = ModuleMessage.ModuleMessageType.YellowWarning;
                if (HttpContext.Current.Items.Contains(OnInitMessageType))
                {
                    messageType = (ModuleMessage.ModuleMessageType)Enum.Parse(typeof(ModuleMessage.ModuleMessageType), HttpContext.Current.Items[OnInitMessageType].ToString(), true);
                }
                AddPageMessage(this, string.Empty, HttpContext.Current.Items[OnInitMessage].ToString(), messageType);
            }

            //Process the Panes attributes
            ProcessPanes();
        }
Esempio n. 11
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     if (ModuleContent != null && ModuleControl != null && !Globals.IsAdminControl())
     {
         switch (ModuleControl.ModuleContext.Configuration.Visibility)
         {
         case VisibilityState.Maximized:
         case VisibilityState.Minimized:
             DNNClientAPI.EnableMinMax(cmdVisibility,
                                       ModuleContent,
                                       ModuleControl.ModuleContext.ModuleId,
                                       ModuleControl.ModuleContext.Configuration.Visibility == VisibilityState.Minimized,
                                       MinIconLoc,
                                       MaxIconLoc,
                                       DNNClientAPI.MinMaxPersistanceType.Cookie,
                                       AnimationFrames);
             break;
         }
     }
 }
Esempio n. 12
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);
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <history>
        ///     [cnurse]	10/06/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    // localization
                    lblPageFunctions.Text = Localization.GetString("PageFunctions", this.LocalResourceFile);
                    optModuleType.Items.FindByValue("0").Selected = true;
                    lblCommonTasks.Text         = Localization.GetString("CommonTasks", this.LocalResourceFile);
                    imgAddTabIcon.AlternateText = Localization.GetString("AddTab.AlternateText", this.LocalResourceFile);
                    cmdAddTab.Text = Localization.GetString("AddTab", this.LocalResourceFile);
                    imgEditTabIcon.AlternateText = Localization.GetString("EditTab.AlternateText", this.LocalResourceFile);
                    cmdEditTab.Text = Localization.GetString("EditTab", this.LocalResourceFile);
                    imgDeleteTabIcon.AlternateText = Localization.GetString("DeleteTab.AlternateText", this.LocalResourceFile);
                    cmdDeleteTab.Text            = Localization.GetString("DeleteTab", this.LocalResourceFile);
                    imgCopyTabIcon.AlternateText = Localization.GetString("CopyTab.AlternateText", this.LocalResourceFile);
                    cmdCopyTab.Text = Localization.GetString("CopyTab", this.LocalResourceFile);
                    imgPreviewTabIcon.AlternateText = Localization.GetString("PreviewTab.AlternateText", this.LocalResourceFile);
                    cmdPreviewTab.Text = Localization.GetString("PreviewTab", this.LocalResourceFile);
                    if (IsPreview)
                    {
                        imgPreviewTabIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_unpreviewtab.gif";
                    }
                    lblModule.Text = Localization.GetString("Module", this.LocalResourceFile);
                    lblPane.Text   = Localization.GetString("Pane", this.LocalResourceFile);
                    lblTitle.Text  = Localization.GetString("Title", this.LocalResourceFile);
                    lblAlign.Text  = Localization.GetString("Align", this.LocalResourceFile);
                    imgAddModuleIcon.AlternateText = Localization.GetString("AddModule.AlternateText", this.LocalResourceFile);
                    cmdAddModule.Text          = Localization.GetString("AddModule", this.LocalResourceFile);
                    cmdInstallFeatures.Text    = Localization.GetString("InstallFeatures", this.LocalResourceFile);
                    imgRolesIcon.AlternateText = Localization.GetString("Roles.AlternateText", this.LocalResourceFile);
                    cmdRoles.Text             = Localization.GetString("Roles", this.LocalResourceFile);
                    imgSiteIcon.AlternateText = Localization.GetString("Site.AlternateText", this.LocalResourceFile);
                    cmdSite.Text = Localization.GetString("Site", this.LocalResourceFile);
                    imgUsersIcon.AlternateText = Localization.GetString("Users.AlternateText", this.LocalResourceFile);
                    cmdUsers.Text = Localization.GetString("Users", this.LocalResourceFile);
                    imgFilesIcon.AlternateText = Localization.GetString("Files.AlternateText", this.LocalResourceFile);
                    cmdFiles.Text = Localization.GetString("Files", this.LocalResourceFile);
                    imgSearchIndexIcon.AlternateText = Localization.GetString("SearchIndex.AlternateText", this.LocalResourceFile);
                    cmdSearchIndex.Text = Localization.GetString("SearchIndex", this.LocalResourceFile);

                    if (PortalSettings.ActiveTab.IsAdminTab)
                    {
                        imgEditTabIcon.ImageUrl   = "~/Admin/ControlPanel/images/iconbar_edittab_bw.gif";
                        cmdEditTab.Enabled        = false;
                        cmdEditTabIcon.Enabled    = false;
                        imgDeleteTabIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_deletetab_bw.gif";
                        cmdDeleteTab.Enabled      = false;
                        cmdDeleteTabIcon.Enabled  = false;
                        imgCopyTabIcon.ImageUrl   = "~/Admin/ControlPanel/images/iconbar_copytab_bw.gif";
                        cmdCopyTab.Enabled        = false;
                        cmdCopyTabIcon.Enabled    = false;
                    }
                    else
                    {
                        ClientAPI.AddButtonConfirm(cmdDeleteTab, Localization.GetString("DeleteTabConfirm", this.LocalResourceFile));
                        ClientAPI.AddButtonConfirm(cmdDeleteTabIcon, Localization.GetString("DeleteTabConfirm", this.LocalResourceFile));
                    }

                    if (Globals.IsAdminControl())
                    {
                        cmdAddModule.Enabled      = false;
                        imgAddModuleIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_addmodule_bw.gif";
                        cmdAddModuleIcon.Enabled  = false;
                    }

                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) == false)
                    {
                        imgSiteIcon.ImageUrl  = "~/Admin/ControlPanel/images/iconbar_site_bw.gif";
                        cmdSite.Enabled       = false;
                        cmdSiteIcon.Enabled   = false;
                        imgUsersIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_users_bw.gif";
                        cmdUsers.Enabled      = false;
                        cmdUsersIcon.Enabled  = false;
                        imgRolesIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_roles_bw.gif";
                        cmdRoles.Enabled      = false;
                        cmdRolesIcon.Enabled  = false;
                        imgFilesIcon.ImageUrl = "~/Admin/ControlPanel/images/iconbar_files_bw.gif";
                        cmdFiles.Enabled      = false;
                        cmdFilesIcon.Enabled  = false;
                    }

                    UserInfo objUser = UserController.GetCurrentUserInfo();
                    if (objUser != null)
                    {
                        if (!objUser.IsSuperUser)
                        {
                            rowInstallModule.Visible = false;
                        }
                    }

                    BindData();

                    if (PortalSettings.ActiveTab.IsAdminTab == false & Globals.IsAdminControl() == false)
                    {
                        for (int intItem = 0; intItem < PortalSettings.ActiveTab.Panes.Count; intItem++)
                        {
                            cboPanes.Items.Add(Convert.ToString(PortalSettings.ActiveTab.Panes[intItem]));
                        }
                    }
                    else
                    {
                        cboPanes.Items.Add(Globals.glbDefaultPane);
                    }
                    if (cboPanes.Items.FindByValue(Globals.glbDefaultPane) != null)
                    {
                        cboPanes.Items.FindByValue(Globals.glbDefaultPane).Selected = true;
                    }

                    if (cboPermission.Items.Count > 0)
                    {
                        cboPermission.SelectedIndex = 0; // view
                    }

                    if (cboAlign.Items.Count > 0)
                    {
                        cboAlign.SelectedIndex = 0; // left
                    }

                    if (cboPosition.Items.Count > 0)
                    {
                        cboPosition.SelectedIndex = 1; // bottom
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 14
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// InjectModule injects a Module (and its container) into the Pane
        /// </summary>
        /// <param name="module">The Module</param>
        /// -----------------------------------------------------------------------------
        public void InjectModule(ModuleInfo module)
        {
            _containerWrapperControl = new HtmlGenericControl("div");
            PaneControl.Controls.Add(_containerWrapperControl);

            //inject module classes
            string classFormatString   = "DnnModule DnnModule-{0} DnnModule-{1}";
            string sanitizedModuleName = Null.NullString;

            if (!String.IsNullOrEmpty(module.DesktopModule.ModuleName))
            {
                sanitizedModuleName = Globals.CreateValidClass(module.DesktopModule.ModuleName, false);
            }

            if (IsVesionableModule(module))
            {
                classFormatString += " DnnVersionableControl";
            }

            _containerWrapperControl.Attributes["class"] = String.Format(classFormatString, sanitizedModuleName, module.ModuleID);

            try
            {
                if (!Globals.IsAdminControl() && PortalSettings.InjectModuleHyperLink)
                {
                    _containerWrapperControl.Controls.Add(new LiteralControl("<a name=\"" + module.ModuleID + "\"></a>"));
                }

                //Load container control
                Containers.Container container = LoadModuleContainer(module);

                //Add Container to Dictionary
                Containers.Add(container.ID, container);

                // hide anything of type ActionsMenu - as we're injecting our own menu now.
                container.InjectActionMenu = (container.Controls.OfType <ActionBase>().Count() == 0);
                if (!container.InjectActionMenu)
                {
                    foreach (var actionControl in container.Controls.OfType <IActionControl>())
                    {
                        if (actionControl is ActionsMenu)
                        {
                            Control control = actionControl as Control;
                            if (control != null)
                            {
                                control.Visible            = false;
                                container.InjectActionMenu = true;
                            }
                        }
                    }
                }

                if (Globals.IsLayoutMode() && Globals.IsAdminControl() == false)
                {
                    //provide Drag-N-Drop capabilities
                    var     dragDropContainer = new Panel();
                    Control title             = container.FindControl("dnnTitle");
                    //Assume that the title control is named dnnTitle.  If this becomes an issue we could loop through the controls looking for the title type of skin object
                    dragDropContainer.ID = container.ID + "_DD";
                    _containerWrapperControl.Controls.Add(dragDropContainer);

                    //inject the container into the page pane - this triggers the Pre_Init() event for the user control
                    dragDropContainer.Controls.Add(container);

                    if (title != null)
                    {
                        if (title.Controls.Count > 0)
                        {
                            title = title.Controls[0];
                        }
                    }

                    //enable drag and drop
                    if (title != null)
                    {
                        //The title ID is actually the first child so we need to make sure at least one child exists
                        DNNClientAPI.EnableContainerDragAndDrop(title, dragDropContainer, module.ModuleID);
                        ClientAPI.RegisterPostBackEventHandler(PaneControl, "MoveToPane", ModuleMoveToPanePostBack, false);
                    }
                }
                else
                {
                    _containerWrapperControl.Controls.Add(container);
                    if (Globals.IsAdminControl())
                    {
                        _containerWrapperControl.Attributes["class"] += " DnnModule-Admin";
                    }
                }

                //Attach Module to Container
                container.SetModuleConfiguration(module);

                //display collapsible page panes
                if (PaneControl.Visible == false)
                {
                    PaneControl.Visible = true;
                }
            }
            catch (ThreadAbortException)
            {
                //Response.Redirect may called in module control's OnInit method, so it will cause ThreadAbortException, no need any action here.
            }
            catch (Exception exc)
            {
                var lex = new ModuleLoadException(string.Format(Skin.MODULEADD_ERROR, PaneControl.ID), exc);
                if (TabPermissionController.CanAdminPage())
                {
                    //only display the error to administrators
                    _containerWrapperControl.Controls.Add(new ErrorContainer(PortalSettings, Skin.MODULELOAD_ERROR, lex).Container);
                }
                Exceptions.LogException(exc);
                throw lex;
            }
        }
Esempio n. 15
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <remarks>
        /// - Obtain PortalSettings from Current Context
        /// - redirect to a specific tab based on name
        /// - if first time loading this page then reload to avoid caching
        /// - set page title and stylesheet
        /// - check to see if we should show the Assembly Version in Page Title
        /// - set the background image if there is one selected
        /// - set META tags, copyright, keywords and description
        /// </remarks>
        /// <history>
        ///     [sun1]	1/19/2004	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void InitializePage()
        {
            var tabController = new TabController();

            //redirect to a specific tab based on name
            if (!String.IsNullOrEmpty(Request.QueryString["tabname"]))
            {
                TabInfo tab = tabController.GetTabByName(Request.QueryString["TabName"], ((PortalSettings)HttpContext.Current.Items["PortalSettings"]).PortalId);
                if (tab != null)
                {
                    var parameters = new List <string>(); //maximum number of elements
                    for (int intParam = 0; intParam <= Request.QueryString.Count - 1; intParam++)
                    {
                        switch (Request.QueryString.Keys[intParam].ToLower())
                        {
                        case "tabid":
                        case "tabname":
                            break;

                        default:
                            parameters.Add(
                                Request.QueryString.Keys[intParam] + "=" + Request.QueryString[intParam]);
                            break;
                        }
                    }
                    Response.Redirect(Globals.NavigateURL(tab.TabID, Null.NullString, parameters.ToArray()), true);
                }
                else
                {
                    //404 Error - Redirect to ErrorPage
                    Exceptions.ProcessHttpException(Request);
                }
            }
            if (Request.IsAuthenticated)
            {
                switch (Host.AuthenticatedCacheability)
                {
                case "0":
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    break;

                case "1":
                    Response.Cache.SetCacheability(HttpCacheability.Private);
                    break;

                case "2":
                    Response.Cache.SetCacheability(HttpCacheability.Public);
                    break;

                case "3":
                    Response.Cache.SetCacheability(HttpCacheability.Server);
                    break;

                case "4":
                    Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
                    break;

                case "5":
                    Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
                    break;
                }
            }

            //page comment
            if (Host.DisplayCopyright)
            {
                Comment += string.Concat(Environment.NewLine,
                                         "<!--************************************************************************************-->",
                                         Environment.NewLine,
                                         "<!-- DNN Platform - http://www.dnnsoftware.com                                        -->",
                                         Environment.NewLine,
                                         "<!-- Copyright (c) 2002-2013                                                          -->",
                                         Environment.NewLine,
                                         "<!-- by DNN Corporation                                                               -->",
                                         Environment.NewLine,
                                         "<!--**********************************************************************************-->",
                                         Environment.NewLine);
            }
            Page.Header.Controls.AddAt(0, new LiteralControl(Comment));

            if (PortalSettings.ActiveTab.PageHeadText != Null.NullString && !Globals.IsAdminControl())
            {
                Page.Header.Controls.Add(new LiteralControl(PortalSettings.ActiveTab.PageHeadText));
            }

            //set page title
            string strTitle = PortalSettings.PortalName;

            if (IsPopUp)
            {
                var slaveModule = UIUtilities.GetSlaveModule(PortalSettings.ActiveTab.TabID);

                //Skip is popup is just a tab (no slave module)
                if (slaveModule.DesktopModuleID != Null.NullInteger)
                {
                    var control = ModuleControlFactory.CreateModuleControl(slaveModule) as IModuleControl;
                    control.LocalResourceFile = slaveModule.ModuleControl.ControlSrc.Replace(Path.GetFileName(slaveModule.ModuleControl.ControlSrc), "") + Localization.LocalResourceDirectory + "/" +
                                                Path.GetFileName(slaveModule.ModuleControl.ControlSrc);
                    var title = Localization.LocalizeControlTitle(control);

                    strTitle += string.Concat(" > ", PortalSettings.ActiveTab.LocalizedTabName);
                    strTitle += string.Concat(" > ", title);
                }
                else
                {
                    strTitle += string.Concat(" > ", PortalSettings.ActiveTab.LocalizedTabName);
                }
            }
            else
            {
                foreach (TabInfo tab in PortalSettings.ActiveTab.BreadCrumbs)
                {
                    strTitle += string.Concat(" > ", tab.TabName);
                }

                //tab title override
                if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.Title))
                {
                    strTitle = PortalSettings.ActiveTab.Title;
                }
            }
            Title = strTitle;

            //set the background image if there is one selected
            if (!IsPopUp && FindControl("Body") != null)
            {
                if (!string.IsNullOrEmpty(PortalSettings.BackgroundFile))
                {
                    var fileInfo = GetBackgroundFileInfo();
                    var url      = FileManager.Instance.GetUrl(fileInfo);

                    ((HtmlGenericControl)FindControl("Body")).Attributes["style"] = string.Concat("background-image: url('", url, "')");
                }
            }

            //META Refresh
            if (PortalSettings.ActiveTab.RefreshInterval > 0 && Request.QueryString["ctl"] == null)
            {
                MetaRefresh.Content = PortalSettings.ActiveTab.RefreshInterval.ToString();
            }
            else
            {
                MetaRefresh.Visible = false;
            }

            //META description
            if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.Description))
            {
                Description = PortalSettings.ActiveTab.Description;
            }
            else
            {
                Description = PortalSettings.Description;
            }

            //META keywords
            if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.KeyWords))
            {
                KeyWords = PortalSettings.ActiveTab.KeyWords;
            }
            else
            {
                KeyWords = PortalSettings.KeyWords;
            }
            if (Host.DisplayCopyright)
            {
                KeyWords += ",DotNetNuke,DNN";
            }

            //META copyright
            if (!string.IsNullOrEmpty(PortalSettings.FooterText))
            {
                Copyright = PortalSettings.FooterText.Replace("[year]", DateTime.Now.Year.ToString());
            }
            else
            {
                Copyright = string.Concat("Copyright (c) ", DateTime.Now.Year, " by ", PortalSettings.PortalName);
            }

            //META generator
            if (Host.DisplayCopyright)
            {
                Generator = "DotNetNuke ";
            }
            else
            {
                Generator = "";
            }

            //META Robots
            var allowIndex = true;

            if ((PortalSettings.ActiveTab.TabSettings.ContainsKey("AllowIndex") && bool.TryParse(PortalSettings.ActiveTab.TabSettings["AllowIndex"].ToString(), out allowIndex) && !allowIndex) ||
                (Request.QueryString["ctl"] != null && (Request.QueryString["ctl"] == "Login" || Request.QueryString["ctl"] == "Register")))
            {
                MetaRobots.Content = "NOINDEX, NOFOLLOW";
            }
            else
            {
                MetaRobots.Content = "INDEX, FOLLOW";
            }

            //NonProduction Label Injection
            if (NonProductionVersion() && Host.DisplayBetaNotice && !IsPopUp)
            {
                string versionString = string.Format(" ({0} Version: {1})", DotNetNukeContext.Current.Application.Status,
                                                     DotNetNukeContext.Current.Application.Version);
                Title += versionString;
            }

            //register DNN SkinWidgets Inititialization scripts
            if (PortalSettings.EnableSkinWidgets)
            {
                jQuery.RequestRegistration();
                // don't use the new API to register widgets until we better understand their asynchronous script loading requirements.
                ClientAPI.RegisterStartUpScript(Page, "initWidgets", string.Format("<script type=\"text/javascript\" src=\"{0}\" ></script>", ResolveUrl("~/Resources/Shared/scripts/initWidgets.js")));
            }

            //register the custom stylesheet of current page
            if (PortalSettings.ActiveTab.TabSettings.ContainsKey("CustomStylesheet") && !string.IsNullOrEmpty(PortalSettings.ActiveTab.TabSettings["CustomStylesheet"].ToString()))
            {
                var customStylesheet = Path.Combine(PortalSettings.HomeDirectory, PortalSettings.ActiveTab.TabSettings["CustomStylesheet"].ToString());
                ClientResourceManager.RegisterStyleSheet(this, customStylesheet);
            }
        }
Esempio n. 16
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdVisibility.Click += cmdVisibility_Click;

            try
            {
                if (!Page.IsPostBack)
                {
                    //public attributes
                    if (!String.IsNullOrEmpty(BorderWidth))
                    {
                        cmdVisibility.BorderWidth = Unit.Parse(BorderWidth);
                    }
                    if (ModuleControl.ModuleContext.Configuration != null)
                    {
                        //check if Personalization is allowed
                        if (ModuleControl.ModuleContext.Configuration.Visibility == VisibilityState.None)
                        {
                            cmdVisibility.Enabled = false;
                            cmdVisibility.Visible = false;
                        }
                        if (ModuleControl.ModuleContext.Configuration.Visibility == VisibilityState.Minimized)
                        {
                            //if visibility is set to minimized, then the client needs to set the cookie for maximized only and delete the cookie for minimized,
                            //instead of the opposite.  We need to notify the client of this
                            ClientAPI.RegisterClientVariable(Page, "__dnn_" + ModuleControl.ModuleContext.ModuleId + ":defminimized", "true", true);
                        }
                        if (!Globals.IsAdminControl())
                        {
                            if (cmdVisibility.Enabled)
                            {
                                if (ModuleContent != null)
                                {
                                    //EnableMinMax now done in prerender
                                }
                                else
                                {
                                    Visible = false;
                                }
                            }
                        }
                        else
                        {
                            Visible = false;
                        }
                    }
                    else
                    {
                        Visible = false;
                    }
                }
                else
                {
                    //since we disabled viewstate on the cmdVisibility control we need to check to see if we need hide this on postbacks as well
                    if (ModuleControl.ModuleContext.Configuration != null)
                    {
                        if (ModuleControl.ModuleContext.Configuration.Visibility == VisibilityState.None)
                        {
                            cmdVisibility.Enabled = false;
                            cmdVisibility.Visible = false;
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	9/13/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                // Verify if portal has a customized registration page
                if (!Null.IsNull(PortalSettings.UserTabId) && Globals.IsAdminControl())
                {
                    // user page exists and trying to access this control directly with url param -> not allowed
                    Response.Redirect(Globals.NavigateURL(PortalSettings.UserTabId));
                }

                // Verify that the current user has access to this page
                if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration && Request.IsAuthenticated == false)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }

                if ((Request.QueryString["Services"] != null))
                {
                    Services = int.Parse(Request.QueryString["Services"]);
                }

                // free subscriptions
                if ((Request.QueryString["RoleID"] != null))
                {
                    RoleID = int.Parse(Request.QueryString["RoleID"]);

                    RoleController objRoles = new RoleController();

                    RoleInfo objRole = objRoles.GetRole(RoleID, PortalSettings.PortalId);

                    if (objRole.IsPublic && objRole.ServiceFee == 0.0)
                    {
                        objRoles.UpdateUserRole(PortalId, UserInfo.UserID, RoleID, Convert.ToBoolean((Request.QueryString["cancel"] != null) ? true : false));

                        if (PortalSettings.UserTabId != -1)
                        {
                            // user defined tab
                            Response.Redirect(Globals.NavigateURL(PortalSettings.UserTabId), true);
                        }
                        else
                        {
                            // admin tab
                            Response.Redirect(Globals.NavigateURL("Register"), true);
                        }
                    }
                    else
                    {
                        // EVENTLOGGER
                    }
                }

                // If this is the first visit to the page, bind the role data to the datalist
                if (Page.IsPostBack == false)
                {
                    //Localize the Headers
                    Localization.LocalizeDataGrid(ref grdServices, this.LocalResourceFile);

                    ClientAPI.AddButtonConfirm(cmdUnregister, Localization.GetString("CancelConfirm", this.LocalResourceFile));

                    BindData();

                    try
                    {
                        Globals.SetFormFocus(userControl);
                    }
                    catch
                    {
                        //control not there or error setting focus
                    }

                    // Store URL Referrer to return to portal
                    if (Request.UrlReferrer != null)
                    {
                        ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer);
                    }
                    else
                    {
                        ViewState["UrlReferrer"] = "";
                    }
                }

                lblRegistration.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_REGISTRATION_INSTRUCTIONS");
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 18
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadActions loads the Actions collections
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]    01/19/2006  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void LoadActions(HttpRequest request)
        {
            _actions = new ModuleActionCollection();
            _moduleGenericActions = new ModuleAction(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 = _moduleControl as IActionable;

            if (actionable != null)
            {
                _moduleSpecificActions = new ModuleAction(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", Configuration))
                    {
                        if (String.IsNullOrEmpty(action.Icon))
                        {
                            action.Icon = "edit.gif";
                        }
                        if (action.ID > maxActionId)
                        {
                            maxActionId = action.ID;
                        }
                        _moduleSpecificActions.Actions.Add(action);

                        if (!UIUtilities.IsLegacyUI(ModuleId, action.ControlKey, PortalId) && action.Url.Contains("ctl"))
                        {
                            action.ClientScript = UrlUtils.PopUpUrl(action.Url, _moduleControl as Control, PortalSettings, true, false);
                        }
                    }
                }
                if (_moduleSpecificActions.Actions.Count > 0)
                {
                    _actions.Add(_moduleSpecificActions);
                }
            }

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

            if (_nextActionId < maxActionId)
            {
                _nextActionId = maxActionId;
            }
            if (_nextActionId < actionCount)
            {
                _nextActionId = actionCount;
            }

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

                                                          "",
                                                          false,
                                                          SecurityAccessLevel.View,
                                                          true,
                                                          false);
                    }
                    if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "IMPORT", Configuration))
                    {
                        _moduleGenericActions.Actions.Add(GetNextActionID(),
                                                          Localization.GetString(ModuleActionType.ImportModule, Localization.GlobalResourceFile),
                                                          "",
                                                          "",
                                                          "action_import.gif",
                                                          NavigateUrl(PortalSettings.ActiveTab.TabID, "ImportModule", false, "moduleid=" + ModuleId),
                                                          "",
                                                          false,
                                                          SecurityAccessLevel.View,
                                                          true,
                                                          false);
                    }
                }
                if (Configuration.DesktopModule.IsSearchable && Configuration.DisplaySyndicate)
                {
                    AddSyndicateAction();
                }
            }

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

            if (Configuration.ModuleID > Null.NullInteger && ModulePermissionController.HasModulePermission(Configuration.ModulePermissions, permisisonList) && request.QueryString["ctl"] != "Help")
            {
                AddHelpActions();
            }

            //Add Print Action
            if (Configuration.DisplayPrint)
            {
                //print module action available to everyone
                AddPrintAction();
            }
            if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Host, "MANAGE", Configuration))
            {
                _moduleGenericActions.Actions.Add(GetNextActionID(),
                                                  Localization.GetString(ModuleActionType.ViewSource, Localization.GlobalResourceFile),
                                                  ModuleActionType.ViewSource,
                                                  "",
                                                  "action_source.gif",
                                                  NavigateUrl(TabId, "ViewSource", false, "ctlid=" + Configuration.ModuleControlId),
                                                  false,
                                                  SecurityAccessLevel.Host,
                                                  true,
                                                  false);
            }
            if (!Globals.IsAdminControl() && ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE,MANAGE", Configuration))
            {
                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
                {
                    _moduleGenericActions.Actions.Add(GetNextActionID(),
                                                      Localization.GetString(ModuleActionType.ModuleSettings, Localization.GlobalResourceFile),
                                                      ModuleActionType.ModuleSettings,
                                                      "",
                                                      "action_settings.gif",
                                                      NavigateUrl(TabId, "Module", false, "ModuleId=" + ModuleId),
                                                      false,
                                                      SecurityAccessLevel.Edit,
                                                      true,
                                                      false);
                }
                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE", Configuration))
                {
                    _moduleGenericActions.Actions.Add(GetNextActionID(),
                                                      Localization.GetString(ModuleActionType.DeleteModule, Localization.GlobalResourceFile),
                                                      ModuleActionType.DeleteModule,
                                                      Configuration.ModuleID.ToString(),
                                                      "action_delete.gif",
                                                      "",
                                                      "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteModule.Confirm")) + "')",
                                                      false,
                                                      SecurityAccessLevel.View,
                                                      true,
                                                      false);
                }
                if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
                {
                    _moduleGenericActions.Actions.Add(GetNextActionID(),
                                                      Localization.GetString(ModuleActionType.ClearCache, Localization.GlobalResourceFile),
                                                      ModuleActionType.ClearCache,
                                                      Configuration.ModuleID.ToString(),
                                                      "action_refresh.gif",
                                                      "",
                                                      false,
                                                      SecurityAccessLevel.View,
                                                      true,
                                                      false);
                }

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

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

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

            foreach (ModuleAction action in _moduleGenericActions.Actions)
            {
                if (!UIUtilities.IsLegacyUI(ModuleId, action.ControlKey, PortalId) && action.Url.Contains("ctl"))
                {
                    action.ClientScript = UrlUtils.PopUpUrl(action.Url, _moduleControl as Control, PortalSettings, true, false);
                }
            }
        }
Esempio n. 19
0
        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);
            }
        }
Esempio n. 20
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderContents renders the contents of the control to the output stream
        /// </summary>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (_isCached)
            {
                //Render the cached control to the output stream
                base.RenderContents(writer);
            }
            else
            {
                if (SupportsCaching() && IsViewMode(_moduleConfiguration, PortalSettings) && !Globals.IsAdminControl() && !IsVersionRequest())
                {
                    //Render to cache
                    var tempWriter = new StringWriter();

                    _control.RenderControl(new HtmlTextWriter(tempWriter));
                    string cachedOutput = tempWriter.ToString();

                    if (!string.IsNullOrEmpty(cachedOutput) && (!HttpContext.Current.Request.Browser.Crawler))
                    {
                        //Save content to cache
                        var moduleContent = Encoding.UTF8.GetBytes(cachedOutput);
                        var cache         = ModuleCachingProvider.Instance(_moduleConfiguration.GetEffectiveCacheMethod());

                        var varyBy = new SortedDictionary <string, string> {
                            { "locale", Thread.CurrentThread.CurrentUICulture.ToString() }
                        };

                        var cacheKey = cache.GenerateCacheKey(_moduleConfiguration.TabModuleID, varyBy);
                        cache.SetModule(_moduleConfiguration.TabModuleID, cacheKey, new TimeSpan(0, 0, _moduleConfiguration.CacheTime), moduleContent);
                    }

                    //Render the cached content to Response
                    writer.Write(cachedOutput);
                }
                else
                {
                    //Render the control to Response
                    base.RenderContents(writer);
                }
            }
        }
Esempio n. 21
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <remarks>
        /// - Obtain PortalSettings from Current Context
        /// - redirect to a specific tab based on name
        /// - if first time loading this page then reload to avoid caching
        /// - set page title and stylesheet
        /// - check to see if we should show the Assembly Version in Page Title
        /// - set the background image if there is one selected
        /// - set META tags, copyright, keywords and description
        /// </remarks>
        /// -----------------------------------------------------------------------------
        private void InitializePage()
        {
            //There could be a pending installation/upgrade process
            if (InstallBlocker.Instance.IsInstallInProgress())
            {
                Exceptions.ProcessHttpException(new HttpException(503, Localization.GetString("SiteAccessedWhileInstallationWasInProgress.Error", Localization.GlobalResourceFile)));
            }

            //Configure the ActiveTab with Skin/Container information
            PortalSettingsController.Instance().ConfigureActiveTab(PortalSettings);

            //redirect to a specific tab based on name
            if (!String.IsNullOrEmpty(Request.QueryString["tabname"]))
            {
                TabInfo tab = TabController.Instance.GetTabByName(Request.QueryString["TabName"], PortalSettings.PortalId);
                if (tab != null)
                {
                    var parameters = new List <string>(); //maximum number of elements
                    for (int intParam = 0; intParam <= Request.QueryString.Count - 1; intParam++)
                    {
                        switch (Request.QueryString.Keys[intParam].ToLowerInvariant())
                        {
                        case "tabid":
                        case "tabname":
                            break;

                        default:
                            parameters.Add(
                                Request.QueryString.Keys[intParam] + "=" + Request.QueryString[intParam]);
                            break;
                        }
                    }
                    Response.Redirect(NavigationManager.NavigateURL(tab.TabID, Null.NullString, parameters.ToArray()), true);
                }
                else
                {
                    //404 Error - Redirect to ErrorPage
                    Exceptions.ProcessHttpException(Request);
                }
            }
            string cacheability = Request.IsAuthenticated ? Host.AuthenticatedCacheability : Host.UnauthenticatedCacheability;

            switch (cacheability)
            {
            case "0":
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                break;

            case "1":
                Response.Cache.SetCacheability(HttpCacheability.Private);
                break;

            case "2":
                Response.Cache.SetCacheability(HttpCacheability.Public);
                break;

            case "3":
                Response.Cache.SetCacheability(HttpCacheability.Server);
                break;

            case "4":
                Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
                break;

            case "5":
                Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
                break;
            }

            //Only insert the header control if a comment is needed
            if (!String.IsNullOrWhiteSpace(Comment))
            {
                Page.Header.Controls.AddAt(0, new LiteralControl(Comment));
            }

            if (PortalSettings.ActiveTab.PageHeadText != Null.NullString && !Globals.IsAdminControl())
            {
                Page.Header.Controls.Add(new LiteralControl(PortalSettings.ActiveTab.PageHeadText));
            }

            if (!string.IsNullOrEmpty(PortalSettings.PageHeadText))
            {
                metaPanel.Controls.Add(new LiteralControl(PortalSettings.PageHeadText));
            }

            //set page title
            if (UrlUtils.InPopUp())
            {
                var strTitle    = new StringBuilder(PortalSettings.PortalName);
                var slaveModule = UIUtilities.GetSlaveModule(PortalSettings.ActiveTab.TabID);

                //Skip is popup is just a tab (no slave module)
                if (slaveModule.DesktopModuleID != Null.NullInteger)
                {
                    var    control   = ModuleControlFactory.CreateModuleControl(slaveModule) as IModuleControl;
                    string extension = Path.GetExtension(slaveModule.ModuleControl.ControlSrc.ToLowerInvariant());
                    switch (extension)
                    {
                    case ".mvc":
                        var segments = slaveModule.ModuleControl.ControlSrc.Replace(".mvc", "").Split('/');

                        control.LocalResourceFile = String.Format("~/DesktopModules/MVC/{0}/{1}/{2}.resx",
                                                                  slaveModule.DesktopModule.FolderName,
                                                                  Localization.LocalResourceDirectory,
                                                                  segments[0]);
                        break;

                    default:
                        control.LocalResourceFile = string.Concat(
                            slaveModule.ModuleControl.ControlSrc.Replace(
                                Path.GetFileName(slaveModule.ModuleControl.ControlSrc), string.Empty),
                            Localization.LocalResourceDirectory, "/",
                            Path.GetFileName(slaveModule.ModuleControl.ControlSrc));
                        break;
                    }
                    var title = Localization.LocalizeControlTitle(control);

                    strTitle.Append(string.Concat(" > ", PortalSettings.ActiveTab.LocalizedTabName));
                    strTitle.Append(string.Concat(" > ", title));
                }
                else
                {
                    strTitle.Append(string.Concat(" > ", PortalSettings.ActiveTab.LocalizedTabName));
                }

                //Set to page
                Title = strTitle.ToString();
            }
            else
            {
                //If tab is named, use that title, otherwise build it out via breadcrumbs
                if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.Title))
                {
                    Title = PortalSettings.ActiveTab.Title;
                }
                else
                {
                    //Elected for SB over true concatenation here due to potential for long nesting depth
                    var strTitle = new StringBuilder(PortalSettings.PortalName);
                    foreach (TabInfo tab in PortalSettings.ActiveTab.BreadCrumbs)
                    {
                        strTitle.Append(string.Concat(" > ", tab.TabName));
                    }
                    Title = strTitle.ToString();
                }
            }

            //set the background image if there is one selected
            if (!UrlUtils.InPopUp() && FindControl("Body") != null)
            {
                if (!string.IsNullOrEmpty(PortalSettings.BackgroundFile))
                {
                    var fileInfo = GetBackgroundFileInfo();
                    var url      = FileManager.Instance.GetUrl(fileInfo);

                    ((HtmlGenericControl)FindControl("Body")).Attributes["style"] = string.Concat("background-image: url('", url, "')");
                }
            }

            //META Refresh
            // Only autorefresh the page if we are in VIEW-mode and if we aren't displaying some module's subcontrol.
            if (PortalSettings.ActiveTab.RefreshInterval > 0 && this.PortalSettings.UserMode == PortalSettings.Mode.View && Request.QueryString["ctl"] == null)
            {
                MetaRefresh.Content = PortalSettings.ActiveTab.RefreshInterval.ToString();
                MetaRefresh.Visible = true;
            }
            else
            {
                MetaRefresh.Visible = false;
            }

            //META description
            if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.Description))
            {
                Description = PortalSettings.ActiveTab.Description;
            }
            else
            {
                Description = PortalSettings.Description;
            }

            //META keywords
            if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.KeyWords))
            {
                KeyWords = PortalSettings.ActiveTab.KeyWords;
            }
            else
            {
                KeyWords = PortalSettings.KeyWords;
            }

            //META copyright
            if (!string.IsNullOrEmpty(PortalSettings.FooterText))
            {
                Copyright = PortalSettings.FooterText.Replace("[year]", DateTime.Now.Year.ToString());
            }
            else
            {
                Copyright = string.Concat("Copyright (c) ", DateTime.Now.Year, " by ", PortalSettings.PortalName);
            }

            //META generator

            Generator = "";


            //META Robots - hide it inside popups and if PageHeadText of current tab already contains a robots meta tag
            if (!UrlUtils.InPopUp() &&
                !(HeaderTextRegex.IsMatch(PortalSettings.ActiveTab.PageHeadText) ||
                  HeaderTextRegex.IsMatch(PortalSettings.PageHeadText)))
            {
                MetaRobots.Visible = true;
                var allowIndex = true;
                if ((PortalSettings.ActiveTab.TabSettings.ContainsKey("AllowIndex") &&
                     bool.TryParse(PortalSettings.ActiveTab.TabSettings["AllowIndex"].ToString(), out allowIndex) &&
                     !allowIndex)
                    ||
                    (Request.QueryString["ctl"] != null &&
                     (Request.QueryString["ctl"] == "Login" || Request.QueryString["ctl"] == "Register")))
                {
                    MetaRobots.Content = "NOINDEX, NOFOLLOW";
                }
                else
                {
                    MetaRobots.Content = "INDEX, FOLLOW";
                }
            }

            //NonProduction Label Injection
            if (NonProductionVersion() && Host.DisplayBetaNotice && !UrlUtils.InPopUp())
            {
                string versionString = string.Format(" ({0} Version: {1})", DotNetNukeContext.Current.Application.Status,
                                                     DotNetNukeContext.Current.Application.Version);
                Title += versionString;
            }

            //register the custom stylesheet of current page
            if (PortalSettings.ActiveTab.TabSettings.ContainsKey("CustomStylesheet") && !string.IsNullOrEmpty(PortalSettings.ActiveTab.TabSettings["CustomStylesheet"].ToString()))
            {
                var customStylesheet = Path.Combine(PortalSettings.HomeDirectory, PortalSettings.ActiveTab.TabSettings["CustomStylesheet"].ToString());
                ClientResourceManager.RegisterStyleSheet(this, customStylesheet);
            }

            // Cookie Consent
            if (PortalSettings.ShowCookieConsent)
            {
                ClientAPI.RegisterClientVariable(this, "cc_morelink", PortalSettings.CookieMoreLink, true);
                ClientAPI.RegisterClientVariable(this, "cc_message", Localization.GetString("cc_message", Localization.GlobalResourceFile), true);
                ClientAPI.RegisterClientVariable(this, "cc_dismiss", Localization.GetString("cc_dismiss", Localization.GlobalResourceFile), true);
                ClientAPI.RegisterClientVariable(this, "cc_link", Localization.GetString("cc_link", Localization.GlobalResourceFile), true);
                ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/Components/CookieConsent/cookieconsent.min.js", FileOrder.Js.DnnControls);
                ClientResourceManager.RegisterStyleSheet(Page, "~/Resources/Shared/Components/CookieConsent/cookieconsent.min.css", FileOrder.Css.ResourceCss);
                ClientResourceManager.RegisterScript(Page, "~/js/dnn.cookieconsent.js", FileOrder.Js.DefaultPriority);
            }
        }