/*[Ajax.AjaxMethod]*/ /* * public System.Collections.Specialized.StringCollection ModuleChangeStrings(string moduleType, string moduleName) * { * SetDatata(moduleType); * moduleTitle.Text = moduleName; * * System.Collections.Specialized.StringCollection s = new System.Collections.Specialized.StringCollection(); * * s.Add(moduleTitle.Text); * * if (AddModuleHelp.Visible) * { * s.Add(AddModuleHelp.Attributes["onclick"].ToString()); * s.Add(AddModuleHelp.NavigateUrl); * s.Add(AddModuleHelp.ImageUrl); * s.Add(AddModuleHelp.ToolTip); * } * * return s; * } * */ /// <summary> /// The AddModule_Click server event handler /// on this page is used to add a new portal module /// into the tab /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddModule_Click(Object sender, EventArgs e) { // TODO: IF PAGE ID = 0 Then we know it's home page, cant we get from db the id? //PagesDB _d = new PagesDB(); int pid = PageID; if (pid == 0) { pid = PagesDB.PortalHomePageID(PortalID); } if (pid != 0) { // All new modules go to the end of the contentpane string selectedModule = moduleType.SelectedItem.Value.ToString(); int start = selectedModule.IndexOf("|"); int moduleID = Convert.ToInt32(selectedModule.Substring(0, start).Trim()); // Hide error message in case there was a previous error. moduleError.Visible = false; // This allows the user to pick what type of people can view the module being added. // If Authorised Roles is selected from the dropdown then every role that has view permission for the // Add Role module will be added to the view permissions of the module being added. string viewPermissionRoles = viewPermissions.SelectedValue.ToString(); if (viewPermissionRoles == "Authorised Roles") { viewPermissionRoles = PortalSecurity.GetViewPermissions(ModuleID); } try { ModuleItem m = new ModuleItem(); m.Title = moduleTitle.Text; m.ModuleDefID = moduleID; m.Order = 999; // save to database ModulesDB _mod = new ModulesDB(); m.ID = _mod.AddModule(pid, m.Order, paneLocation.SelectedValue.ToString(), m.Title, m.ModuleDefID, 0, PortalSecurity.GetEditPermissions(ModuleID), viewPermissionRoles, PortalSecurity.GetAddPermissions(ModuleID), PortalSecurity.GetDeletePermissions(ModuleID), PortalSecurity.GetPropertiesPermissions(ModuleID), PortalSecurity.GetMoveModulePermissions(ModuleID), PortalSecurity.GetDeleteModulePermissions(ModuleID), false, PortalSecurity.GetPublishPermissions(ModuleID), false, false, false); } catch (Exception ex) { moduleError.Visible = true; ErrorHandler.Publish(LogLevel.Error, "There was an error with the Add Module Module while trying to add a new module.", ex); } finally { if (moduleError.Visible == false) { // Reload page to pick up changes Response.Redirect(Request.RawUrl, false); } } } else { //moduleError.TextKey = "ADDMODULE_HOMEPAGEERROR"; moduleError.Text = General.GetString("ADDMODULE_HOMEPAGEERROR", "You are currently on the homepage using the default virtual ID (The default ID is set when no specific page is selected. e.g. www.yourdomain.com. Please select your homepage from the Navigation menu e.g. 'Home' so that you can add a module against the page's actual ID."); moduleError.Visible = true; } }