예제 #1
0
		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			cmdLogin.Click += OnLoginClick;

			ClientAPI.RegisterKeyCapture(Parent, cmdLogin, 13);

            if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration)
            {
                liRegister.Visible = false;
            }
            lblLogin.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_LOGIN_INSTRUCTIONS");

            var returnUrl = Globals.NavigateURL();
            string url;
            if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["returnurl"]))
                {
                    returnUrl = Request.QueryString["returnurl"];
                }
                returnUrl = HttpUtility.UrlEncode(returnUrl);

                url = Globals.RegisterURL(returnUrl, Null.NullString);
                registerLink.NavigateUrl = url;
            }
            else
            {
                registerLink.Visible = false;
            }

            //see if the portal supports persistant cookies
            chkCookie.Visible = Host.RememberCheckbox;

            url = Globals.NavigateURL("SendPassword", "returnurl=" + returnUrl);
            passwordLink.NavigateUrl = url;
            if (PortalSettings.EnablePopUps)
            {
                passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650));
            }


            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["verificationcode"]) && 
                    PortalSettings.UserRegistration == (int) Globals.PortalRegistrationType.VerifiedRegistration)
                {
                    if (Request.IsAuthenticated)
                    {
                        Controls.Clear();
                    }

                    var verificationCode = Request.QueryString["verificationcode"];


                    try
                    {
                        UserController.VerifyUser(verificationCode.Replace(".", "+").Replace("-", "/").Replace("_", "="));
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("VerificationSuccess", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
                    }
                    catch (UserAlreadyVerifiedException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserAlreadyVerified", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                    catch (InvalidVerificationCodeException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    catch (UserDoesNotExistException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserDoesNotExist", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    catch (Exception)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                }
            }

			if (!Request.IsAuthenticated)
			{
				if (Page.IsPostBack == false)
				{
					try
					{
						if (Request.QueryString["username"] != null)
						{
							txtUsername.Text = Request.QueryString["username"];
						}
					}
					catch (Exception ex)
					{
						//control not there 
						DnnLog.Error(ex);
					}
				}
				try
				{
					Globals.SetFormFocus(string.IsNullOrEmpty(txtUsername.Text) ? txtUsername : txtPassword);
				}
				catch (Exception ex)
				{
					//Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following
					//control not there or error setting focus
					DnnLog.Error(ex);
				}
			}

		    var registrationType = PortalController.GetPortalSettingAsInteger("Registration_RegistrationFormType", PortalId, 0);
		    bool useEmailAsUserName;
            if (registrationType == 0)
            {
                useEmailAsUserName = PortalController.GetPortalSettingAsBoolean("Registration_UseEmailAsUserName", PortalId, false);
            }
            else
            {
                var registrationFields = PortalController.GetPortalSetting("Registration_RegistrationFields", PortalId, String.Empty);
                useEmailAsUserName = !registrationFields.Contains("Username");
            }

		    plUsername.Text = LocalizeString(useEmailAsUserName ? "Email" : "Username");
		    divCaptcha1.Visible = UseCaptcha;
			divCaptcha2.Visible = UseCaptcha;
		}
예제 #2
0
        private void DeleteControl(int index)
        {
            var dashboardControl = DashboardControlList[index];

            Response.Redirect(Util.UnInstallURL(TabId, dashboardControl.PackageID, Server.UrlEncode(Globals.NavigateURL(TabId, "DashboardControls", "mid=" + ModuleId))), true);
        }
예제 #3
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Site Settings
        /// </summary>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        ///     [cnurse]	10/19/2004	modified to support custm module specific settings
        /// </history>
        protected void cmdUpdate_Click(object Sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    ModuleController objModules     = new ModuleController();
                    bool             AllTabsChanged = false;

                    // tab administrators can only manage their own tab
                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
                    {
                        chkAllTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllModules.Enabled = false;
                        cboTab.Enabled        = false;
                    }

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

                    objModule.ModuleID    = moduleId;
                    objModule.ModuleTitle = txtTitle.Text;
                    objModule.Alignment   = cboAlign.SelectedItem.Value;
                    objModule.Color       = txtColor.Text;
                    objModule.Border      = txtBorder.Text;
                    objModule.IconFile    = ctlIcon.Url;
                    if (!String.IsNullOrEmpty(txtCacheTime.Text))
                    {
                        objModule.CacheTime = int.Parse(txtCacheTime.Text);
                    }
                    else
                    {
                        objModule.CacheTime = 0;
                    }
                    objModule.TabID = TabId;
                    if (objModule.AllTabs != chkAllTabs.Checked)
                    {
                        AllTabsChanged = true;
                    }
                    objModule.AllTabs = chkAllTabs.Checked;
                    switch (int.Parse(cboVisibility.SelectedItem.Value))
                    {
                    case 0:

                        objModule.Visibility = VisibilityState.Maximized;
                        break;

                    case 1:

                        objModule.Visibility = VisibilityState.Minimized;
                        break;

                    case 2:

                        objModule.Visibility = VisibilityState.None;
                        break;
                    }
                    objModule.IsDeleted = false;
                    objModule.Header    = txtHeader.Text;
                    objModule.Footer    = txtFooter.Text;
                    if (!String.IsNullOrEmpty(txtStartDate.Text))
                    {
                        objModule.StartDate = Convert.ToDateTime(txtStartDate.Text);
                    }
                    else
                    {
                        objModule.StartDate = Null.NullDate;
                    }
                    if (!String.IsNullOrEmpty(txtEndDate.Text))
                    {
                        objModule.EndDate = Convert.ToDateTime(txtEndDate.Text);
                    }
                    else
                    {
                        objModule.EndDate = Null.NullDate;
                    }
                    objModule.ContainerSrc           = ctlModuleContainer.SkinSrc;
                    objModule.ModulePermissions      = dgPermissions.Permissions;
                    objModule.InheritViewPermissions = chkInheritPermissions.Checked;
                    objModule.DisplayTitle           = chkDisplayTitle.Checked;
                    objModule.DisplayPrint           = chkDisplayPrint.Checked;
                    objModule.DisplaySyndicate       = chkDisplaySyndicate.Checked;
                    objModule.IsDefaultModule        = chkDefault.Checked;
                    objModule.AllModules             = chkAllModules.Checked;
                    objModules.UpdateModule(objModule);

                    //Update Custom Settings
                    if (ctlSpecific != null)
                    {
                        ctlSpecific.UpdateSettings();
                    }

                    //These Module Copy/Move statements must be
                    //at the end of the Update as the Controller code assumes all the
                    //Updates to the Module have been carried out.

                    //Check if the Module is to be Moved to a new Tab
                    if (!chkAllTabs.Checked)
                    {
                        int newTabId = int.Parse(cboTab.SelectedItem.Value);
                        if (TabId != newTabId)
                        {
                            objModules.MoveModule(moduleId, TabId, newTabId, "");
                        }
                    }

                    //'Check if Module is to be Added/Removed from all Tabs
                    if (AllTabsChanged)
                    {
                        ArrayList arrTabs = Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true);
                        if (chkAllTabs.Checked)
                        {
                            objModules.CopyModule(moduleId, TabId, arrTabs, true);
                        }
                        else
                        {
                            objModules.DeleteAllModules(moduleId, TabId, arrTabs, false, false);
                        }
                    }

                    // Navigate back to admin page
                    Response.Redirect(Globals.NavigateURL(), true);
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #4
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// btnSearch_Click runs when the user searches for accounts by username or email
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///     [dancaron]	10/28/2004	Intial Version
 /// </history>
 /// -----------------------------------------------------------------------------
 private void OnSearchClick(Object sender, EventArgs e)
 {
     CurrentPage    = 1;
     txtSearch.Text = txtSearch.Text.Trim();
     Response.Redirect(Globals.NavigateURL(TabId, "", UserFilter(true)));
 }
