//******************************************************* // // 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 AdminDB admin = new AdminDB(); admin.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 IDataReader roles = admin.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); }