Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);
            cmdCancel.NavigateUrl = Globals.NavigateURL();
            cmdNewMapping.Click  += OnNewMappingClick;

            if (!IsPostBack)
            {
                Session["FolderMappingsList"] = null;

                if (ModuleConfiguration.ModuleControl.SupportsPopUps)
                {
                    grdMappings.Rebind();
                }
            }
        }
Beispiel #2
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;

                /*
                 * 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) && !HeaderIsWritten)
            {
                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);
            }
        }
Beispiel #3
0
        protected void Page_Init(Object sender, EventArgs e)
        {
            ModuleController        objModules = new ModuleController();
            ModuleControlController objModuleControlController = new ModuleControlController();

            // get ModuleId
            if ((Request.QueryString["ModuleId"] != null))
            {
                moduleId = int.Parse(Request.QueryString["ModuleId"]);
            }

            // get module
            ModuleInfo objModule = objModules.GetModule(moduleId, TabId, false);

            if (objModule != null)
            {
                tabModuleId = objModule.TabModuleID;

                //get Settings Control(s)
                ArrayList arrModuleControls = objModuleControlController.GetModuleControlsByKey("Settings", objModule.ModuleDefID);

                if (arrModuleControls.Count > 0)
                {
                    ModuleControlInfo objModuleControlInfo = (ModuleControlInfo)arrModuleControls[0];
                    string            src = "~/" + objModuleControlInfo.ControlSrc;
                    ctlSpecific             = (ModuleSettingsBase)LoadControl(src);
                    ctlSpecific.ID          = src.Substring(src.LastIndexOf("/") + 1);
                    ctlSpecific.ModuleId    = moduleId;
                    ctlSpecific.TabModuleId = tabModuleId;
                    dshSpecific.Text        = Localization.LocalizeControlTitle(objModuleControlInfo.ControlTitle, objModuleControlInfo.ControlSrc, "settings");
                    pnlSpecific.Controls.Add(ctlSpecific);

                    if (Localization.GetString(ModuleActionType.HelpText, ctlSpecific.LocalResourceFile) != "")
                    {
                        rowspecifichelp.Visible       = true;
                        imgSpecificHelp.AlternateText = Localization.GetString(ModuleActionType.ModuleHelp, Localization.GlobalResourceFile);
                        lnkSpecificHelp.Text          = Localization.GetString(ModuleActionType.ModuleHelp, Localization.GlobalResourceFile);
                        lnkSpecificHelp.NavigateUrl   = Globals.NavigateURL(TabId, "Help", "ctlid=" + objModuleControlInfo.ModuleControlID, "moduleid=" + moduleId);
                    }
                    else
                    {
                        rowspecifichelp.Visible = false;
                    }
                }
            }
        }
Beispiel #4
0
        public string NavigateUrl(int tabID, string controlKey, string pageName, bool pageRedirect, params string[] additionalParameters)
        {
            var isSuperTab = TestableGlobals.Instance.IsHostTab(tabID);
            var settings   = PortalController.Instance.GetCurrentPortalSettings();
            var language   = Globals.GetCultureCode(tabID, isSuperTab, settings);
            var url        = TestableGlobals.Instance.NavigateURL(tabID, isSuperTab, settings, controlKey, language, pageName, additionalParameters);

            // Making URLs call popups
            if (PortalSettings != null && PortalSettings.EnablePopUps)
            {
                if (!UIUtilities.IsLegacyUI(ModuleId, controlKey, PortalId) && (url.Contains("ctl")))
                {
                    url = UrlUtils.PopUpUrl(url, null, PortalSettings, false, pageRedirect);
                }
            }
            return(url);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Init runs when the control is initialised
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            jQuery.RequestDnnPluginsRegistration();

            foreach (DataGridColumn column in grdRoles.Columns)
            {
                if (ReferenceEquals(column.GetType(), typeof(ImageCommandColumn)))
                {
                    //Manage Delete Confirm JS
                    var imageColumn = (ImageCommandColumn)column;
                    imageColumn.Visible = IsEditable;
                    if (imageColumn.CommandName == "Delete")
                    {
                        imageColumn.OnClickJS = Localization.GetString("DeleteItem");
                    }

                    //Manage Edit Column NavigateURLFormatString
                    if (imageColumn.CommandName == "Edit")
                    {
                        //so first create the format string with a dummy value and then
                        //replace the dummy value with the FormatString place holder
                        string formatString = EditUrl("RoleID", "KEYFIELD", "Edit");
                        formatString = formatString.Replace("KEYFIELD", "{0}");
                        imageColumn.NavigateURLFormatString = formatString;
                    }

                    //Manage Roles Column NavigateURLFormatString
                    if (imageColumn.CommandName == "UserRoles")
                    {
                        //so first create the format string with a dummy value and then
                        //replace the dummy value with the FormatString place holder
                        string formatString = Globals.NavigateURL(TabId, "User Roles", "RoleId=KEYFIELD", "mid=" + ModuleId);
                        formatString = formatString.Replace("KEYFIELD", "{0}");
                        imageColumn.NavigateURLFormatString = formatString;
                    }

                    //Localize Image Column Text
                    if (!String.IsNullOrEmpty(imageColumn.CommandName))
                    {
                        imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile);
                    }
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if ((Request.QueryString["RoleGroupID"] != null))
                {
                    RoleGroupID = int.Parse(Request.QueryString["RoleGroupID"]);
                }

                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                    RoleController objRoles = new RoleController();
                    if (RoleGroupID != -1)
                    {
                        RoleGroupInfo objRoleGroupInfo = RoleController.GetRoleGroup(PortalId, RoleGroupID);
                        if (objRoleGroupInfo != null)
                        {
                            txtRoleGroupName.Text = objRoleGroupInfo.RoleGroupName;
                            txtDescription.Text   = objRoleGroupInfo.Description;

                            //Check if Group has any roles assigned
                            int roleCount = objRoles.GetRolesByGroup(PortalId, RoleGroupID).Count;

                            if (roleCount > 0)
                            {
                                cmdDelete.Visible = false;
                            }
                        }
                        else // security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #7
0
        protected void PurchaseBtn_Click(Object sender, EventArgs e)
        {
            try
            {
                string strPaymentProcessor  = "";
                string strProcessorUserId   = "";
                string strProcessorPassword = "";

                if (Page.IsValid)
                {
                    PortalController objPortalController = new PortalController();
                    PortalInfo       objPortalInfo       = objPortalController.GetPortal(PortalSettings.PortalId);
                    if (objPortalInfo != null)
                    {
                        strPaymentProcessor  = objPortalInfo.PaymentProcessor;
                        strProcessorUserId   = objPortalInfo.ProcessorUserId;
                        strProcessorPassword = objPortalInfo.ProcessorPassword;
                    }

                    if (strPaymentProcessor == "PayPal")
                    {
                        // build secure PayPal URL
                        string strPayPalURL = "";
                        strPayPalURL = "https://www.paypal.com/xclick/business=" + Globals.HTTPPOSTEncode(strProcessorUserId);
                        strPayPalURL = strPayPalURL + "&item_name=" + Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + lblDescription.Text + " ( " + txtUnits.Text + " units @ " + lblFee.Text + " " + lblFeeCurrency.Text + " per " + lblFrequency.Text + " )");
                        strPayPalURL = strPayPalURL + "&item_number=" + Globals.HTTPPOSTEncode(Convert.ToString(RoleID));
                        strPayPalURL = strPayPalURL + "&quantity=1";
                        strPayPalURL = strPayPalURL + "&custom=" + Globals.HTTPPOSTEncode(UserInfo.UserID.ToString());
                        strPayPalURL = strPayPalURL + "&amount=" + Globals.HTTPPOSTEncode(lblTotal.Text);
                        strPayPalURL = strPayPalURL + "&currency_code=" + Globals.HTTPPOSTEncode(lblTotalCurrency.Text);
                        strPayPalURL = strPayPalURL + "&return=" + Globals.HTTPPOSTEncode("http://" + Globals.GetDomainName(Request));
                        strPayPalURL = strPayPalURL + "&cancel_return=" + Globals.HTTPPOSTEncode("http://" + Globals.GetDomainName(Request));
                        strPayPalURL = strPayPalURL + "&notify_url=" + Globals.HTTPPOSTEncode("http://" + Globals.GetDomainName(Request) + "/admin/Sales/PayPalIPN.aspx");
                        strPayPalURL = strPayPalURL + "&undefined_quantity=&no_note=1&no_shipping=1";

                        // redirect to PayPal
                        Response.Redirect(strPayPalURL, true);
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// Gets the login URL.
        /// </summary>
        /// <param name="returnURL">The URL to redirect to after logging in.</param>
        /// <param name="override">if set to <c>true</c>, show the login control on the current page, even if there is a login page defined for the site.</param>
        /// <returns>Formatted URL.</returns>
        public string LoginURL(Int32 StrUserId, DateTime LastModifiedOnDate, string returnURL, bool @override)
        {
            string strURL         = "";
            var    portalSettings = PortalController.Instance.GetCurrentPortalSettings();

            if (!string.IsNullOrEmpty(returnURL))
            {
                returnURL = String.Format("returnurl={0}", returnURL);
            }
            //var popUpParameter = "";
            //if (HttpUtility.UrlDecode(returnURL).Contains("popUp=true"))
            //{
            //    popUpParameter = "popUp=true";
            //}


            String TokenString = String.Format("token={0}", HttpUtility.UrlEncode(CryptionHelper.EncryptString(StrUserId.ToString(), "123456789")));
            String DateString  = String.Format("d={0}", HttpUtility.UrlEncode(CryptionHelper.EncryptString(LastModifiedOnDate.Ticks.ToString(), "x1x2x3x4x5")));

            if (portalSettings.LoginTabId != -1 && !@override)
            {
                if (Globals.ValidateLoginTabID(portalSettings.LoginTabId))
                {
                    strURL = string.IsNullOrEmpty(returnURL)
                                        ? Globals.NavigateURL(portalSettings.LoginTabId, "", TokenString, DateString)
                                        : Globals.NavigateURL(portalSettings.LoginTabId, "", returnURL, TokenString, DateString);
                }
                else
                {
                    string strMessage = String.Format("error={0}", Localization.GetString("NoLoginControl", Localization.GlobalResourceFile));
                    //No account module so use portal tab
                    strURL = string.IsNullOrEmpty(returnURL)
                                 ? Globals.NavigateURL(portalSettings.ActiveTab.TabID, "Login", strMessage, TokenString, DateString)
                                 : Globals.NavigateURL(portalSettings.ActiveTab.TabID, "Login", returnURL, strMessage, TokenString, DateString);
                }
            }
            else
            {
                //portal tab
                strURL = string.IsNullOrEmpty(returnURL)
                                ? Globals.NavigateURL(portalSettings.ActiveTab.TabID, "Login", TokenString, DateString)
                                : Globals.NavigateURL(portalSettings.ActiveTab.TabID, "Login", returnURL, TokenString, DateString);
            }
            return(strURL);
        }
        private IDictionary <string, object> GetConfigration(PortalSettings portalSettings)
        {
            var settings          = new Dictionary <string, object>();
            var user              = portalSettings.UserInfo;
            var portalId          = portalSettings.PortalId;
            var preferredTimeZone = TimeZoneHelper.GetPreferredTimeZone(user.Profile.PreferredTimeZone);

            var menuStructure = PersonaBarController.Instance.GetMenu(portalSettings, user);

            settings.Add("applicationPath", Globals.ApplicationPath);
            settings.Add("buildNumber", Host.CrmVersion.ToString(CultureInfo.InvariantCulture));
            settings.Add("userId", user.UserID);
            settings.Add("avatarUrl", Globals.ResolveUrl(Utilities.GetProfileAvatar(user)));
            settings.Add("culture", Thread.CurrentThread.CurrentUICulture.Name);
            settings.Add("logOff", this.NavigationManager.NavigateURL("Logoff"));
            settings.Add("visible", this.Visible);
            settings.Add("userMode", portalSettings.UserMode.ToString());
            settings.Add("userSettings", PersonaBarUserSettingsController.Instance.GetPersonaBarUserSettings());
            settings.Add("menuStructure", JObject.FromObject(menuStructure));
            settings.Add("sku", DotNetNukeContext.Current.Application.SKU);
            settings.Add("debugMode", HttpContext.Current != null && HttpContext.Current.IsDebuggingEnabled);
            settings.Add("portalId", portalId);
            settings.Add("preferredTimeZone", preferredTimeZone);

            if (!settings.ContainsKey("isAdmin"))
            {
                settings.Add("isAdmin", user.IsInRole(portalSettings.AdministratorRoleName));
            }

            if (!settings.ContainsKey("isHost"))
            {
                settings.Add("isHost", user.IsSuperUser);
            }

            var customModules = new List <string>()
            {
                "serversummary"
            };

            settings.Add("customModules", customModules);

            settings.Add("disableEditBar", Host.DisableEditBar);

            return(settings);
        }
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <remarks>
        /// </remarks>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            JavaScript.RequestRegistration(CommonJs.DnnPlugins);

            cmdDelete.Click += OnDeleteClick;
            cmdRun.Click    += OnRunClick;
            cmdUpdate.Click += OnUpdateClick;

            try
            {
                if (!Page.IsPostBack)
                {
                    cmdCancel.NavigateUrl = Globals.NavigateURL();
                    BindData();
                }

                if (chkEnabled.Checked)
                {
                    //if startdate is in the future Run Now will change NextStart value, to prevent this disable it if start date is in the future or present
                    if ((startScheduleDatePicker.SelectedDate ?? Null.NullDate) >= DateTime.Now)
                    {
                        cmdRun.Visible = false;
                    }
                    else
                    {
                        // Hide "Run now" if scheduler should not run on this server
                        if (!SchedulingController.CanRunOnThisServer(txtServers.Text))
                        {
                            cmdRun.Visible = false;
                        }
                    }
                }
                else
                {
                    cmdRun.Enabled = false;
                    cmdRun.Visible = false;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #11
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            // public attributes
            if (!String.IsNullOrEmpty(CssClass))
            {
                hypDotNetNuke.CssClass = CssClass;
            }

            // get Product Name and Legal Copyright from constants (Medium Trust)
            hypDotNetNuke.Text        = Globals.glbLegalCopyright.Replace("YYYY", DateTime.Now.Year.ToString());
            hypDotNetNuke.NavigateUrl = Globals.glbAppUrl;

            // show copyright credits?
            if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") != "Y")
            {
                this.Visible = false;
            }
        }
 void cmdCancel_Click(object sender, EventArgs e)
 {
     try
     {
         if (Settings.ListOrForm.Contains("Form") && IsNewRow)
         {
             Response.Redirect(Request.RawUrl);
         }
         else
         {
             Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
         }
     }
     catch (Exception exc) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
Beispiel #13
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// cmdCancel_Click runs when the cancel Button is clicked
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
 ///                       and localisation
 /// </history>
 /// -----------------------------------------------------------------------------
 private void cmdCancel_Click(object sender, EventArgs e)
 {
     try
     {
         if (RoleGroupID == -1)
         {
             Response.Redirect(Globals.NavigateURL(TabId, ""));
         }
         else
         {
             Response.Redirect(Globals.NavigateURL(TabId, "", "RoleGroupID=" + RoleGroupID));
         }
     }
     catch (Exception exc) //
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
Beispiel #14
0
 /// <summary>
 /// cmdRegister_Click runs when the register button is clicked
 /// </summary>
 /// <history>
 ///     [cnurse]	9/24/2004	Updated to reflect design changes for Help, 508 support
 ///                       and localisation
 ///     [cnurse]    12/11/2005  Updated to reflect abstraction of Membership
 /// </history>
 protected void cmdRegister_Click(object sender, EventArgs e)
 {
     if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration)
     {
         string registerUrl;
         if (PortalSettings.UserTabId != -1)
         {
             // user defined tab
             registerUrl = Globals.NavigateURL(PortalSettings.UserTabId);
         }
         else
         {
             // admin tab
             registerUrl = Globals.NavigateURL("Register");
         }
         Response.Redirect(registerUrl, true);
     }
 }
Beispiel #15
0
 /// <summary>
 /// cmdCancel_Click runs when the cancel Button is clicked
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
 ///                       and localisation
 /// </history>
 protected void cmdCancel_Click(object sender, EventArgs e)
 {
     try
     {
         if (RoleGroupID == -1)
         {
             Response.Redirect(Globals.NavigateURL(TabId, ""));
         }
         else
         {
             Response.Redirect(Globals.NavigateURL(TabId, "", "RoleGroupID=" + RoleGroupID.ToString()));
         }
     }
     catch (Exception exc)  //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
Beispiel #16
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdDelete_Click runs when the delete Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnDeleteClick(object sender, EventArgs e)
        {
            try
            {
                var objUser = new RoleController();

                objUser.DeleteRole(_roleID, PortalSettings.PortalId);

                //Clear Roles Cache
                DataCache.RemoveCache("GetRoles");

                Response.Redirect(Globals.NavigateURL());
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #17
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdDelete_Click runs when the delete Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnDeleteClick(object sender, EventArgs e)
        {
            try
            {
                var role = TestableRoleController.Instance.GetRole(PortalSettings.PortalId, r => r.RoleID == _roleID);

                TestableRoleController.Instance.DeleteRole(role);

                //Clear Roles Cache
                DataCache.RemoveCache("GetRoles");

                Response.Redirect(Globals.NavigateURL());
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #18
0
        public string EditUrl(string KeyName, string KeyValue, string ControlKey)
        {
            string key = ControlKey;

            if (key == "")
            {
                key = "Edit";
            }

            if (!String.IsNullOrEmpty(KeyName) && !String.IsNullOrEmpty(KeyValue))
            {
                return(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, key, "mid=" + ModuleId, KeyName + "=" + KeyValue));
            }
            else
            {
                return(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, key, "mid=" + ModuleId));
            }
        }
Beispiel #19
0
        private Containers.Container LoadContainerFromQueryString(ModuleInfo module, HttpRequest request)
        {
            Containers.Container container = null;
            int previewModuleId            = -1;

            if (request.QueryString["ModuleId"] != null)
            {
                Int32.TryParse(request.QueryString["ModuleId"], out previewModuleId);
            }

            //load user container ( based on cookie )
            if ((request.QueryString["ContainerSrc"] != null) && (module.ModuleID == previewModuleId || previewModuleId == -1))
            {
                string containerSrc = SkinController.FormatSkinSrc(Globals.QueryStringDecode(request.QueryString["ContainerSrc"]) + ".ascx", PortalSettings);
                container = LoadContainerByPath(containerSrc);
            }
            return(container);
        }
Beispiel #20
0
        /// <summary>
        /// cmdDelete_Click runs when the Delete LinkButton is clicked.
        /// It deletes the current portal form the Database.  It can only run in Host
        /// (SuperUser) mode
        /// </summary>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        ///     [VMasanas]  9/12/2004   Move skin deassignment to DeletePortalInfo.
        /// </history>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                PortalController objPortalController = new PortalController();
                PortalInfo       objPortalInfo       = objPortalController.GetPortal(intPortalId);

                if (objPortalInfo != null)
                {
                    string strMessage = PortalController.DeletePortal(objPortalInfo, Globals.GetAbsoluteServerPath(Request));

                    if (string.IsNullOrEmpty(strMessage))
                    {
                        EventLogController objEventLog = new EventLogController();
                        objEventLog.AddLog("PortalName", objPortalInfo.PortalName, PortalSettings, UserId, EventLogController.EventLogType.PORTAL_DELETED);

                        // Redirect to another site
                        if (intPortalId == PortalId)
                        {
                            if (PortalSettings.HostSettings["HostURL"].ToString() != "")
                            {
                                Response.Redirect(Globals.AddHTTP(PortalSettings.HostSettings["HostURL"].ToString()));
                            }
                            else
                            {
                                Response.End();
                            }
                        }
                        else
                        {
                            Response.Redirect(Convert.ToString(ViewState["UrlReferrer"]), true);
                        }
                    }
                    else
                    {
                        UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessageType.RedError);
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        private void BindMarketing(PortalInfo portal)
        {
            //Load DocTypes
            var searchEngines = new Dictionary <string, string>
            {
                { "Google", "http://www.google.com/addurl?q=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request))) },
                { "Yahoo", "http://siteexplorer.search.yahoo.com/submit" },
                { "Microsoft", "http://search.msn.com.sg/docs/submit.aspx" }
            };

            cboSearchEngine.DataSource = searchEngines;
            cboSearchEngine.DataBind();

            var portalAliasController = new PortalAliasController();
            var aliases = portalAliasController.GetPortalAliasArrayByPortalID(portal.PortalID);

            if (PortalController.IsChildPortal(portal, Globals.GetAbsoluteServerPath(Request)))
            {
                txtSiteMap.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/SiteMap.aspx?portalid=" + portal.PortalID;
            }
            else
            {
                if (aliases.Count > 0)
                {
                    //Get the first Alias
                    var objPortalAliasInfo = (PortalAliasInfo)aliases[0];
                    txtSiteMap.Text = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + @"/SiteMap.aspx";
                }
                else
                {
                    txtSiteMap.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/SiteMap.aspx";
                }
            }
            optBanners.SelectedIndex = portal.BannerAdvertising;
            if (UserInfo.IsSuperUser)
            {
                lblBanners.Visible = false;
            }
            else
            {
                optBanners.Enabled = portal.BannerAdvertising != 2;
                lblBanners.Visible = portal.BannerAdvertising == 2;
            }
        }
Beispiel #22
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// PageFunctions_Click runs when any button in the Page toolbar is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	10/06/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        private void PageFunctions_Click(object sender, EventArgs e)
        {
            try
            {
                string URL = Request.RawUrl;
                switch (((LinkButton)sender).ID)
                {
                case "cmdAddTab":
                case "cmdAddTabIcon":
                    URL = Globals.NavigateURL("Tab");
                    break;

                case "cmdEditTab":
                case "cmdEditTabIcon":
                    URL = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=edit");
                    break;

                case "cmdDeleteTab":
                case "cmdDeleteTabIcon":
                    URL = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=delete");
                    break;

                case "cmdCopyTab":
                case "cmdCopyTabIcon":
                    URL = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=copy");
                    break;

                case "cmdExportTab":
                case "cmdExportTabIcon":
                    URL = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ExportTab");
                    break;

                case "cmdImportTab":
                case "cmdImportTabIcon":
                    URL = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ImportTab");
                    break;
                }
                Response.Redirect(URL, true);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// cmdCancel_Click runs when the Cancel Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdCancel_Click(object sender, EventArgs e)
        {
            try
            {
                string strURL = Globals.NavigateURL();

                if (Request.QueryString["returntabid"] != null)
                {
                    // return to admin tab
                    strURL = Globals.NavigateURL(Convert.ToInt32(Request.QueryString["returntabid"]));
                }

                Response.Redirect(strURL, true);
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #24
0
 void cmdUpdate_Click(object sender, EventArgs e)
 {
     if (ValidateMailTo())
     {
         /*
          * var dnn = DotNetNuke.Application.DotNetNukeContext.Current.Application;
          * string dnnVersion = String.Format("{0}.{1}.{2}",
          *  dnn.Version.Major.ToString("00"),
          *  dnn.Version.Minor.ToString("00"),
          *  dnn.Version.Revision.ToString("00"));
          * if (System.String.Compare(dnnVersion, "07.02.02", System.StringComparison.Ordinal) < 0 && chkExcludeFromSearch.Checked)
          * {
          *  DataProvider.Instance().DeleteSearchItems(ModuleContext.ModuleId);
          * }
          */
         SaveSettings();
         Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
     }
 }