예제 #5
0
        /// <summary>
        /// cmdUpdate_Click runs when the update 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 cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    float  sglServiceFee       = 0;
                    int    intBillingPeriod    = 1;
                    string strBillingFrequency = "N";

                    if (!String.IsNullOrEmpty(txtServiceFee.Text) && !String.IsNullOrEmpty(txtBillingPeriod.Text) && cboBillingFrequency.SelectedItem.Value != "N")
                    {
                        sglServiceFee       = float.Parse(txtServiceFee.Text);
                        intBillingPeriod    = int.Parse(txtBillingPeriod.Text);
                        strBillingFrequency = cboBillingFrequency.SelectedItem.Value;
                    }

                    float  sglTrialFee       = 0;
                    int    intTrialPeriod    = 1;
                    string strTrialFrequency = "N";

                    if (sglServiceFee != 0 && !String.IsNullOrEmpty(txtTrialFee.Text) && !String.IsNullOrEmpty(txtTrialPeriod.Text) && cboTrialFrequency.SelectedItem.Value != "N")
                    {
                        sglTrialFee       = float.Parse(txtTrialFee.Text);
                        intTrialPeriod    = int.Parse(txtTrialPeriod.Text);
                        strTrialFrequency = cboTrialFrequency.SelectedItem.Value;
                    }

                    RoleController objRoleController = new RoleController();
                    RoleInfo       objRoleInfo       = new RoleInfo();
                    objRoleInfo.PortalID         = PortalId;
                    objRoleInfo.RoleID           = RoleID;
                    objRoleInfo.RoleGroupID      = int.Parse(cboRoleGroups.SelectedValue);
                    objRoleInfo.RoleName         = txtRoleName.Text;
                    objRoleInfo.Description      = txtDescription.Text;
                    objRoleInfo.ServiceFee       = sglServiceFee;
                    objRoleInfo.BillingPeriod    = intBillingPeriod;
                    objRoleInfo.BillingFrequency = strBillingFrequency;
                    objRoleInfo.TrialFee         = sglTrialFee;
                    objRoleInfo.TrialPeriod      = intTrialPeriod;
                    objRoleInfo.TrialFrequency   = strTrialFrequency;
                    objRoleInfo.IsPublic         = chkIsPublic.Checked;
                    objRoleInfo.AutoAssignment   = chkAutoAssignment.Checked;
                    objRoleInfo.RSVPCode         = txtRSVPCode.Text;
                    objRoleInfo.IconFile         = ctlIcon.Url;

                    EventLogController objEventLog = new EventLogController();
                    if (RoleID == -1)
                    {
                        if (objRoleController.GetRoleByName(PortalId, objRoleInfo.RoleName) == null)
                        {
                            objRoleController.AddRole(objRoleInfo);
                            objEventLog.AddLog(objRoleInfo, PortalSettings, UserId, "", EventLogController.EventLogType.ROLE_CREATED);
                        }
                        else
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateRole", this.LocalResourceFile), ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        objRoleController.UpdateRole(objRoleInfo);
                        objEventLog.AddLog(objRoleInfo, PortalSettings, UserId, "", EventLogController.EventLogType.ROLE_UPDATED);
                    }

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

                    Response.Redirect(Globals.NavigateURL());
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #6
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(Globals.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;
            }

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

            //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;
            }
            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 - 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);
            }
        }
