/// <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); }
private void SetInitialPageSize() { if (Request.QueryString["pagesize"] != null) { int pageSize; if (Int32.TryParse(Request.QueryString["pagesize"], out pageSize)) { grdUsers.PageSize = pageSize; } } else { var pageSizeSetting = GetPageSizeSetting(PortalSettings.PortalId, UserInfo.UserID); if (pageSizeSetting != Null.NullInteger) { grdUsers.PageSize = pageSizeSetting; } else { var setting = UserModuleBase.GetSetting(PortalSettings.PortalId, "Records_PerPage"); grdUsers.PageSize = Convert.ToInt32(setting); } } }
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; } }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 03/02/2006 Created /// </history> protected void Page_Load(Object sender, EventArgs e) { //Bind User Controller to PropertySettings MembershipProviderConfig config = new MembershipProviderConfig(); if (MembershipProviderConfig.CanEditProviderProperties) { ProviderSettings.EditMode = PropertyEditorMode.Edit; } else { ProviderSettings.EditMode = PropertyEditorMode.View; } ProviderSettings.LocalResourceFile = this.LocalResourceFile; ProviderSettings.DataSource = config; ProviderSettings.DataBind(); if (UserInfo.IsSuperUser) { PasswordSettings.EditMode = PropertyEditorMode.Edit; } else { PasswordSettings.EditMode = PropertyEditorMode.View; } PasswordSettings.LocalResourceFile = this.LocalResourceFile; PasswordSettings.DataSource = new PasswordConfig(); PasswordSettings.DataBind(); //Create a hashtable for the custom editors being used, using the same keys //as in the settings hashtable Hashtable editors = new Hashtable(); editors["Redirect_AfterLogin"] = EditorInfo.GetEditor("Page"); editors["Redirect_AfterLogout"] = EditorInfo.GetEditor("Page"); editors["Redirect_AfterRegistration"] = EditorInfo.GetEditor("Page"); //Create a Hashtable for the custom Visibility options Hashtable visibility = new Hashtable(); if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId) { visibility["Profile_DefaultVisibility"] = false; visibility["Profile_DisplayVisibility"] = false; visibility["Profile_ManageServices"] = false; visibility["Redirect_AfterLogin"] = false; visibility["Redirect_AfterRegistration"] = false; visibility["Redirect_AfterLogout"] = false; visibility["Security_CaptchaLogin"] = false; visibility["Security_CaptchaRegister"] = false; visibility["Security_RequireValidProfile"] = false; visibility["Security_RequireValidProfileAtLogin"] = false; visibility["Security_UsersControl"] = false; } UserSettingsControl.LocalResourceFile = this.LocalResourceFile; Hashtable ht = this.Settings; UserSettingsControl.DataSource = UserModuleBase.GetSettings(ht); UserSettingsControl.CustomEditors = editors; UserSettingsControl.Visibility = visibility; UserSettingsControl.DataBind(); }
/// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 03/02/2006 /// </history> protected void cmdUpdate_Click(object sender, EventArgs e) { UserModuleBase.UpdateSettings(this.PortalId, ((Hashtable)UserSettingsControl.DataSource)); Response.Redirect(Globals.NavigateURL(TabId, "", ((Request.QueryString["filter"] != "") ? ("filter=" + Request.QueryString["filter"]) : "").ToString()), true); }