/// <summary> /// The EditBtn_Click server event handler on this page is /// used to edit an individual portal module's settings /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data. /// </param> /// <remarks> /// </remarks> protected void EditBtn_Click(object sender, ImageClickEventArgs e) { var pane = ((ImageButton)sender).CommandArgument; var _listbox = (ListBox)this.Page.FindControl(pane); if (_listbox == null) { _listbox = (ListBox)this.Page.Master.FindControl("Content").FindControl(pane); } if (_listbox.SelectedIndex != -1) { var mid = Int32.Parse(_listbox.SelectedItem.Value); // Add role control to edit module settings by Mario Endara <*****@*****.**> (2004/11/09) if (PortalSecurity.IsInRoles(PortalSecurity.GetPropertiesPermissions(mid))) { var url = HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", this.PageID, mid); // Redirect to module settings page if (Request.QueryString.GetValues("ModalChangeMaster") != null) { url += "&ModalChangeMaster=true&camefromEditPage=true"; } this.Response.Redirect(url); } else { this.msgError.Visible = true; return; } } }
protected void AddModuleToPane_Click(object sender, EventArgs e) { // All new modules go to the end of the content pane var m = new ModuleItem(); m.Title = this.moduleTitle.Text; m.ModuleDefID = Int32.Parse(this.moduleType.SelectedItem.Value); m.Order = 999; // save to database var mod = new ModulesDB(); // Change by [email protected] // Date: 6/2/2003 // Original: m.ID = _mod.AddModule(tabID, m.Order, "ContentPane", m.Title, m.ModuleDefID, 0, "Admins", "All Users", "Admins", "Admins", "Admins", false); // Changed by Mario Endara <*****@*****.**> (2004/11/09) // The new module inherits security from Pages module (current ModuleID) // so who can edit the tab properties/content can edit the module properties/content (except view that remains =) m.ID = mod.AddModule( this.PageID, m.Order, this.paneLocation.SelectedItem.Value, m.Title, m.ModuleDefID, 0, PortalSecurity.GetEditPermissions(this.ModuleID), this.viewPermissions.SelectedItem.Value, PortalSecurity.GetAddPermissions(this.ModuleID), PortalSecurity.GetDeletePermissions(this.ModuleID), PortalSecurity.GetPropertiesPermissions(this.ModuleID), PortalSecurity.GetMoveModulePermissions(this.ModuleID), PortalSecurity.GetDeleteModulePermissions(this.ModuleID), false, PortalSecurity.GetPublishPermissions(this.ModuleID), false, false, false); // End Change [email protected] // reload the portalSettings from the database this.Context.Items["PortalSettings"] = PortalSettings.GetPortalSettings(this.PageID, this.PortalSettings.PortalAlias); this.PortalSettings = (PortalSettings)this.Context.Items["PortalSettings"]; // reorder the modules in the content pane var modules = this.GetModules("ContentPane"); this.OrderModules(modules); // resave the order foreach (ModuleItem item in modules) { mod.UpdateModuleOrder(item.ID, item.Order, "ContentPane"); } // Redirect to the same page to pick up changes this.Response.Redirect(this.AppendModuleID(this.Request.RawUrl, m.ID)); }
public JsonResult EditBtn_Click(string pane, string modid, string pageId, string modal) { var mid = Int32.Parse(modid); // Add role control to edit module settings by Mario Endara <*****@*****.**> (2004/11/09) if (PortalSecurity.IsInRoles(PortalSecurity.GetPropertiesPermissions(mid))) { var url = HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", Int32.Parse(pageId), mid); // Redirect to module settings page if (Boolean.Parse(modal)) { url += "&ModalChangeMaster=true&camefromEditPage=true"; } return(Json(new { error = false, value = url })); } else { return(Json(new { error = true })); } }
/// <summary> /// The EditBtn_Click server event handler on this page is /// used to edit an individual portal module's settings /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> protected void EditBtn_Click(Object sender, ImageClickEventArgs e) { string pane = ((ImageButton)sender).CommandArgument; ListBox _listbox = (ListBox)Page.FindControl(pane); if (_listbox.SelectedIndex != -1) { int mid = Int32.Parse(_listbox.SelectedItem.Value); // Add role control to edit module settings by Mario Endara <*****@*****.**> (2004/11/09) if (PortalSecurity.IsInRoles(PortalSecurity.GetPropertiesPermissions(mid))) { // Redirect to module settings page Response.Redirect(HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, mid)); } else { msgError.Visible = true; return; } } }
/*[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"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> /// <remarks> /// </remarks> 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(); var pid = this.PageID; if (pid == 0) { pid = PagesDB.PortalHomePageId(this.PortalID); } if (pid != 0) { // All new modules go to the end of the content pane var selectedModule = this.moduleType.SelectedItem.Value; var start = selectedModule.IndexOf("|"); var moduleID = Convert.ToInt32(selectedModule.Substring(0, start).Trim()); // Hide error message in case there was a previous error. this.moduleError.Visible = false; // This allows the user to pick what type of people can view the module being added. // If Authorized 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. var viewPermissionRoles = this.viewPermissions.SelectedValue; if (viewPermissionRoles == "Authorised Roles") { viewPermissionRoles = PortalSecurity.GetViewPermissions(this.ModuleID); } try { var m = new ModuleItem { Title = this.TitleTextBox.Value, ModuleDefID = moduleID, Order = 999 }; // save to database var mod = new ModulesDB(); m.ID = mod.AddModule( pid, m.Order, this.paneLocation.SelectedValue, m.Title, m.ModuleDefID, 0, PortalSecurity.GetEditPermissions(this.ModuleID), viewPermissionRoles, PortalSecurity.GetAddPermissions(this.ModuleID), PortalSecurity.GetDeletePermissions(this.ModuleID), PortalSecurity.GetPropertiesPermissions(this.ModuleID), PortalSecurity.GetMoveModulePermissions(this.ModuleID), PortalSecurity.GetDeleteModulePermissions(this.ModuleID), false, PortalSecurity.GetPublishPermissions(this.ModuleID), false, false, false); } catch (Exception ex) { this.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 (this.moduleError.Visible == false) { // Reload page to pick up changes this.Response.Redirect(this.Request.RawUrl, false); } } } else { // moduleError.TextKey = "ADDMODULE_HOMEPAGEERROR"; this.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."); this.moduleError.Visible = true; } }
// // GET: /Module/ public JsonResult AddModule(string title, string moduleType, string paneLocation, string viewPermission, string pageId, string ModuleId) { // All new modules go to the end of the content pane var m = new ModuleItem(); m.Title = title; m.ModuleDefID = Int32.Parse(moduleType); m.Order = 999; // save to database var mod = new ModulesDB(); var modId = Int32.Parse(ModuleId); m.ID = mod.AddModule( Int32.Parse(pageId), m.Order, paneLocation, m.Title, m.ModuleDefID, 0, PortalSecurity.GetEditPermissions(modId), viewPermission, PortalSecurity.GetAddPermissions(modId), PortalSecurity.GetDeletePermissions(modId), PortalSecurity.GetPropertiesPermissions(modId), PortalSecurity.GetMoveModulePermissions(modId), PortalSecurity.GetDeleteModulePermissions(modId), false, PortalSecurity.GetPublishPermissions(modId), false, false, false); // End Change [email protected] //// reload the portalSettings from the database //this.Context.Items["PortalSettings"] = new PortalSettings(this.PageID, this.PortalSettings.PortalAlias); //this.PortalSettings = (PortalSettings)this.Context.Items["PortalSettings"]; // reorder the modules in the content pane //var modules = GetModules("ContentPane", Int32.Parse(pageId), Int32.Parse(portalId)); //this.OrderModules(modules); //// resave the order //foreach (ModuleItem item in modules) { // mod.UpdateModuleOrder(item.ID, item.Order, "ContentPane"); //} //// Redirect to the same page to pick up changes ////this.Response.Redirect(this.AppendModuleID(this.Request.RawUrl, m.ID)); var list = GetModules(paneLocation, Int32.Parse(pageId)); StringBuilder ls = new StringBuilder(); foreach (ModuleItem md in list) { ls.AppendFormat("<option value=\"{0}\">{1}</option>", md.ID, md.Title); } return(Json(new { value = ls.ToString() })); }