예제 #7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Is there more than one site in this group?
            var multipleSites = GetCurrentPortalsGroup().Count() > 1;

            ClientAPI.RegisterClientVariable(Page, "moduleSharing", multipleSites.ToString().ToLowerInvariant(), true);

            ServicesFramework.Instance.RequestAjaxAntiForgerySupport();

            cmdAddModule.Click                += CmdAddModuleClick;
            AddNewModule.CheckedChanged       += AddNewOrExisting_OnClick;
            AddExistingModule.CheckedChanged  += AddNewOrExisting_OnClick;
            SiteList.SelectedIndexChanged     += SiteList_SelectedIndexChanged;
            CategoryList.SelectedIndexChanged += CategoryListSelectedIndexChanged;
            PageLst.SelectedIndexChanged      += PageLstSelectedIndexChanged;
            PaneLst.SelectedIndexChanged      += PaneLstSelectedIndexChanged;
            PositionLst.SelectedIndexChanged  += PositionLstSelectedIndexChanged;

            try
            {
                if ((Visible))
                {
                    cmdAddModule.Enabled      = Enabled;
                    AddExistingModule.Enabled = Enabled;
                    AddNewModule.Enabled      = Enabled;
                    Title.Enabled             = Enabled;
                    PageLst.Enabled           = Enabled;
                    ModuleLst.Enabled         = Enabled;
                    VisibilityLst.Enabled     = Enabled;
                    PaneLst.Enabled           = Enabled;
                    PositionLst.Enabled       = Enabled;
                    PaneModulesLst.Enabled    = Enabled;

                    UserInfo objUser = UserController.Instance.GetCurrentUserInfo();
                    if ((objUser != null))
                    {
                        if (objUser.IsSuperUser)
                        {
                            var objModule = ModuleController.Instance.GetModuleByDefinition(-1, "Extensions");
                            if (objModule != null)
                            {
                                var strURL = Globals.NavigateURL(objModule.TabID, true);
                                hlMoreExtensions.NavigateUrl = strURL + "#moreExtensions";
                            }
                            else
                            {
                                hlMoreExtensions.Enabled = false;
                            }
                            hlMoreExtensions.Text    = GetString("hlMoreExtensions");
                            hlMoreExtensions.Visible = true;
                        }
                    }
                }

                if ((!IsPostBack && Visible && Enabled))
                {
                    AddNewModule.Checked = true;
                    LoadAllLists();
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #8
0
        /// <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()
        {
            TabController objTabs = new TabController();
            TabInfo       objTab;

            // redirect to a specific tab based on name
            if (Request.QueryString["tabname"] != "")
            {
                string strURL = "";

                objTab = objTabs.GetTabByName(Request.QueryString["TabName"], ((PortalSettings)HttpContext.Current.Items["PortalSettings"]).PortalId);
                if (objTab != null)
                {
                    int      actualParamCount = 0;
                    string[] elements         = new string[Request.QueryString.Count - 1 + 1]; //maximum number of elements
                    for (int intParam = 0; intParam <= Request.QueryString.Count - 1; intParam++)
                    {
                        switch (Request.QueryString.Keys[intParam].ToLower())
                        {
                        case "tabid":
                            break;

                        case "tabname":

                            break;

                        default:

                            elements[actualParamCount] = Request.QueryString.Keys[intParam] + "=" + Request.QueryString[intParam];
                            actualParamCount++;
                            break;
                        }
                    }
                    string[] copiedTo = new string[actualParamCount - 1 + 1];
                    elements.CopyTo(copiedTo, 0); //redim to remove blank elements
                    elements = copiedTo;
                    //elements = (string[])Microsoft.VisualBasic.CompilerServices.Utils.CopyArray( (Array)elements, new string[actualParamCount - 1 + 1] ); //redim to remove blank elements

                    Response.Redirect(Globals.NavigateURL(objTab.TabID, Null.NullString, elements), true);
                }
            }

            if (Request.IsAuthenticated)
            {
                // set client side page caching for authenticated users
                if (Convert.ToString(PortalSettings.HostSettings["AuthenticatedCacheability"]) != "")
                {
                    switch (Convert.ToString(PortalSettings.HostSettings["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;
                    }
                }
                else
                {
                    Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
                }
            }

            // page comment
            if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y")
            {
                Comment += "\r\n" + "<!--*********************************************-->"
                           + "\r\n" + "<!-- DotNetNuke - http://www.dotnetnuke.com      -->"
                           + "\r\n" + "<!-- Copyright (c) 2002-2007                     -->"
                           + "\r\n" + "<!-- by DotNetNuke Corporation                   -->"
                           + "\r\n" + "<!--*********************************************-->"
                           + "\r\n";
            }
            Page.Header.Controls.AddAt(0, new LiteralControl(Comment));

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

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

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

            foreach (TabInfo tempLoopVar_objTab in PortalSettings.ActiveTab.BreadCrumbs)
            {
                objTab    = tempLoopVar_objTab;
                strTitle += " > " + objTab.TabName;
            }
            // show copyright credits?
            if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y")
            {
                strTitle += " ( DNN " + PortalSettings.Version + " )";
            }
            // tab title override
            if (!String.IsNullOrEmpty(PortalSettings.ActiveTab.Title))
            {
                strTitle = PortalSettings.ActiveTab.Title;
            }
            this.Title = strTitle;

            //set the background image if there is one selected
            if (this.FindControl("Body") != null)
            {
                if (!String.IsNullOrEmpty(PortalSettings.BackgroundFile))
                {
                    ((HtmlGenericControl)this.FindControl("Body")).Attributes["background"] = PortalSettings.HomeDirectory + PortalSettings.BackgroundFile;
                }
            }

            // 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 (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y")
            {
                KeyWords += ",DotNetNuke,DNN";
            }

            // META copyright
            if (!String.IsNullOrEmpty(PortalSettings.FooterText))
            {
                Copyright = PortalSettings.FooterText;
            }
            else
            {
                Copyright = "Copyright (c) " + DateTime.Now.ToString("yyyy") + " by " + PortalSettings.PortalName;
            }

            // META generator
            if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y")
            {
                Generator = "DotNetNuke " + PortalSettings.Version;
            }
            else
            {
                Generator = "";
            }

            Page.ClientScript.RegisterClientScriptInclude("dnncore", ResolveUrl("~/js/dnncore.js"));
        }
예제 #9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the Update button is clicked.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/17/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnUpdateClick(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    int portalID;
                    if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
                    {
                        portalID = -1;
                    }
                    else
                    {
                        portalID = PortalId;
                    }
                    var objVendors = new VendorController();
                    var objVendor  = new VendorInfo
                    {
                        PortalId   = portalID,
                        VendorId   = VendorID,
                        VendorName = txtVendorName.Text,
                        Unit       = addresssVendor.Unit,
                        Street     = addresssVendor.Street,
                        City       = addresssVendor.City,
                        Region     = addresssVendor.Region,
                        Country    = addresssVendor.Country,
                        PostalCode = addresssVendor.Postal,
                        Telephone  = addresssVendor.Telephone,
                        Fax        = addresssVendor.Fax,
                        Cell       = addresssVendor.Cell,
                        Email      = txtEmail.Text,
                        Website    = txtWebsite.Text,
                        FirstName  = txtFirstName.Text,
                        LastName   = txtLastName.Text,
                        UserName   = UserInfo.UserID.ToString(),
                        LogoFile   = ctlLogo.Url,
                        KeyWords   = txtKeyWords.Text,
                        Authorized = chkAuthorized.Checked
                    };
                    if (VendorID == -1)
                    {
                        try
                        {
                            VendorID = objVendors.AddVendor(objVendor);
                        }
                        catch
                        {
                            AddModuleMessage("ErrorAddVendor", ModuleMessage.ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        VendorInfo vendorCheck = objVendors.GetVendor(VendorID, portalID);
                        if (vendorCheck != null)
                        {
                            objVendors.UpdateVendor(objVendor);
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL());
                        }
                    }

                    if (cmdUpdate.Text == "Signup")
                    {
                        var custom = new ArrayList();
                        custom.Add(DateTime.Now.ToString());
                        custom.Add(txtVendorName.Text);
                        custom.Add(txtFirstName.Text);
                        custom.Add(txtLastName.Text);
                        custom.Add(addresssVendor.Unit);
                        custom.Add(addresssVendor.Street);
                        custom.Add(addresssVendor.City);
                        custom.Add(addresssVendor.Region);
                        custom.Add(addresssVendor.Country);
                        custom.Add(addresssVendor.Postal);
                        custom.Add(addresssVendor.Telephone);
                        custom.Add(addresssVendor.Fax);
                        custom.Add(addresssVendor.Cell);
                        custom.Add(txtEmail.Text);
                        custom.Add(txtWebsite.Text);
                        //send email to Admin
                        Mail.SendEmail(PortalSettings.Email,
                                       PortalSettings.Email,
                                       Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_ADMINISTRATOR_SUBJECT"),
                                       Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_ADMINISTRATOR_BODY", Localization.GlobalResourceFile, custom));


                        //send email to vendor
                        custom.Clear();
                        custom.Add(txtFirstName.Text);
                        custom.Add(txtLastName.Text);
                        custom.Add(txtVendorName.Text);

                        Mail.SendEmail(PortalSettings.Email,
                                       txtEmail.Text,
                                       Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_SUBJECT"),
                                       Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_BODY", Localization.GlobalResourceFile, custom));


                        ReturnUrl(txtVendorName.Text.Substring(0, 1));
                    }
                    else
                    {
                        ReturnUrl(Convert.ToString(ViewState["filter"]));
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <remarks>
        /// Loads the cboSource control list with locations of controls.
        /// </remarks>
        private void InstallManifest(string strManifest)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(strManifest);

                XmlNode dnnRoot = doc.DocumentElement;
                foreach (XmlElement FolderElement in dnnRoot.SelectNodes("folders/folder"))
                {
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    DesktopModuleInfo       objDesktopModule  = new DesktopModuleInfo();

                    objDesktopModule.DesktopModuleID = Null.NullInteger;
                    objDesktopModule.ModuleName      = XmlUtils.GetNodeValue(FolderElement, "modulename", "");
                    objDesktopModule.FolderName      = XmlUtils.GetNodeValue(FolderElement, "foldername", "");
                    objDesktopModule.FriendlyName    = XmlUtils.GetNodeValue(FolderElement, "friendlyname", "");
                    if (objDesktopModule.FolderName == "")
                    {
                        objDesktopModule.FolderName = objDesktopModule.ModuleName;
                    }
                    objDesktopModule.Description             = XmlUtils.GetNodeValue(FolderElement, "description", "");
                    objDesktopModule.IsPremium               = false;
                    objDesktopModule.IsAdmin                 = false;
                    objDesktopModule.Version                 = XmlUtils.GetNodeValue(FolderElement, "version", "");
                    objDesktopModule.BusinessControllerClass = XmlUtils.GetNodeValue(FolderElement, "businesscontrollerclass", "");
                    objDesktopModule.CompatibleVersions      = XmlUtils.GetNodeValue(FolderElement, "compatibleversions", "");
                    objDesktopModule.DesktopModuleID         = objDesktopModules.AddDesktopModule(objDesktopModule);

                    foreach (XmlElement ModuleElement in FolderElement.SelectNodes("modules/module"))
                    {
                        ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
                        ModuleDefinitionInfo       objModuleDefinition  = new ModuleDefinitionInfo();

                        objModuleDefinition.ModuleDefID      = Null.NullInteger;
                        objModuleDefinition.DesktopModuleID  = objDesktopModule.DesktopModuleID;
                        objModuleDefinition.FriendlyName     = XmlUtils.GetNodeValue(ModuleElement, "friendlyname", "");
                        objModuleDefinition.DefaultCacheTime = XmlUtils.GetNodeValueInt(ModuleElement, "cachetime", 0);

                        objModuleDefinition.ModuleDefID = objModuleDefinitions.AddModuleDefinition(objModuleDefinition);

                        foreach (XmlElement ControlElement in ModuleElement.SelectNodes("controls/control"))
                        {
                            ModuleControlController objModuleControls = new ModuleControlController();
                            ModuleControlInfo       objModuleControl  = new ModuleControlInfo();

                            objModuleControl.ModuleControlID = Null.NullInteger;
                            objModuleControl.ModuleDefID     = objModuleDefinition.ModuleDefID;
                            objModuleControl.ControlKey      = XmlUtils.GetNodeValue(ControlElement, "key", "");
                            objModuleControl.ControlSrc      = XmlUtils.GetNodeValue(ControlElement, "src", "");
                            objModuleControl.ControlTitle    = XmlUtils.GetNodeValue(ControlElement, "title", "");
                            switch (XmlUtils.GetNodeValue(ControlElement, "type", ""))
                            {
                            case "Anonymous":

                                objModuleControl.ControlType = SecurityAccessLevel.Anonymous;
                                break;

                            case "View":

                                objModuleControl.ControlType = SecurityAccessLevel.View;
                                break;

                            case "Edit":

                                objModuleControl.ControlType = SecurityAccessLevel.Edit;
                                break;

                            case "Admin":

                                objModuleControl.ControlType = SecurityAccessLevel.Admin;
                                break;

                            case "Host":

                                objModuleControl.ControlType = SecurityAccessLevel.Host;
                                break;
                            }
                            objModuleControl.HelpURL   = XmlUtils.GetNodeValue(ControlElement, "helpurl", "");
                            objModuleControl.IconFile  = XmlUtils.GetNodeValue(ControlElement, "iconfile", "");
                            objModuleControl.ViewOrder = XmlUtils.GetNodeValueInt(ControlElement, "vieworder", 0);

                            objModuleControls.AddModuleControl(objModuleControl);
                        }
                    }
                    // update interfaces
                    UpdateModuleInterfaces(objDesktopModule.BusinessControllerClass);
                }

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception ex)
            {
                // can not open manifest
                UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InstallManifest.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
            }
        }
        /// <summary>
        /// cmdDelete_Click runs when the Delete Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Null.IsNull(DesktopModuleId))
                {
                    string strRoot = Request.MapPath("~/DesktopModules/" + txtFolderName.Text) + "\\";

                    // process uninstall script
                    string strProviderType = "data";
                    ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration(strProviderType);
                    string strUninstallScript = "Uninstall." + objProviderConfiguration.DefaultProvider;
                    if (File.Exists(strRoot + strUninstallScript))
                    {
                        // read uninstall script
                        StreamReader objStreamReader;
                        objStreamReader = File.OpenText(strRoot + strUninstallScript);
                        string strScript = objStreamReader.ReadToEnd();
                        objStreamReader.Close();

                        // execute uninstall script
                        PortalSettings.ExecuteScript(strScript);
                    }

                    if (Directory.Exists(strRoot))
                    {
                        if (chkDelete.Checked)
                        {
                            //runtime so remove files/folders
                            // find dnn manifest file
                            string[] arrFiles = Directory.GetFiles(strRoot, "*.dnn.config");
                            if (arrFiles.Length == 0)
                            {
                                arrFiles = Directory.GetFiles(strRoot, "*.dnn");   // legacy versions stored the *.dnn files unprotected
                            }
                            if (arrFiles.Length != 0)
                            {
                                if (File.Exists(strRoot + Path.GetFileName(arrFiles[0])))
                                {
                                    XmlDocument xmlDoc = new XmlDocument();

                                    // load the manifest file
                                    xmlDoc.Load(strRoot + Path.GetFileName(arrFiles[0]));

                                    // check version
                                    XmlNode myNodeModule = null;
                                    switch (xmlDoc.DocumentElement.LocalName.ToLower())
                                    {
                                    case "module":

                                        myNodeModule = xmlDoc.SelectSingleNode("//module");
                                        break;

                                    case "dotnetnuke":

                                        string version = xmlDoc.DocumentElement.Attributes["version"].InnerText;
                                        switch (version)
                                        {
                                        case "2.0":

                                            // V2 allows for multiple folders in a single DNN definition - we need to identify the correct node
                                            foreach (XmlNode nodeModule in xmlDoc.SelectNodes("//dotnetnuke/folders/folder"))
                                            {
                                                if (nodeModule.SelectSingleNode("name").InnerText.Trim() == txtFriendlyName.Text)
                                                {
                                                    myNodeModule = nodeModule;
                                                    break;
                                                }
                                            }
                                            break;

                                        case "3.0":

                                            // V3 also allows for multiple folders in a single DNN definition - but uses module name
                                            foreach (XmlNode nodeModule in xmlDoc.SelectNodes("//dotnetnuke/folders/folder"))
                                            {
                                                if (nodeModule.SelectSingleNode("name").InnerText.Trim() == txtModuleName.Text)
                                                {
                                                    myNodeModule = nodeModule;
                                                    break;
                                                }
                                            }
                                            break;
                                        }
                                        break;
                                    }

                                    // loop through file nodes
                                    foreach (XmlNode nodeFile in myNodeModule.SelectNodes("files/file"))
                                    {
                                        string strFileName      = nodeFile.SelectSingleNode("name").InnerText.Trim();
                                        string strFileExtension = Path.GetExtension(strFileName).Replace(".", "");
                                        if (strFileExtension == "dll")
                                        {
                                            // remove DLL from /bin
                                            strFileName = Request.MapPath("~/bin/") + strFileName;
                                        }
                                        if (File.Exists(strFileName))
                                        {
                                            File.SetAttributes(strFileName, FileAttributes.Normal);
                                            File.Delete(strFileName);
                                        }
                                    }

                                    //Recursively Delete any sub Folders
                                    DeleteSubFolders(strRoot, true);

                                    //Recursively delete AppCode folders
                                    string appCode = strRoot.Replace("DesktopModules", "App_Code");
                                    DeleteSubFolders(appCode, true);

                                    //Delete the <codeSubDirectory> node in web.config
                                    Config.RemoveCodeSubDirectory(txtFolderName.Text);
                                }
                            }
                        }
                    }

                    // delete the desktopmodule database record
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    objDesktopModules.DeleteDesktopModule(DesktopModuleId);
                }

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #12
0
 private void cmdCancel_Click(object sender, EventArgs e)
 {
     this.Response.Redirect(Globals.NavigateURL());
 }
예제 #13
0
        void FillTypeColumns(int moduleId, TokenReplace objTokenReplace, PortalSettings portalSettings,
                             TabController tabCtrl,
                             DataRow row, FieldSetting field)
        {
            var link = row[field.Title].ToString();
            //Link showed to the user
            bool openInNewWindow;

            if (field.ShowOpenInNewWindow)  //mit URL gepeicherten Wert lesen
            {
                openInNewWindow = UrlUtil.OpenUrlInNewWindow(link);
            }
            else
            {
                switch (Globals.GetURLType(UrlUtil.StripURL(link)))
                {
                case TabType.File:
                    openInNewWindow = true;
                    break;

                case TabType.Tab:     //link to internal tab
                    openInNewWindow = false;
                    break;

                default:
                    openInNewWindow = link.Like(Globals.ApplicationMapPath + "*");
                    break;
                }
            }

            //set caption:
            var caption = field.OutputFormat;

            if (!string.IsNullOrEmpty(caption))
            {
                caption = objTokenReplace.ReplaceEnvironmentTokens(caption, row);
            }
            var isLink = true;
            var url    = "";

            //Link readable by browsers
            link = UrlUtil.StripURL(link);
            if (link != string.Empty)
            {
                switch (Globals.GetURLType(link))
                {
                case TabType.Tab:
                    var tab = tabCtrl.GetTab(int.Parse(link), portalSettings.PortalId, false);
                    if (tab != null)
                    {
                        if (caption == string.Empty)
                        {
                            if (!field.Abbreviate)
                            {
                                var strPath = string.Empty;
                                if (tab.BreadCrumbs != null && tab.BreadCrumbs.Count > 0)
                                {
                                    foreach (TabInfo b in tab.BreadCrumbs)
                                    {
                                        var strLabel = b.TabName;
                                        if (strPath != string.Empty)
                                        {
                                            strPath +=
                                                string.Format(
                                                    "<img src=\"{0}/images/breadcrumb.gif\" border=\"0\" alt=\"Spacer\"/>",
                                                    Globals.ApplicationPath);
                                        }
                                        strPath += strLabel;
                                    }
                                }
                                caption = tab.TabPath.Replace("//",
                                                              string.Format(
                                                                  "<img src=\"{0}/images/breadcrumb.gif\" border=\"0\" alt=\"Spacer\"/>",
                                                                  Globals.ApplicationPath));
                            }
                            else
                            {
                                caption = tab.TabName;
                            }
                        }
                        url = field.EnforceDownload
                                ? Globals.LinkClick(link, portalSettings.ActiveTab.TabID, moduleId)
                                : Globals.NavigateURL(int.Parse(link));
                    }
                    else
                    {
                        caption = Localization.GetString("PageNotFound.ErrorMessage",
                                                         Globals.ResolveUrl(
                                                             string.Format("~{0}{1}/SharedResources.resx",
                                                                           Definition.PathOfModule,
                                                                           Localization.LocalResourceDirectory)));
                        url    = string.Empty;
                        isLink = false;
                    }
                    break;

                case TabType.File:
                    if (caption == string.Empty)
                    {
                        if (link.ToLowerInvariant().StartsWith("fileid="))
                        {
                            var file = FileManager.Instance.GetFile(int.Parse(link.Substring(7)));
                            if (file != null)
                            {
                                if (!field.Abbreviate)
                                {
                                    caption = file.Folder + file.FileName;
                                }
                                else
                                {
                                    caption = file.FileName;
                                }
                            }
                        }
                        else if (field.Abbreviate && link.IndexOf("/", StringComparison.Ordinal) > -1)
                        {
                            caption = link.Substring(Convert.ToInt32(link.LastIndexOf("/", StringComparison.Ordinal) + 1));
                        }
                        else
                        {
                            caption = link;
                        }
                    }
                    url = Globals.LinkClick(link, portalSettings.ActiveTab.TabID, moduleId);
                    break;

                case TabType.Url:
                case TabType.Normal:
                    if (caption == string.Empty)
                    {
                        if (field.Abbreviate && link.IndexOf("/", StringComparison.Ordinal) > -1)
                        {
                            caption = link.Substring(Convert.ToInt32(link.LastIndexOf("/", StringComparison.Ordinal) + 1));
                        }
                        else
                        {
                            caption = link;
                        }
                    }
                    if (!field.TrackDownloads)
                    {
                        url = link;
                    }
                    break;
                }


                if (field.EnforceDownload)
                {
                    url += "&amp;forcedownload=true";
                }

                string strFieldvalue;
                if (isLink)
                {
                    strFieldvalue = string.Format("<!--{1}--><a href=\"{0}\"{2}>{1}</a>", HttpUtility.HtmlEncode(url),
                                                  caption, (openInNewWindow ? " target=\"_blank\"" : ""));
                }
                else
                {
                    strFieldvalue = caption;
                }
                row[field.Title] = strFieldvalue;
                row[field.Title + DataTableColumn.Appendix_Caption]  = caption;
                row[field.Title + DataTableColumn.Appendix_Original] = link;
                row[field.Title + DataTableColumn.Appendix_Url]      = url;
            }
        }
예제 #14
0
 /// <summary>Handles the <see cref="Button.Click" /> event of the <see cref="CancelButton" /> control.</summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 private void CancelButton_Click(object sender, EventArgs e)
 {
     this.Response.Redirect(Globals.NavigateURL(this.TabId), false);
 }
예제 #15
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);
            }
        }
예제 #16
0
 /// <summary>
 /// Return url redirects to the previous page, with or without filter info
 /// </summary>
 /// <param name="filter"></param>
 /// <history>
 ///     [erikvb]	10/18/2007
 /// </history>
 private void ReturnUrl(string filter)
 {
     Response.Redirect(string.IsNullOrEmpty(filter.Trim()) ? Globals.NavigateURL() : Globals.NavigateURL(TabId, Null.NullString, "filter=" + filter), true);
 }
예제 #17
0
 /// <summary>
 /// Handles the <see cref="System.Web.UI.WebControls.Button.Click"/> event of the <see cref="BackButton"/> control.
 /// </summary>
 /// <param name="source">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void BackButton_Click(object source, EventArgs e)
 {
     this.Response.Redirect(Globals.NavigateURL(Utility.GetJobListingTabId(this.JobGroupId, this.PortalSettings) ?? this.TabId));
 }
예제 #18
0
        private bool ProcessMasterModules()
        {
            bool success = true;

            if (TabPermissionController.CanViewPage())
            {
                //We need to ensure that Content Item exists since in old versions Content Items are not needed for tabs
                EnsureContentItemForTab(PortalSettings.ActiveTab);

                // Versioning checks.
                if (!TabController.CurrentPage.HasAVisibleVersion)
                {
                    HandleAccesDenied(true);
                }

                int urlVersion;
                if (TabVersionUtils.TryGetUrlVersion(out urlVersion))
                {
                    if (!TabVersionUtils.CanSeeVersionedPages())
                    {
                        HandleAccesDenied(false);
                        return(true);
                    }

                    if (TabVersionController.Instance.GetTabVersions(TabController.CurrentPage.TabID).All(tabVersion => tabVersion.Version != urlVersion))
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.ErrorPage404, string.Empty, "status=404"));
                    }
                }

                //check portal expiry date
                if (!CheckExpired())
                {
                    if ((PortalSettings.ActiveTab.StartDate < DateAndTime.Now && PortalSettings.ActiveTab.EndDate > DateAndTime.Now) || TabPermissionController.CanAdminPage() || Globals.IsLayoutMode())
                    {
                        foreach (var objModule in PortalSettingsController.Instance().GetTabModules(PortalSettings))
                        {
                            success = ProcessModule(objModule);
                        }
                    }
                    else
                    {
                        HandleAccesDenied(false);
                    }
                }
                else
                {
                    AddPageMessage(this,
                                   "",
                                   string.Format(Localization.GetString("ContractExpired.Error"), PortalSettings.PortalName, Globals.GetMediumDate(PortalSettings.ExpiryDate.ToString(CultureInfo.InvariantCulture)), PortalSettings.Email),
                                   ModuleMessage.ModuleMessageType.RedError);
                }
            }
            else
            {
                //If request localized page which haven't complete translate yet, redirect to default language version.
                var redirectUrl = Globals.AccessDeniedURL(Localization.GetString("TabAccess.Error"));

                // Current locale will use default if did'nt find any
                Locale currentLocale = LocaleController.Instance.GetCurrentLocale(PortalSettings.PortalId);
                if (PortalSettings.ContentLocalizationEnabled &&
                    TabController.CurrentPage.CultureCode != currentLocale.Code)
                {
                    redirectUrl = new LanguageTokenReplace {
                        Language = currentLocale.Code
                    }.ReplaceEnvironmentTokens("[URL]");
                }

                Response.Redirect(redirectUrl, true);
            }
            return(success);
        }
