//******************************************************* // // The BindData helper method is used to bind the list of // security roles for this portal to an asp:datalist server control // //******************************************************* private void BindData() { // Bind the Email and Password UsersDB users = new UsersDB(); SqlDataReader dr = users.GetSingleUser(userName); // Read first row from database dr.Read(); Email.Text = (String)dr["Email"]; dr.Close(); // add the user name to the title if (userName != "") { title.InnerText = "Manage User: "******"PortalSettings"]; // Get the portal's roles from the database RolesDB roles = new RolesDB(); // bind all portal roles to dropdownlist allRoles.DataSource = roles.GetPortalRoles(portalSettings.PortalId); allRoles.DataBind(); }
//******************************************************* // // The BindData helper method is used to bind the list of // security roles for this portal to an asp:datalist server control // //******************************************************* private void BindData() { // Obtain PortalSettings from Current Context PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"]; // Get the portal's roles from the database RolesDB roles = new RolesDB(); rolesList.DataSource = roles.GetPortalRoles(portalSettings.PortalId); rolesList.DataBind(); }
//******************************************************* // // The BindData helper method is used to populate a asp:datalist // server control with the current "edit access" permissions // set within the portal configuration system // //******************************************************* private void BindData() { // Obtain PortalSettings from Current Context PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; object value = GetModule(); if (value != null) { ModuleSettings m = (ModuleSettings)value; // Update Textbox Settings moduleTitle.Text = m.ModuleTitle; cacheTime.Text = m.CacheTime.ToString(); showMobile.Checked = m.ShowMobile; // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this module RolesDB rolesObj = new RolesDB(); SqlDataReader roles = rolesObj.GetPortalRoles(portalSettings.PortalId); // Clear existing items in checkboxlist authEditRoles.Items.Clear(); ListItem allItem = new ListItem(); allItem.Text = "All Users"; if (m.AuthorizedEditRoles.LastIndexOf("All Users") > -1) { allItem.Selected = true; } authEditRoles.Items.Add(allItem); while (roles.Read()) { ListItem item = new ListItem(); item.Text = (String)roles["RoleName"]; item.Value = roles["RoleID"].ToString(); if ((m.AuthorizedEditRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authEditRoles.Items.Add(item); } } }
//******************************************************* // // The BindData helper method is used to update the tab's // layout panes with the current configuration information // //******************************************************* private void BindData() { // Obtain PortalSettings from Current Context PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"]; TabSettings tab = portalSettings.ActiveTab; // Populate Tab Names, etc. tabName.Text = tab.TabName; mobileTabName.Text = tab.MobileTabName; showMobile.Checked = tab.ShowMobile; // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this tab RolesDB rolesObj = new RolesDB(); SqlDataReader roles = rolesObj.GetPortalRoles(portalSettings.PortalId); // Clear existing items in checkboxlist authRoles.Items.Clear(); ListItem allItem = new ListItem(); allItem.Text = "All Users"; if (tab.AuthorizedRoles.LastIndexOf("All Users") > -1) { allItem.Selected = true; } authRoles.Items.Add(allItem); while (roles.Read()) { ListItem item = new ListItem(); item.Text = (String)roles["RoleName"]; item.Value = roles["RoleID"].ToString(); if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authRoles.Items.Add(item); } // Populate the "Add Module" Data Configuration config = new Configuration(); moduleType.DataSource = config.GetModuleDefinitions(portalSettings.PortalId); moduleType.DataBind(); // Populate Right Hand Module Data rightList = GetModules("RightPane"); rightPane.DataBind(); // Populate Content Pane Module Data contentList = GetModules("ContentPane"); contentPane.DataBind(); // Populate Left Hand Pane Module Data leftList = GetModules("LeftPane"); leftPane.DataBind(); }
//******************************************************* // // The ApplyChanges_Click server event handler on this page is used // to save the module settings into the portal configuration system // //******************************************************* private void ApplyChanges_Click(Object Sender, EventArgs e) { // Obtain PortalSettings from Current Context PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; object value = GetModule(); if (value != null) { ModuleSettings m = (ModuleSettings)value; // Construct Authorized User Roles String String editRoles = ""; foreach (ListItem item in authEditRoles.Items) { if (item.Selected == true) { editRoles = editRoles + item.Text + ";"; } } // update module Configuration config = new Configuration(); config.UpdateModule(moduleId, m.ModuleOrder, m.PaneName, moduleTitle.Text, Int32.Parse(cacheTime.Text), editRoles, showMobile.Checked); // Update Textbox Settings moduleTitle.Text = m.ModuleTitle; cacheTime.Text = m.CacheTime.ToString(); // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this module RolesDB rolesObj = new RolesDB(); SqlDataReader roles = rolesObj.GetPortalRoles(portalSettings.PortalId); // Clear existing items in checkboxlist authEditRoles.Items.Clear(); ListItem allItem = new ListItem(); allItem.Text = "All Users"; if (m.AuthorizedEditRoles.LastIndexOf("All Users") > -1) { allItem.Selected = true; } authEditRoles.Items.Add(allItem); while (roles.Read()) { ListItem item = new ListItem(); item.Text = (String)roles["RoleName"]; item.Value = roles["RoleID"].ToString(); if ((m.AuthorizedEditRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authEditRoles.Items.Add(item); } } // Navigate back to admin page Response.Redirect("TabLayout.aspx?tabid=" + tabId); }