public HttpResponseMessage DeletePage(DTO.PageDetails page) { var apiResponse = new DTO.ApiResponse <DTO.SavePageResponse>(); apiResponse.CustomObject = new DTO.SavePageResponse(); try { var tabController = new DotNetNuke.Entities.Tabs.TabController(); var tab = tabController.GetTab(page.Id, PortalSettings.PortalId); if (DotNetNuke.Security.Permissions.TabPermissionController.CanDeletePage(tab) && !DotNetNuke.Entities.Tabs.TabController.IsSpecialTab(tab.TabID, PortalSettings)) { if (tab.TabID == PortalSettings.ActiveTab.TabID) { apiResponse.CustomObject.Redirect = true; apiResponse.CustomObject.Url = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.HomeTabId); } apiResponse.Success = tabController.SoftDeleteTab(tab.TabID, PortalSettings);; } } catch (Exception err) { apiResponse.Success = false; apiResponse.Message = err.Message; Exceptions.LogException(err); } return(Request.CreateResponse(HttpStatusCode.OK, apiResponse)); }
private void ConfigurarModulo() { tableBody.ClientIDMode = System.Web.UI.ClientIDMode.Static; DotNetNuke.Entities.Tabs.TabController TC = new DotNetNuke.Entities.Tabs.TabController(); DotNetNuke.Entities.Tabs.TabInfo TI = TC.GetTab(TabId, PortalId); MyURL = TI.FullUrl; for (int a = 0; a < TI.Modules.Count; a++) { DotNetNuke.Entities.Modules.ModuleInfo MyModule = TI.Modules[a] as ModuleInfo; if (MyModule.ModuleTitle == "Factura2") { modulofacturacion = true; } } }
internal static DotNetNuke.Entities.Tabs.TabInfo GetParentTab(DotNetNuke.Entities.Tabs.TabInfo relativeToTab, DTO.PagePositionMode location) { if (relativeToTab == null) { return(null); } var tabCtrl = new DotNetNuke.Entities.Tabs.TabController(); DotNetNuke.Entities.Tabs.TabInfo parentTab = null; if (location == DTO.PagePositionMode.ChildOf) { parentTab = relativeToTab; } else if ((relativeToTab != null) && relativeToTab.ParentId != Null.NullInteger) { parentTab = tabCtrl.GetTab(relativeToTab.ParentId, relativeToTab.PortalID, false); } return(parentTab); }
public HttpResponseMessage LoadPageDetails(int id) { var apiResponse = new DTO.ApiResponse <DTO.PageDetails>(); try { var tc = new DotNetNuke.Entities.Tabs.TabController(); apiResponse.CustomObject = new DTO.PageDetails(tc.GetTab(id, PortalSettings.PortalId)); apiResponse.CustomObject.LoadAllPages(); apiResponse.CustomObject.LoadThemesAndContainers(); apiResponse.Success = true; } catch (Exception err) { apiResponse.Success = false; apiResponse.Message = err.Message; Exceptions.LogException(err); } return(Request.CreateResponse(HttpStatusCode.OK, apiResponse)); }
void ConfigurarModulo() { DotNetNuke.Entities.Tabs.TabController TC = new DotNetNuke.Entities.Tabs.TabController(); DotNetNuke.Entities.Tabs.TabInfo TI = TC.GetTab(TabId, PortalId); MyURL = TI.FullUrl; Log.ADD("Configuracion Modulo", this); hf_URL.Value = MyURL; if (cmb_Vendedor.Items.Count == 0) { System.Web.UI.WebControls.ListItem LI = new System.Web.UI.WebControls.ListItem("Ninguno", "0"); cmb_Vendedor.Items.Add(LI); List <Struct_Vendedores> LV = Data2.Class.Struct_Vendedores.GetAllVendedores(UserId); if (LV != null) { foreach (Struct_Vendedores V in LV) { System.Web.UI.WebControls.ListItem _LI = new System.Web.UI.WebControls.ListItem(V.NombreVendedor, V.Id.ToString()); cmb_Vendedor.Items.Add(_LI); } } } }
public HttpResponseMessage SavePage(DTO.PageDetails page) { var apiResponse = new DTO.ApiResponse <DTO.SavePageResponse>(); apiResponse.CustomObject = new DTO.SavePageResponse(); try { //Validation: //Tab name is required //Tab name is invalid string invalidType; if (!DotNetNuke.Entities.Tabs.TabController.IsValidTabName(page.Name, out invalidType)) { switch (invalidType) { case "EmptyTabName": apiResponse.Message = "Page name is required."; break; case "InvalidTabName": apiResponse.Message = "Page name is invalid."; break; } return(Request.CreateResponse(HttpStatusCode.OK, apiResponse)); } var tc = new DotNetNuke.Entities.Tabs.TabController(); var dnnTab = page.Id == -1 ? new DotNetNuke.Entities.Tabs.TabInfo() : tc.GetTab(page.Id, PortalSettings.PortalId); if (dnnTab != null) { dnnTab.TabName = page.Name.Trim(); if (!string.IsNullOrWhiteSpace(page.Title)) { dnnTab.Title = page.Title.Trim(); } if (!string.IsNullOrWhiteSpace(page.Description)) { dnnTab.Description = page.Description.Trim(); } dnnTab.IsVisible = page.Visible; dnnTab.DisableLink = page.Disabled; dnnTab.IsSecure = page.Secure; if (!string.IsNullOrWhiteSpace(page.Theme)) { dnnTab.SkinSrc = page.Theme != "-1" ? page.Theme : string.Empty; } if (!string.IsNullOrWhiteSpace(page.Container)) { dnnTab.ContainerSrc = page.Container != "-1" ? page.Container : string.Empty; } if (page.Id == -1) { var positionTabID = int.Parse(page.Position); var positionModeInt = int.Parse(page.PositionMode); var parentTab = tc.GetTab(positionTabID, PortalSettings.PortalId); if (page.PositionMode == ((int)DTO.PagePositionMode.ChildOf).ToString()) { if (parentTab != null) { dnnTab.PortalID = parentTab.PortalID; dnnTab.ParentId = parentTab.TabID; dnnTab.Level = parentTab.Level + 1; } page.Id = tc.AddTab(dnnTab); } else { dnnTab.PortalID = PortalSettings.PortalId; switch (positionModeInt) { case (int)DTO.PagePositionMode.After: dnnTab.PortalID = parentTab.PortalID; dnnTab.ParentId = parentTab.ParentId; dnnTab.Level = parentTab.Level; page.Id = tc.AddTabAfter(dnnTab, int.Parse(page.Position)); break; case (int)DTO.PagePositionMode.Before: dnnTab.PortalID = parentTab.PortalID; dnnTab.ParentId = parentTab.ParentId; dnnTab.Level = parentTab.Level; page.Id = tc.AddTabBefore(dnnTab, int.Parse(page.Position)); break; default: page.Id = tc.AddTab(dnnTab); break; } } apiResponse.CustomObject.Redirect = true; apiResponse.CustomObject.Url = DotNetNuke.Common.Globals.NavigateURL(page.Id); } else { if (page.PositionMode == ((int)DTO.PagePositionMode.ChildOf).ToString()) { var positionTabID = int.Parse(page.Position); if (positionTabID == -1) { dnnTab.PortalID = PortalSettings.PortalId; dnnTab.ParentId = -1; dnnTab.Level = 0; } else { var parentTab = tc.GetTab(positionTabID, PortalSettings.PortalId); if (parentTab != null) { dnnTab.PortalID = parentTab.PortalID; dnnTab.ParentId = parentTab.TabID; dnnTab.Level = parentTab.Level + 1; } } apiResponse.CustomObject.Redirect = true; apiResponse.CustomObject.Url = DotNetNuke.Common.Globals.NavigateURL(page.Id); } if (!string.IsNullOrWhiteSpace(page.Position) && !string.IsNullOrWhiteSpace(page.PositionMode)) { var positionTabID = int.Parse(page.Position); var positionModeInt = int.Parse(page.PositionMode); var parentTab = tc.GetTab(positionTabID, PortalSettings.PortalId); if (parentTab != null) { switch (positionModeInt) { case (int)DTO.PagePositionMode.After: dnnTab.PortalID = parentTab.PortalID; dnnTab.ParentId = parentTab.ParentId; dnnTab.Level = parentTab.Level; tc.UpdateTab(dnnTab); tc.MoveTabAfter(dnnTab, parentTab.TabID); apiResponse.CustomObject.Redirect = true; apiResponse.CustomObject.Url = DotNetNuke.Common.Globals.NavigateURL(page.Id); break; case (int)DTO.PagePositionMode.Before: dnnTab.PortalID = parentTab.PortalID; dnnTab.ParentId = parentTab.ParentId; dnnTab.Level = parentTab.Level; tc.UpdateTab(dnnTab); tc.MoveTabBefore(dnnTab, parentTab.TabID); apiResponse.CustomObject.Redirect = true; apiResponse.CustomObject.Url = DotNetNuke.Common.Globals.NavigateURL(page.Id); break; case (int)DTO.PagePositionMode.ChildOf: tc.UpdateTab(dnnTab); break; } } else { tc.UpdateTab(dnnTab); } } else { tc.UpdateTab(dnnTab); } } apiResponse.Success = true; } } catch (Exception err) { apiResponse.Success = false; apiResponse.Message = err.Message; Exceptions.LogException(err); } return(Request.CreateResponse(HttpStatusCode.OK, apiResponse)); }