예제 #19
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Contains the functionality to populate the Root aspx page with controls
        /// </summary>
        /// <param name="e"></param>
        /// <remarks>
        /// - obtain PortalSettings from Current Context
        /// - set global page settings.
        /// - initialise reference paths to load the cascading style sheets
        /// - add skin control placeholder.  This holds all the modules and content of the page.
        /// </remarks>
        /// -----------------------------------------------------------------------------
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //set global page settings
            InitializePage();

            //load skin control and register UI js
            UI.Skins.Skin ctlSkin;
            if (PortalSettings.EnablePopUps)
            {
                ctlSkin = UrlUtils.InPopUp() ? UI.Skins.Skin.GetPopUpSkin(this) : UI.Skins.Skin.GetSkin(this);

                //register popup js
                JavaScript.RequestRegistration(CommonJs.jQueryUI);

                var popupFilePath = HttpContext.Current.IsDebuggingEnabled
                                   ? "~/js/Debug/dnn.modalpopup.js"
                                   : "~/js/dnn.modalpopup.js";

                ClientResourceManager.RegisterScript(this, popupFilePath, FileOrder.Js.DnnModalPopup);
            }
            else
            {
                ctlSkin = UI.Skins.Skin.GetSkin(this);
            }

            // DataBind common paths for the client resource loader
            ClientResourceLoader.DataBind();
            ClientResourceLoader.PreRender += (sender, args) => JavaScript.Register(Page);

            //check for and read skin package level doctype
            SetSkinDoctype();

            //Manage disabled pages
            if (PortalSettings.ActiveTab.DisableLink)
            {
                if (TabPermissionController.CanAdminPage())
                {
                    var heading = Localization.GetString("PageDisabled.Header");
                    var message = Localization.GetString("PageDisabled.Text");
                    UI.Skins.Skin.AddPageMessage(ctlSkin, heading, message,
                                                 ModuleMessage.ModuleMessageType.YellowWarning);
                }
                else
                {
                    if (PortalSettings.HomeTabId > 0)
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    }
                    else
                    {
                        Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    }
                }
            }
            //Manage canonical urls
            if (PortalSettings.PortalAliasMappingMode == PortalSettings.PortalAliasMapping.CanonicalUrl)
            {
                string primaryHttpAlias = null;
                if (Config.GetFriendlyUrlProvider() == "advanced")  //advanced mode compares on the primary alias as set during alias identification
                {
                    if (PortalSettings.PrimaryAlias != null && PortalSettings.PortalAlias != null)
                    {
                        if (string.Compare(PortalSettings.PrimaryAlias.HTTPAlias, PortalSettings.PortalAlias.HTTPAlias, StringComparison.InvariantCulture) != 0)
                        {
                            primaryHttpAlias = PortalSettings.PrimaryAlias.HTTPAlias;
                        }
                    }
                }
                else //other modes just depend on the default alias
                {
                    if (string.Compare(PortalSettings.PortalAlias.HTTPAlias, PortalSettings.DefaultPortalAlias, StringComparison.InvariantCulture) != 0)
                    {
                        primaryHttpAlias = PortalSettings.DefaultPortalAlias;
                    }
                }
                if (primaryHttpAlias != null && string.IsNullOrEmpty(CanonicalLinkUrl))//a primary http alias was identified
                {
                    var originalurl = Context.Items["UrlRewrite:OriginalUrl"].ToString();
                    CanonicalLinkUrl = originalurl.Replace(PortalSettings.PortalAlias.HTTPAlias, primaryHttpAlias);

                    if (UrlUtils.IsSecureConnectionOrSslOffload(Request))
                    {
                        CanonicalLinkUrl = CanonicalLinkUrl.Replace("http://", "https://");
                    }
                }
            }

            //check if running with known account defaults
            if (Request.IsAuthenticated && string.IsNullOrEmpty(Request.QueryString["runningDefault"]) == false)
            {
                var userInfo      = HttpContext.Current.Items["UserInfo"] as UserInfo;
                var usernameLower = userInfo?.Username?.ToLowerInvariant();
                //only show message to default users
                if ("admin".Equals(usernameLower) || "host".Equals(usernameLower))
                {
                    var messageText  = RenderDefaultsWarning();
                    var messageTitle = Localization.GetString("InsecureDefaults.Title", Localization.GlobalResourceFile);
                    UI.Skins.Skin.AddPageMessage(ctlSkin, messageTitle, messageText, ModuleMessage.ModuleMessageType.RedError);
                }
            }

            //add CSS links
            ClientResourceManager.RegisterDefaultStylesheet(this, string.Concat(Globals.ApplicationPath, "/Resources/Shared/stylesheets/dnndefault/7.0.0/default.css"));
            ClientResourceManager.RegisterIEStylesheet(this, string.Concat(Globals.HostPath, "ie.css"));

            ClientResourceManager.RegisterStyleSheet(this, string.Concat(ctlSkin.SkinPath, "skin.css"), FileOrder.Css.SkinCss);
            ClientResourceManager.RegisterStyleSheet(this, ctlSkin.SkinSrc.Replace(".ascx", ".css"), FileOrder.Css.SpecificSkinCss);

            //add skin to page
            SkinPlaceHolder.Controls.Add(ctlSkin);

            ClientResourceManager.RegisterStyleSheet(this, string.Concat(PortalSettings.HomeDirectory, "portal.css"), FileOrder.Css.PortalCss);

            //add Favicon
            ManageFavicon();

            //ClientCallback Logic
            ClientAPI.HandleClientAPICallbackEvent(this);

            //add viewstateuserkey to protect against CSRF attacks
            if (User.Identity.IsAuthenticated)
            {
                ViewStateUserKey = User.Identity.Name;
            }

            //set the async postback timeout.
            if (AJAX.IsEnabled())
            {
                AJAX.GetScriptManager(this).AsyncPostBackTimeout = Host.AsyncTimeout;
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdLogin.Click += OnLoginClick;

            cmdCancel.Click += OnCancelClick;

            ClientAPI.RegisterKeyCapture(Parent, cmdLogin, 13);

            if (PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.NoRegistration)
            {
                liRegister.Visible = false;
            }
            lblLogin.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_LOGIN_INSTRUCTIONS");

            if (!string.IsNullOrEmpty(Response.Cookies["USERNAME_CHANGED"].Value))
            {
                txtUsername.Text = Response.Cookies["USERNAME_CHANGED"].Value;
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, Localization.GetSystemMessage(PortalSettings, "MESSAGE_USERNAME_CHANGED_INSTRUCTIONS"), ModuleMessage.ModuleMessageType.BlueInfo);
            }

            var    returnUrl = Globals.NavigateURL();
            string url;

            if (PortalSettings.UserRegistration != (int)Globals.PortalRegistrationType.NoRegistration)
            {
                if (!string.IsNullOrEmpty(UrlUtils.ValidReturnUrl(Request.QueryString["returnurl"])))
                {
                    returnUrl = Request.QueryString["returnurl"];
                }
                returnUrl = HttpUtility.UrlEncode(returnUrl);

                url = Globals.RegisterURL(returnUrl, Null.NullString);
                registerLink.NavigateUrl = url;
                if (PortalSettings.EnablePopUps && PortalSettings.RegisterTabId == Null.NullInteger &&
                    !HasSocialAuthenticationEnabled())
                {
                    registerLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 600, 950));
                }
            }
            else
            {
                registerLink.Visible = false;
            }

            //see if the portal supports persistant cookies
            chkCookie.Visible = Host.RememberCheckbox;



            // no need to show password link if feature is disabled, let's check this first
            if (MembershipProviderConfig.PasswordRetrievalEnabled || MembershipProviderConfig.PasswordResetEnabled)
            {
                url = Globals.NavigateURL("SendPassword", "returnurl=" + returnUrl);
                passwordLink.NavigateUrl = url;
                if (PortalSettings.EnablePopUps)
                {
                    passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650));
                }
            }
            else
            {
                passwordLink.Visible = false;
            }


            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["verificationcode"]) && PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.VerifiedRegistration)
                {
                    if (Request.IsAuthenticated)
                    {
                        Controls.Clear();
                    }

                    var verificationCode = Request.QueryString["verificationcode"];


                    try
                    {
                        UserController.VerifyUser(verificationCode.Replace(".", "+").Replace("-", "/").Replace("_", "="));

                        var redirectTabId = PortalSettings.Registration.RedirectAfterRegistration;

                        if (Request.IsAuthenticated)
                        {
                            Response.Redirect(Globals.NavigateURL(redirectTabId > 0 ? redirectTabId : PortalSettings.HomeTabId, string.Empty, "VerificationSuccess=true"), true);
                        }
                        else
                        {
                            if (redirectTabId > 0)
                            {
                                var redirectUrl = Globals.NavigateURL(redirectTabId, string.Empty, "VerificationSuccess=true");
                                redirectUrl = redirectUrl.Replace(Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias), string.Empty);
                                Response.Cookies.Add(new HttpCookie("returnurl", redirectUrl)
                                {
                                    Path = (!string.IsNullOrEmpty(Globals.ApplicationPath) ? Globals.ApplicationPath : "/")
                                });
                            }

                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("VerificationSuccess", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
                        }
                    }
                    catch (UserAlreadyVerifiedException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserAlreadyVerified", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    }
                    catch (InvalidVerificationCodeException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    catch (UserDoesNotExistException)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("UserDoesNotExist", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                    catch (Exception)
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidVerificationCode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                    }
                }
            }

            if (!Request.IsAuthenticated)
            {
                if (!Page.IsPostBack)
                {
                    try
                    {
                        if (Request.QueryString["username"] != null)
                        {
                            txtUsername.Text = Request.QueryString["username"];
                        }
                    }
                    catch (Exception ex)
                    {
                        //control not there
                        Logger.Error(ex);
                    }
                }
                try
                {
                    Globals.SetFormFocus(string.IsNullOrEmpty(txtUsername.Text) ? txtUsername : txtPassword);
                }
                catch (Exception ex)
                {
                    //Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following
                    //control not there or error setting focus
                    Logger.Error(ex);
                }
            }

            var  registrationType = PortalSettings.Registration.RegistrationFormType;
            bool useEmailAsUserName;

            if (registrationType == 0)
            {
                useEmailAsUserName = PortalSettings.Registration.UseEmailAsUserName;
            }
            else
            {
                var registrationFields = PortalSettings.Registration.RegistrationFields;
                useEmailAsUserName = !registrationFields.Contains("Username");
            }

            plUsername.Text     = LocalizeString(useEmailAsUserName ? "Email" : "Username");
            divCaptcha1.Visible = UseCaptcha;
            divCaptcha2.Visible = UseCaptcha;
        }
