/// ----------------------------------------------------------------------------- /// <summary> /// GetLogoffRedirectURL fetches the url to redirect too after logoff /// </summary> /// <param name="settings">A PortalSettings object</param> /// <param name="request">The current Request</param> /// <returns>The Url</returns> /// <history> /// [cnurse] 08/15/2007 Created /// [cnurse] 02/28/2008 DNN-6881 Logoff redirect /// </history> /// ----------------------------------------------------------------------------- public static string GetLogoffRedirectURL(PortalSettings settings, HttpRequest request) { string _RedirectURL = ""; object setting = UserModuleBase.GetSetting(settings.PortalId, "Redirect_AfterLogout"); if (Convert.ToInt32(setting) == Null.NullInteger) { if (TabPermissionController.CanViewPage()) { //redirect to current page (or home page if current page is a profile page to reduce redirects) if (settings.ActiveTab.TabID == settings.UserTabId || settings.ActiveTab.ParentId == settings.UserTabId) { _RedirectURL = TestableGlobals.Instance.NavigateURL(settings.HomeTabId); } else { _RedirectURL = (request != null && request.UrlReferrer != null) ? request.UrlReferrer.PathAndQuery : TestableGlobals.Instance.NavigateURL(settings.ActiveTab.TabID); } } else if (settings.HomeTabId != -1) { //redirect to portal home page specified _RedirectURL = TestableGlobals.Instance.NavigateURL(settings.HomeTabId); } else //redirect to default portal root { _RedirectURL = TestableGlobals.Instance.GetPortalDomainName(settings.PortalAlias.HTTPAlias, request, true) + "/" + Globals.glbDefaultPage; } } else //redirect to after logout page { _RedirectURL = TestableGlobals.Instance.NavigateURL(Convert.ToInt32(setting)); } return(_RedirectURL); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetLogoffRedirectURL fetches the url to redirect too after logoff /// </summary> /// <param name="settings">A PortalSettings object</param> /// <param name="request">The current Request</param> /// <returns>The Url</returns> /// <history> /// [cnurse] 08/15/2007 Created /// [cnurse] 02/28/2008 DNN-6881 Logoff redirect /// </history> /// ----------------------------------------------------------------------------- public static string GetLogoffRedirectURL(PortalSettings settings, HttpRequest request) { string _RedirectURL = ""; object setting = UserModuleBase.GetSetting(settings.PortalId, "Redirect_AfterLogout"); if (Convert.ToInt32(setting) == Null.NullInteger) { if (TabPermissionController.CanViewPage()) { //redirect to current page _RedirectURL = Globals.NavigateURL(settings.ActiveTab.TabID); } else if (settings.HomeTabId != -1) { //redirect to portal home page specified _RedirectURL = Globals.NavigateURL(settings.HomeTabId); } else //redirect to default portal root { _RedirectURL = Globals.GetPortalDomainName(settings.PortalAlias.HTTPAlias, request, true) + "/" + Globals.glbDefaultPage; } } else //redirect to after logout page { _RedirectURL = Globals.NavigateURL(Convert.ToInt32(setting)); } return(_RedirectURL); }
private void Initialize() { int defaultVisible = Null.SetNullInteger(UserModuleBase.GetSetting(PortalId, "Profile_DefaultVisibility")); if (defaultVisible == Null.NullInteger) { _Visibility = UserVisibilityMode.AdminOnly; } else { switch (defaultVisible) { case 0: _Visibility = UserVisibilityMode.AllUsers; break; case 1: _Visibility = UserVisibilityMode.MembersOnly; break; case 2: _Visibility = UserVisibilityMode.AdminOnly; break; } } }
private static void UpdateDisplayName(DataSourceContext context, UserInfo user) { //Update DisplayName to conform to Format object setting = UserModuleBase.GetSetting(context.PortalId, "Security_DisplayNameFormat"); if ((setting != null) && (!string.IsNullOrEmpty(Convert.ToString(setting)))) { user.UpdateDisplayName(Convert.ToString(setting)); } }
private void UpdateDisplayName(int portalId, ref UserInfo user) { //Update DisplayName to conform to Format object setting = UserModuleBase.GetSetting(portalId, "Security_DisplayNameFormat"); if ((setting != null) && (!string.IsNullOrEmpty(Convert.ToString(setting)))) { user.UpdateDisplayName(Convert.ToString(setting)); } }
private string GetSettingValue(string key) { var value = String.Empty; var setting = UserModuleBase.GetSetting(_portalId, key); if ((setting != null) && (!String.IsNullOrEmpty(Convert.ToString(setting)))) { value = Convert.ToString(setting); } return(value); }
private void SetInitialPageSize() { if (Request.QueryString["pagesize"] != null) { grdUsers.PageSize = Convert.ToInt32(Request.QueryString["pagesize"]); } else { var setting = UserModuleBase.GetSetting(UsersPortalId, "Records_PerPage"); grdUsers.PageSize = Convert.ToInt32(setting); } }
/// <summary> /// /// </summary> /// <param name="PortalSettings"></param> /// <param name="ReturnUrl"></param> /// <returns></returns> public string GetRedirectURL(PortalSettings PortalSettings, string ReturnUrl) { string _RedirectURL = ""; object setting = UserModuleBase.GetSetting(PortalSettings.PortalId, "Redirect_AfterRegistration"); if (Convert.ToInt32(setting) > 0) //redirect to after registration page { _RedirectURL = DotNetNuke.Common.Globals.NavigateURL(Convert.ToInt32(setting)); } else { if (Convert.ToInt32(setting) <= 0) { if (ReturnUrl != null) { //return to the url passed to register _RedirectURL = HttpUtility.UrlDecode(ReturnUrl); //redirect url should never contain a protocol ( if it does, it is likely a cross-site request forgery attempt ) if (_RedirectURL.Contains("://") && !_RedirectURL.StartsWith(DotNetNuke.Common.Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias), StringComparison.InvariantCultureIgnoreCase)) { _RedirectURL = ""; } if (_RedirectURL.Contains("?returnurl")) { string baseURL = _RedirectURL.Substring(0, _RedirectURL.IndexOf("?returnurl", StringComparison.Ordinal)); string returnURL = _RedirectURL.Substring(_RedirectURL.IndexOf("?returnurl", StringComparison.Ordinal) + 11); _RedirectURL = string.Concat(baseURL, "?returnurl", HttpUtility.UrlEncode(returnURL)); } } if (String.IsNullOrEmpty(_RedirectURL)) { //redirect to current page _RedirectURL = Globals.NavigateURL(); } } else //redirect to after registration page { _RedirectURL = Globals.NavigateURL(Convert.ToInt32(setting)); } } return(_RedirectURL); }
private static ProfilePropertyDefinitionCollection FillCollection(IDataReader dr) { ArrayList arrDefinitions = CBO.FillCollection(dr, typeof(ProfilePropertyDefinition)); ProfilePropertyDefinitionCollection definitionsCollection = new ProfilePropertyDefinitionCollection(); foreach (ProfilePropertyDefinition definition in arrDefinitions) { definition.ClearIsDirty(); object setting = UserModuleBase.GetSetting(definition.PortalId, "Profile_DefaultVisibility"); if (setting != null) { definition.Visibility = (UserVisibilityMode)setting; } definitionsCollection.Add(definition); } return(definitionsCollection); }
private void SetInitialPageSize() { if (Request.QueryString["pagesize"] != null) { grdUsers.PageSize = Convert.ToInt32(Request.QueryString["pagesize"]); } else { var pageSizeSetting = GetPageSizeSetting(PortalSettings.PortalId, UserInfo.UserID); if (pageSizeSetting != Null.NullInteger) { grdUsers.PageSize = pageSizeSetting; } else { var setting = UserModuleBase.GetSetting(UsersPortalId, "Records_PerPage"); grdUsers.PageSize = Convert.ToInt32(setting); } } }
/// <summary> /// Fills a ProfilePropertyDefinitionCollection from a DataReader /// </summary> /// <param name="dr">An IDataReader object</param> /// <returns>The ProfilePropertyDefinitionCollection</returns> private static ProfilePropertyDefinitionCollection FillCollection(IDataReader dr) { ArrayList arrDefinitions = CBO.FillCollection(dr, typeof(ProfilePropertyDefinition)); ProfilePropertyDefinitionCollection definitionsCollection = new ProfilePropertyDefinitionCollection(); foreach (ProfilePropertyDefinition definition in arrDefinitions) { //Clear the Is Dirty Flag definition.ClearIsDirty(); //Initialise the Visibility object setting = UserModuleBase.GetSetting(definition.PortalId, "Profile_DefaultVisibility"); if (setting != null) { definition.Visibility = (UserVisibilityMode)Enum.Parse(typeof(UserVisibilityMode), setting.ToString()); } //Add to collection definitionsCollection.Add(definition); } return(definitionsCollection); }
protected override void OnInit(EventArgs e) { base.OnInit(e); cmdSearch.Click += OnSearchClick; cmdDeleteUnAuthorized.Click += cmdDeleteUnAuthorized_Click; cmdRemoveDeleted.Click += cmdRemoveDeleted_Click; grdUsers.ItemDataBound += GrdUsersOnItemDataBound; grdUsers.ItemCommand += GrdUsersOnItemCommand; grdUsers.PreRender += GrdUsersOnPreRender; if (!IsPostBack) { SetInitialPageSize(); } if (Request.QueryString["filter"] != null) { Filter = Request.QueryString["filter"]; } if (Request.QueryString["filterproperty"] != null) { FilterProperty = Request.QueryString["filterproperty"]; } if (String.IsNullOrEmpty(Filter)) { //Get Default View var setting = UserModuleBase.GetSetting(UsersPortalId, "Display_Mode"); var mode = (DisplayMode)setting; switch (mode) { case DisplayMode.All: Filter = Localization.GetString("All"); break; case DisplayMode.FirstLetter: Filter = Localization.GetString("Filter.Text", LocalResourceFile).Substring(0, 1); break; case DisplayMode.None: Filter = "None"; break; } } foreach (GridColumn column in grdUsers.Columns) { bool isVisible; var header = column.HeaderText; if (String.IsNullOrEmpty(header) || header.ToLower() == "username") { isVisible = true; } else { var settingKey = "Column_" + header; var setting = UserModuleBase.GetSetting(UsersPortalId, settingKey); isVisible = Convert.ToBoolean(setting); } if (ReferenceEquals(column.GetType(), typeof(DnnGridImageCommandColumn))) { isVisible = ModulePermissionController.HasModulePermission(ModuleConfiguration.ModulePermissions, "EDIT"); var imageColumn = (DnnGridImageCommandColumn)column; //Manage Edit Column NavigateURLFormatString if (imageColumn.CommandName == "Edit") { //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder var formatString = EditUrl("UserId", "KEYFIELD", "Edit", UserFilter(false)); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Manage Roles Column NavigateURLFormatString if (imageColumn.CommandName == "UserRoles") { if (IsHostMenu) { isVisible = false; } else { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder var formatString = EditUrl("UserId", "KEYFIELD", "User Roles", UserFilter(false)); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } } //Localize Image Column Text if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile); } } column.Visible = isVisible; } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Init runs when the control is initialised /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected override void OnInit(EventArgs e) { base.OnInit(e); if (Request.QueryString["CurrentPage"] != null) { CurrentPage = Convert.ToInt32(Request.QueryString["CurrentPage"]); } else if (Request.QueryString["Page"] != null) { CurrentPage = Convert.ToInt32(Request.QueryString["Page"]); } if (Request.QueryString["filter"] != null) { Filter = Request.QueryString["filter"]; } if (Request.QueryString["filterproperty"] != null) { FilterProperty = Request.QueryString["filterproperty"]; } if (String.IsNullOrEmpty(Filter)) { //Get Default View var setting = UserModuleBase.GetSetting(UsersPortalId, "Display_Mode"); var mode = (DisplayMode)setting; switch (mode) { case DisplayMode.All: Filter = Localization.GetString("All"); break; case DisplayMode.FirstLetter: Filter = Localization.GetString("Filter.Text", LocalResourceFile).Substring(0, 1); break; case DisplayMode.None: Filter = "None"; break; } } foreach (DataGridColumn column in grdUsers.Columns) { bool isVisible; var header = column.HeaderText; if (String.IsNullOrEmpty(header) || header.ToLower() == "username") { isVisible = true; } else { var settingKey = "Column_" + header; var setting = UserModuleBase.GetSetting(UsersPortalId, settingKey); isVisible = Convert.ToBoolean(setting); } if (ReferenceEquals(column.GetType(), typeof(ImageCommandColumn))) { isVisible = IsEditable; //Manage Delete Confirm JS var imageColumn = (ImageCommandColumn)column; switch (imageColumn.CommandName) { case "Delete": imageColumn.OnClickJS = Localization.GetString("DeleteItem"); break; case "Remove": imageColumn.OnClickJS = Localization.GetString("RemoveItem"); break; } //Manage Edit Column NavigateURLFormatString if (imageColumn.CommandName == "Edit") { //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder var formatString = EditUrl("UserId", "KEYFIELD", "Edit", UserFilter(false)); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Manage Roles Column NavigateURLFormatString if (imageColumn.CommandName == "UserRoles") { if (IsHostMenu) { isVisible = false; } else { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder var formatString = EditUrl("UserId", "KEYFIELD", "User Roles", UserFilter(false)); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } } //Localize Image Column Text if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile); } } column.Visible = isVisible; } }
/// <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 { //Add an Action Event Handler to the Skin AddActionHandler(new ActionEventHandler(ModuleAction_Click)); if (Request.QueryString["CurrentPage"] != null) { CurrentPage = Convert.ToInt32(Request.QueryString["CurrentPage"]); } if (Request.QueryString["filter"] != null) { Filter = Request.QueryString["filter"]; } if (Filter == "") { //Get Default View object setting = UserModuleBase.GetSetting(UsersPortalId, "Display_Mode"); DisplayMode mode = (DisplayMode)Enum.Parse(typeof(DisplayMode), (string)setting); switch (mode) { case DisplayMode.All: Filter = Localization.GetString("All"); break; case DisplayMode.FirstLetter: Filter = Localization.GetString("Filter.Text", this.LocalResourceFile).Substring(0, 1); break; case DisplayMode.None: Filter = "None"; break; } } if (!Page.IsPostBack) { //Load the Search Combo ddlSearchType.Items.Add(AddSearchItem("Username")); ddlSearchType.Items.Add(AddSearchItem("Email")); ProfilePropertyDefinitionCollection profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalId); foreach (ProfilePropertyDefinition definition in profileProperties) { ddlSearchType.Items.Add(AddSearchItem(definition.PropertyName)); } //Localize the Headers Localization.LocalizeDataGrid(ref grdUsers, this.LocalResourceFile); BindData(Filter, ddlSearchType.SelectedItem.Value); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Page_Init runs when the control is initialised /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Init(Object sender, EventArgs e) { foreach (DataGridColumn column in grdUsers.Columns) { bool isVisible; string header = column.HeaderText; if (header == "" || header.ToLower() == "username") { isVisible = true; } else { string settingKey = "Column_" + header; object setting = UserModuleBase.GetSetting(UsersPortalId, settingKey); isVisible = Convert.ToBoolean(setting); } if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; if (imageColumn.CommandName == "Delete") { imageColumn.OnClickJS = Localization.GetString("DeleteItem"); } //Manage Edit Column NavigateURLFormatString if (imageColumn.CommandName == "Edit") { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = EditUrl("UserId", "KEYFIELD", "Edit"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Manage Roles Column NavigateURLFormatString if (imageColumn.CommandName == "UserRoles") { if (IsHostMenu) { isVisible = false; } else { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = Globals.NavigateURL(TabId, "User Roles", "UserId=KEYFIELD"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } } //Localize Image Column Text if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, this.LocalResourceFile); } } column.Visible = isVisible; } }