Beispiel #25
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();
        }
        /// <summary>
        /// cmdUpdate_Click runs when the Update button is clciked
        /// </summary>
        /// <history>
        ///     [cnurse]	02/22/2006  Created
        /// </history>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                //Check if Property Editor has been updated by user
                if (Properties.IsDirty && Properties.IsValid)
                {
                    //Declare Definition and "retrieve" it from the Property Editor
                    ProfilePropertyDefinition propertyDefinition;
                    propertyDefinition = (ProfilePropertyDefinition)Properties.DataSource;

                    if (PropertyDefinitionId == Null.NullInteger)
                    {
                        //Add the Property Definition
                        PropertyDefinitionId = ProfileController.AddPropertyDefinition(propertyDefinition);

                        if (PropertyDefinitionId < Null.NullInteger)
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateName", this.LocalResourceFile), DotNetNuke.UI.Skins.Controls.ModuleMessageType.RedError);
                        }
                    }
                    else
                    {
                        //Update the Property Definition
                        ProfileController.UpdatePropertyDefinition(propertyDefinition);
                    }
                }

                //Clear Profile Definition Cache
                ProfileController.ClearProfileDefinitionCache(PortalId);

                //Redirect to Definitions page
                if (PropertyDefinitionId > Null.NullInteger)
                {
                    Response.Redirect(Globals.NavigateURL(TabId, "ManageProfile", "mid=" + ModuleId), true);
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #27
0
 void cmdDeleteUnAuthorized_Click(object sender, EventArgs e)
 {
     try
     {
         var objVendors = new VendorController();
         if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
         {
             objVendors.DeleteVendors();
         }
         else
         {
             objVendors.DeleteVendors(PortalId);
         }
         Response.Redirect(Globals.NavigateURL(), true);
     }
     catch (Exception exc) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
 private void LocalizePage()
 {
     SetBrowserLanguage();
     Page.Title = LocalizeString("Title");
     if (Globals.FormatVersion(ApplicationVersion) == Globals.FormatVersion(CurrentVersion))
     {
         versionLabel.Visible        = false;
         currentVersionLabel.Visible = false;
         versionsMatch.Text          = LocalizeString("VersionsMatch");
         if (Globals.IncrementalVersionExists(CurrentVersion))
         {
             versionsMatch.Text = LocalizeString("VersionsMatchButIncrementalExists");
         }
     }
     else
     {
         versionLabel.Text        = string.Format(LocalizeString("Version"), Globals.FormatVersion(ApplicationVersion));
         currentVersionLabel.Text = string.Format(LocalizeString("CurrentVersion"), Globals.FormatVersion(CurrentVersion));
     }
 }
        /// <summary>
        /// cmdDelete_Click runs when the delete Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                RoleController objUser = new RoleController();

                objUser.DeleteRole(RoleID, PortalSettings.PortalId);
                EventLogController objEventLog = new EventLogController();
                objEventLog.AddLog("RoleID", RoleID.ToString(), PortalSettings, UserId, EventLogController.EventLogType.ROLE_DELETED);

                //Clear Roles Cache
                DataCache.RemoveCache("GetRoles");

                Response.Redirect(Globals.NavigateURL());
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #30
0
 private void LocalizePage()
 {
     this.SetBrowserLanguage();
     this.Page.Title = this.LocalizeString("Title");
     if (Globals.FormatVersion(this.ApplicationVersion) == Globals.FormatVersion(this.CurrentVersion))
     {
         this.versionLabel.Visible        = false;
         this.currentVersionLabel.Visible = false;
         this.versionsMatch.Text          = this.LocalizeString("VersionsMatch");
         if (Globals.IncrementalVersionExists(this.CurrentVersion))
         {
             this.versionsMatch.Text = this.LocalizeString("VersionsMatchButIncrementalExists");
         }
     }
     else
     {
         this.versionLabel.Text        = string.Format(this.LocalizeString("Version"), Globals.FormatVersion(this.ApplicationVersion));
         this.currentVersionLabel.Text = string.Format(this.LocalizeString("CurrentVersion"), Globals.FormatVersion(this.CurrentVersion));
     }
 }