예제 #21
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// FilterURL correctly formats the Url for filter by first letter and paging
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected string FilterURL(string filter, string currentPage)
        {
            string url;

            if (!String.IsNullOrEmpty(Filter))
            {
                url = !String.IsNullOrEmpty(currentPage) ? Globals.NavigateURL(TabId, "", "filter=" + filter, "currentpage=" + currentPage) : Globals.NavigateURL(TabId, "", "filter=" + filter);
            }
            else
            {
                url = !String.IsNullOrEmpty(currentPage) ? Globals.NavigateURL(TabId, "", "currentpage=" + currentPage) : Globals.NavigateURL(TabId, "");
            }
            return(url);
        }
예제 #22
0
        protected string BuildToolUrl(string toolName, bool isHostTool, string moduleFriendlyName,
                                      string controlKey, string navigateUrl, bool showAsPopUp)
        {
            if ((isHostTool && !UserController.GetCurrentUserInfo().IsSuperUser))
            {
                return("javascript:void(0);");
            }

            if ((!string.IsNullOrEmpty(navigateUrl)))
            {
                return(navigateUrl);
            }

            string returnValue = "javascript:void(0);";

            switch (toolName)
            {
            case "PageSettings":

                if (TabPermissionController.CanManagePage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=settingTab");
                }

                break;

            case "CopyPage":

                if (TabPermissionController.CanCopyPage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=copy&activeTab=copyTab");
                }

                break;

            case "DeletePage":

                if (TabPermissionController.CanDeletePage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=delete");
                }

                break;

            case "PageTemplate":

                if (TabPermissionController.CanManagePage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=advancedTab");
                }

                break;

            case "PagePermission":

                if (TabPermissionController.CanAdminPage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=permissionsTab");
                }

                break;

            case "ImportPage":

                if (TabPermissionController.CanImportPage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ImportTab");
                }

                break;

            case "ExportPage":

                if (TabPermissionController.CanExportPage())
                {
                    returnValue = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ExportTab");
                }

                break;

            case "NewPage":

                if (DotNetNuke.Security.Permissions.TabPermissionController.CanAddPage())
                {
                    returnValue = Globals.NavigateURL("Tab", "activeTab=settingTab");
                }

                break;

            default:
                if ((!string.IsNullOrEmpty(moduleFriendlyName)))
                {
                    var additionalParams = new List <string>();
                    if ((toolName == "UploadFile" || toolName == "HostUploadFile"))
                    {
                        additionalParams.Add("ftype=File");
                        additionalParams.Add("rtab=" + PortalSettings.ActiveTab.TabID);
                    }
                    returnValue = GetTabURL(additionalParams, toolName, isHostTool,
                                            moduleFriendlyName, controlKey, showAsPopUp);
                }
                break;
            }
            return(returnValue);
        }
예제 #23
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update button is clicked.
        /// </summary>
        /// <history>
        ///     [cnurse]	9/17/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    int intPortalID;
                    if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId)
                    {
                        intPortalID = -1;
                    }
                    else
                    {
                        intPortalID = PortalId;
                    }

                    VendorController objVendors = new VendorController();
                    VendorInfo       objVendor  = new VendorInfo();

                    objVendor.PortalId   = intPortalID;
                    objVendor.VendorId   = VendorID;
                    objVendor.VendorName = txtVendorName.Text;
                    objVendor.Unit       = addresssVendor.Unit;
                    objVendor.Street     = addresssVendor.Street;
                    objVendor.City       = addresssVendor.City;
                    objVendor.Region     = addresssVendor.Region;
                    objVendor.Country    = addresssVendor.Country;
                    objVendor.PostalCode = addresssVendor.Postal;
                    objVendor.Telephone  = addresssVendor.Telephone;
                    objVendor.Fax        = addresssVendor.Fax;
                    objVendor.Cell       = addresssVendor.Cell;
                    objVendor.Email      = txtEmail.Text;
                    objVendor.Website    = txtWebsite.Text;
                    objVendor.FirstName  = txtFirstName.Text;
                    objVendor.LastName   = txtLastName.Text;
                    objVendor.UserName   = UserInfo.UserID.ToString();
                    objVendor.LogoFile   = ctlLogo.Url;
                    objVendor.KeyWords   = txtKeyWords.Text;
                    objVendor.Authorized = chkAuthorized.Checked;

                    if (VendorID == -1)
                    {
                        try
                        {
                            VendorID = objVendors.AddVendor(objVendor);
                        }
                        catch
                        {
                            AddModuleMessage("ErrorAddVendor", ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        VendorInfo objVendorCheck = objVendors.GetVendor(VendorID, intPortalID);
                        if (objVendorCheck != null)
                        {
                            objVendors.UpdateVendor(objVendor);
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL());
                        }
                    }

                    // update vendor classifications
                    ClassificationController objClassifications = new ClassificationController();
                    objClassifications.DeleteVendorClassifications(VendorID);

                    foreach (ListItem lstItem in lstClassifications.Items)
                    {
                        if (lstItem.Selected)
                        {
                            objClassifications.AddVendorClassification(VendorID, int.Parse(lstItem.Value));
                        }
                    }

                    if (cmdUpdate.Text == "Signup")
                    {
                        ArrayList Custom = new ArrayList();
                        Custom.Add(DateTime.Now.ToString());
                        Custom.Add(txtVendorName.Text);
                        Custom.Add(txtFirstName.Text);
                        Custom.Add(txtLastName.Text);
                        Custom.Add(addresssVendor.Unit);
                        Custom.Add(addresssVendor.Street);
                        Custom.Add(addresssVendor.City);
                        Custom.Add(addresssVendor.Region);
                        Custom.Add(addresssVendor.Country);
                        Custom.Add(addresssVendor.Postal);
                        Custom.Add(addresssVendor.Telephone);
                        Custom.Add(addresssVendor.Fax);
                        Custom.Add(addresssVendor.Cell);
                        Custom.Add(txtEmail.Text);
                        Custom.Add(txtWebsite.Text);

                        string strMessage = Mail.SendMail(txtEmail.Text, PortalSettings.Email, "", Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_ADMINISTRATOR_SUBJECT"), Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_ADMINISTRATOR_BODY", Localization.GlobalResourceFile, Custom), "", "", " ", "", "", "");

                        if (strMessage == "")
                        {
                            Custom.Clear();
                            Custom.Add(txtFirstName.Text);
                            Custom.Add(txtLastName.Text);

                            strMessage = Mail.SendMail(PortalSettings.Email, txtEmail.Text, "", Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_SUBJECT"), Localization.GetSystemMessage(PortalSettings, "EMAIL_VENDOR_REGISTRATION_BODY", Localization.GlobalResourceFile, Custom), "", "", " ", "", "", "");
                        }
                        else
                        {
                            AddModuleMessage("EmailErrorAdmin", ModuleMessageType.RedError);
                        }

                        if (strMessage == "")
                        {
                            Response.Redirect(Globals.NavigateURL(this.TabId, Null.NullString, "filter=" + txtVendorName.Text.Substring(0, 1)), true);
                        }
                        else
                        {
                            AddModuleMessage("EmailErrorVendor", ModuleMessageType.RedError);
                        }
                    }
                    else
                    {
                        Response.Redirect(Globals.NavigateURL(this.TabId, Null.NullString, "filter=" + Convert.ToString(ViewState["filter"])), true);
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        ///   Executes the search.
        /// </summary>
        /// <param name = "searchText">The text which will be used to perform the search.</param>
        /// <param name = "searchType">The type of the search. Use "S" for a site search, and "W" for a web search.</param>
        /// <remarks>
        ///   All web based searches will open in a new window, while site searches will open in the current window.  A site search uses the built
        ///   in search engine to perform the search, while both web based search variants will use an external search engine to perform a search.
        /// </remarks>
        protected void ExecuteSearch(string searchText, string searchType)
        {
            int searchTabId = GetSearchTabId();

            if (searchTabId == Null.NullInteger)
            {
                return;
            }
            string strURL;

            if (!string.IsNullOrEmpty(searchText))
            {
                switch (searchType)
                {
                case "S":
                    // site
                    if (UseWebForSite)
                    {
                        strURL = SiteURL;
                        if (!string.IsNullOrEmpty(strURL))
                        {
                            strURL = strURL.Replace("[TEXT]", Server.UrlEncode(searchText));
                            strURL = strURL.Replace("[DOMAIN]", Request.Url.Host);
                            UrlUtils.OpenNewWindow(Page, GetType(), strURL);
                        }
                    }
                    else
                    {
                        if (Host.UseFriendlyUrls)
                        {
                            Response.Redirect(Globals.NavigateURL(searchTabId) + "?Search=" + Server.UrlEncode(searchText));
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL(searchTabId) + "&Search=" + Server.UrlEncode(searchText));
                        }
                    }
                    break;

                case "W":
                    // web
                    strURL = WebURL;
                    if (!string.IsNullOrEmpty(strURL))
                    {
                        strURL = strURL.Replace("[TEXT]", Server.UrlEncode(searchText));
                        strURL = strURL.Replace("[DOMAIN]", "");
                        UrlUtils.OpenNewWindow(Page, GetType(), strURL);
                    }
                    break;
                }
            }
            else
            {
                if (Host.UseFriendlyUrls)
                {
                    Response.Redirect(Globals.NavigateURL(searchTabId));
                }
                else
                {
                    Response.Redirect(Globals.NavigateURL(searchTabId));
                }
            }
        }
예제 #25
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["RoleID"] != null))
                {
                    RoleID = int.Parse(Request.QueryString["RoleID"]);
                }

                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    RoleController objUser = new RoleController();

                    ListController          ctlList        = new ListController();
                    ListEntryInfoCollection colFrequencies = ctlList.GetListEntryInfoCollection("Frequency", "");

                    cboBillingFrequency.DataSource = colFrequencies;
                    cboBillingFrequency.DataBind();
                    cboBillingFrequency.Items.FindByValue("N").Selected = true;

                    cboTrialFrequency.DataSource = colFrequencies;
                    cboTrialFrequency.DataBind();
                    cboTrialFrequency.Items.FindByValue("N").Selected = true;

                    BindGroups();

                    ctlIcon.FileFilter = Globals.glbImageFileTypes;

                    if (RoleID != -1)
                    {
                        lblRoleName.Visible = true;
                        txtRoleName.Visible = false;
                        valRoleName.Enabled = false;

                        RoleInfo objRoleInfo = objUser.GetRole(RoleID, PortalSettings.PortalId);

                        if (objRoleInfo != null)
                        {
                            lblRoleName.Text    = objRoleInfo.RoleName;
                            txtDescription.Text = objRoleInfo.Description;
                            if (cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.Items.FindByValue(objRoleInfo.RoleGroupID.ToString()).Selected = true;
                            }
                            if (string.Format("{0:#,##0.00}", objRoleInfo.ServiceFee) != "0.00")
                            {
                                txtServiceFee.Text    = string.Format("{0:#,##0.00}", objRoleInfo.ServiceFee);
                                txtBillingPeriod.Text = objRoleInfo.BillingPeriod.ToString();
                                if (cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency) != null)
                                {
                                    cboBillingFrequency.ClearSelection();
                                    cboBillingFrequency.Items.FindByValue(objRoleInfo.BillingFrequency).Selected = true;
                                }
                            }
                            if (objRoleInfo.TrialFrequency != "N")
                            {
                                txtTrialFee.Text    = string.Format("{0:#,##0.00}", objRoleInfo.TrialFee);
                                txtTrialPeriod.Text = objRoleInfo.TrialPeriod.ToString();
                                if (cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency) != null)
                                {
                                    cboTrialFrequency.ClearSelection();
                                    cboTrialFrequency.Items.FindByValue(objRoleInfo.TrialFrequency).Selected = true;
                                }
                            }
                            chkIsPublic.Checked       = objRoleInfo.IsPublic;
                            chkAutoAssignment.Checked = objRoleInfo.AutoAssignment;
                            txtRSVPCode.Text          = objRoleInfo.RSVPCode;
                            ctlIcon.Url = objRoleInfo.IconFile;
                        }
                        else // security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }

                        if (RoleID == PortalSettings.AdministratorRoleId || RoleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdDelete.Visible = false;
                            cmdUpdate.Visible = false;
                            ActivateControls(false);
                        }

                        if (RoleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdManage.Visible = false;
                        }
                    }
                    else
                    {
                        cmdDelete.Visible   = false;
                        cmdManage.Visible   = false;
                        lblRoleName.Visible = false;
                        txtRoleName.Visible = true;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #26
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 override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            jQuery.RequestDnnPluginsRegistration();

            cboBillingFrequency.SelectedIndexChanged += OnBillingFrequencyIndexChanged;
            cboTrialFrequency.SelectedIndexChanged   += OnTrialFrequencyIndexChanged;
            cmdDelete.Click         += OnDeleteClick;
            cmdManage.Click         += OnManageClick;
            cmdUpdate.Click         += OnUpdateClick;
            txtRSVPCode.TextChanged += OnRsvpCodeChanged;

            try
            {
                if ((Request.QueryString["RoleID"] != null))
                {
                    _roleID = Int32.Parse(Request.QueryString["RoleID"]);
                }
                var objPortalInfo = PortalController.Instance.GetPortal(PortalSettings.PortalId);
                if ((objPortalInfo == null || string.IsNullOrEmpty(objPortalInfo.ProcessorUserId)))
                {
                    //Warn users about fee based roles if we have a Processor Id
                    lblProcessorWarning.Visible = true;
                }
                else
                {
                    divServiceFee.Visible    = true;
                    divBillingPeriod.Visible = true;
                    divTrialFee.Visible      = true;
                    divTrialPeriod.Visible   = true;
                }
                if (Page.IsPostBack == false)
                {
                    cmdCancel.NavigateUrl = Globals.NavigateURL();

                    var ctlList        = new ListController();
                    var colFrequencies = ctlList.GetListEntryInfoItems("Frequency", "");

                    cboBillingFrequency.DataSource = colFrequencies;
                    cboBillingFrequency.DataBind();
                    cboBillingFrequency.FindItemByValue("N").Selected = true;

                    cboTrialFrequency.DataSource = colFrequencies;
                    cboTrialFrequency.DataBind();
                    cboTrialFrequency.FindItemByValue("N").Selected = true;

                    securityModeList.Items.Clear();
                    foreach (var enumValue in Enum.GetValues(typeof(SecurityMode)))
                    {
                        var enumName = Enum.GetName(typeof(SecurityMode), enumValue);
                        var enumItem = new ListItem(enumName, ((int)enumValue).ToString(CultureInfo.InvariantCulture));

                        securityModeList.AddItem(enumItem.Text, enumItem.Value);
                    }

                    statusList.Items.Clear();
                    foreach (var enumValue in Enum.GetValues(typeof(RoleStatus)))
                    {
                        var enumName = Enum.GetName(typeof(RoleStatus), enumValue);
                        var enumItem = new ListItem(enumName, ((int)enumValue).ToString(CultureInfo.InvariantCulture));

                        statusList.AddItem(enumItem.Text, enumItem.Value);
                    }

                    BindGroups();

                    ctlIcon.FileFilter = Globals.glbImageFileTypes;
                    if (_roleID != -1)
                    {
                        var role = RoleController.Instance.GetRole(PortalSettings.PortalId, r => r.RoleID == _roleID);
                        if (role != null)
                        {
                            lblRoleName.Visible = role.IsSystemRole;
                            txtRoleName.Visible = !role.IsSystemRole;
                            valRoleName.Enabled = !role.IsSystemRole;

                            lblRoleName.Text = role.RoleName;
                            txtRoleName.Text = role.RoleName;

                            txtDescription.Text = role.Description;
                            if (cboRoleGroups.FindItemByValue(role.RoleGroupID.ToString(CultureInfo.InvariantCulture)) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.FindItemByValue(role.RoleGroupID.ToString(CultureInfo.InvariantCulture)).Selected = true;
                            }
                            if (!String.IsNullOrEmpty(role.BillingFrequency))
                            {
                                if (role.ServiceFee > 0)
                                {
                                    txtServiceFee.Text    = role.ServiceFee.ToString("N2", CultureInfo.CurrentCulture);
                                    txtBillingPeriod.Text = role.BillingPeriod.ToString(CultureInfo.InvariantCulture);
                                    if (cboBillingFrequency.FindItemByValue(role.BillingFrequency) != null)
                                    {
                                        cboBillingFrequency.ClearSelection();
                                        cboBillingFrequency.FindItemByValue(role.BillingFrequency).Selected = true;
                                    }
                                }
                            }
                            if (!String.IsNullOrEmpty(role.TrialFrequency))
                            {
                                if (role.TrialFee > 0)
                                {
                                    txtTrialFee.Text    = role.TrialFee.ToString("N2", CultureInfo.CurrentCulture);
                                    txtTrialPeriod.Text = role.TrialPeriod.ToString(CultureInfo.InvariantCulture);
                                    if (cboTrialFrequency.FindItemByValue(role.TrialFrequency) != null)
                                    {
                                        cboTrialFrequency.ClearSelection();
                                        cboTrialFrequency.FindItemByValue(role.TrialFrequency).Selected = true;
                                    }
                                }
                            }

                            if (securityModeList.FindItemByValue(Convert.ToString((int)role.SecurityMode)) != null)
                            {
                                securityModeList.ClearSelection();
                                securityModeList.FindItemByValue(Convert.ToString((int)role.SecurityMode)).Selected = true;
                            }

                            if (statusList.FindItemByValue(Convert.ToString((int)role.Status)) != null)
                            {
                                statusList.ClearSelection();
                                statusList.FindItemByValue(Convert.ToString((int)role.Status)).Selected = true;
                            }

                            chkIsPublic.Checked       = role.IsPublic;
                            chkAutoAssignment.Checked = role.AutoAssignment;
                            txtRSVPCode.Text          = role.RSVPCode;
                            if (!String.IsNullOrEmpty(txtRSVPCode.Text))
                            {
                                lblRSVPLink.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + "/" + Globals.glbDefaultPage + "?rsvp=" + txtRSVPCode.Text + "&portalid=" + PortalId;
                            }
                            ctlIcon.Url = role.IconFile;

                            UpdateFeeTextBoxes();
                            cmdManage.Visible = role.Status == RoleStatus.Approved;
                        }
                        else //security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }

                        if (role.IsSystemRole) //disable controls if it's a system role
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("SystemRoleWarning.Text", LocalResourceFile), ModuleMessage.ModuleMessageType.BlueInfo);
                            ActivateControls(false);
                        }

                        if (_roleID == PortalSettings.RegisteredRoleId)
                        {
                            cmdManage.Visible = false;
                        }
                    }
                    else
                    {
                        cmdDelete.Visible   = false;
                        cmdManage.Visible   = false;
                        lblRoleName.Visible = false;
                        txtRoleName.Visible = true;

                        statusList.SelectedIndex = 1;

                        //select default role group id
                        if (Request.QueryString["RoleGroupID"] != null)
                        {
                            var roleGroupID = Request.QueryString["RoleGroupID"];
                            if (cboRoleGroups.FindItemByValue(roleGroupID) != null)
                            {
                                cboRoleGroups.ClearSelection();
                                cboRoleGroups.FindItemByValue(roleGroupID).Selected = true;
                            }
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #27
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        ///     [cnurse]	10/19/2004	modified to support custm module specific settings
        ///     [vmasanas]  11/28/2004  modified to support modules in admin tabs
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                dshModule.Text = Localization.GetString("ModuleSettings", this.LocalResourceFile) + " (" + ModuleConfiguration.FriendlyName + ")";
                // Verify that the current user has access to edit this module
                if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false && PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString()) == false)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (Page.IsPostBack == false)
                {
                    ctlIcon.FileFilter = Globals.glbImageFileTypes;

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

                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    cboTab.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, -1, false, true, false, false, true);
                    cboTab.DataBind();
                    //if is and admin or host tab, then add current tab
                    if (PortalSettings.ActiveTab.ParentId == PortalSettings.AdminTabId || PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId)
                    {
                        cboTab.Items.Insert(0, new ListItem(PortalSettings.ActiveTab.TabName, PortalSettings.ActiveTab.TabID.ToString()));
                    }

                    // tab administrators can only manage their own tab
                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
                    {
                        chkAllTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllModules.Enabled = false;
                        cboTab.Enabled        = false;
                    }

                    if (moduleId != -1)
                    {
                        BindData();
                    }
                    else
                    {
                        cboVisibility.SelectedIndex = 0; // maximized
                        chkAllTabs.Checked          = false;
                        cmdDelete.Visible           = false;
                    }

                    //Set visibility of Specific Settings
                    if (ctlSpecific != null)
                    {
                        //Get the module settings from the PortalSettings and pass the
                        //two settings hashtables to the sub control to process
                        ctlSpecific.LoadSettings();
                        dshSpecific.Visible = true;
                        tblSpecific.Visible = true;
                    }
                    else
                    {
                        dshSpecific.Visible = false;
                        tblSpecific.Visible = false;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #28
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdUpdate_Click runs when the update Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [jlucarino]	2/23/2009	Added CreatedByUserID and LastModifiedByUserID
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnUpdateClick(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    float sglServiceFee       = 0;
                    var   intBillingPeriod    = Null.NullInteger;
                    var   strBillingFrequency = "N";

                    float sglTrialFee       = 0;
                    var   intTrialPeriod    = Null.NullInteger;
                    var   strTrialFrequency = "N";


                    if (cboBillingFrequency.SelectedItem.Value == "N" && !String.IsNullOrEmpty(txtServiceFee.Text))
                    {
                        UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("IncompatibleFee", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                        return;
                    }

                    if (!String.IsNullOrEmpty(txtServiceFee.Text) && cboBillingFrequency.SelectedItem.Value != "N")
                    {
                        sglServiceFee       = float.Parse(txtServiceFee.Text);
                        intBillingPeriod    = String.IsNullOrEmpty(txtBillingPeriod.Text) ? 1 : int.Parse(txtBillingPeriod.Text);
                        strBillingFrequency = cboBillingFrequency.SelectedItem.Value;
                    }

                    if (sglServiceFee != 0 && !String.IsNullOrEmpty(txtTrialFee.Text) && cboTrialFrequency.SelectedItem.Value != "N")
                    {
                        sglTrialFee       = float.Parse(txtTrialFee.Text);
                        intTrialPeriod    = string.IsNullOrEmpty(txtTrialPeriod.Text) ? 1 : int.Parse(txtTrialPeriod.Text);
                        strTrialFrequency = cboTrialFrequency.SelectedItem.Value;
                    }

                    var role = new RoleInfo
                    {
                        PortalID         = PortalId,
                        RoleID           = _roleID,
                        RoleGroupID      = int.Parse(cboRoleGroups.SelectedValue),
                        RoleName         = txtRoleName.Text,
                        Description      = txtDescription.Text,
                        ServiceFee       = sglServiceFee,
                        BillingPeriod    = intBillingPeriod,
                        BillingFrequency = strBillingFrequency,
                        TrialFee         = sglTrialFee,
                        TrialPeriod      = intTrialPeriod,
                        TrialFrequency   = strTrialFrequency,
                        IsPublic         = chkIsPublic.Checked,
                        AutoAssignment   = chkAutoAssignment.Checked,
                        SecurityMode     = (SecurityMode)Enum.Parse(typeof(SecurityMode), securityModeList.SelectedValue),
                        Status           = (RoleStatus)Enum.Parse(typeof(RoleStatus), statusList.SelectedValue),
                        RSVPCode         = txtRSVPCode.Text,
                        IconFile         = ctlIcon.Url
                    };

                    if (_roleID == -1)
                    {
                        if (RoleController.Instance.GetRole(PortalId, r => r.RoleName == role.RoleName) == null)
                        {
                            RoleController.Instance.AddRole(role, chkAssignToExistUsers.Checked);
                        }
                        else
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateRole", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        RoleController.Instance.UpdateRole(role, chkAssignToExistUsers.Checked);
                    }

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

                    Response.Redirect(Globals.NavigateURL(string.Empty, "RoleGroupID=" + role.RoleGroupID));
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #29
0
 protected void cmdCancel_Click(object sender, EventArgs e)
 {
     Response.Redirect(Globals.NavigateURL());
 }
예제 #30
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()
        {
            //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].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-2015, by DNN Corporation -->",
                                         Environment.NewLine,
                                         "<!--*********************************************-->",
                                         Environment.NewLine);
            }

            //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;
                    control.LocalResourceFile = string.Concat(
                        slaveModule.ModuleControl.ControlSrc.Replace(Path.GetFileName(slaveModule.ModuleControl.ControlSrc), string.Empty),
                        Localization.LocalResourceDirectory, "/", Path.GetFileName(slaveModule.ModuleControl.ControlSrc));
                    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;
            }
            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 - hide it inside popups and if PageHeadText of current tab already contains a robots meta tag
            if (!UrlUtils.InPopUp() &&
                !Regex.IsMatch(PortalSettings.ActiveTab.PageHeadText, "<meta([^>])+name=('|\")robots('|\")", RegexOptions.IgnoreCase | RegexOptions.Multiline) &&
                !Regex.IsMatch(PortalSettings.PageHeadText, "<meta([^>])+name=('|\")robots('|\")", RegexOptions.IgnoreCase | RegexOptions.Multiline)
                )
            {
                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 DNN SkinWidgets Inititialization scripts
            if (PortalSettings.EnableSkinWidgets & !UrlUtils.InPopUp())
            {
                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);
            }
        }