private void HardDeleteTab(TabInfo tab, bool deleteDescendants) { //get tab modules before deleting page var tabModules = _moduleController.GetTabModules(tab.TabID); //hard delete the tab _tabController.DeleteTab(tab.TabID, tab.PortalID, deleteDescendants); //delete modules that do not have other instances foreach (var kvp in tabModules) { //check if all modules instances have been deleted var delModule = _moduleController.GetModule(kvp.Value.ModuleID, Null.NullInteger, false); if (delModule == null || delModule.TabID == Null.NullInteger) { try { _moduleController.DeleteModule(kvp.Value.ModuleID); } catch (Exception exc) { Logger.Error(exc); } } } }
public bool IsFormEnabled(int moduleId, int tabId) { var module = _moduleController.GetModule(moduleId, tabId, true); var moduleSettings = module.ModuleSettings; return(moduleSettings[IsFormEnabledKey] != null && Boolean.Parse((string)moduleSettings[IsFormEnabledKey])); }
public void DeleteTabModule(int pageId, int moduleId) { var portalSettings = PortalController.Instance.GetCurrentPortalSettings(); var tab = _tabController.GetTab(pageId, portalSettings.PortalId); if (tab == null) { throw new PageModuleNotFoundException(); } var tabModule = _moduleController.GetModule(moduleId, pageId, false); if (tabModule == null) { throw new PageModuleNotFoundException(); } if (!TabPermissionController.CanAddContentToPage(tab)) { throw new SecurityException("You do not have permission to delete module on this page"); } _moduleController.DeleteTabModule(pageId, moduleId, true); _moduleController.ClearCache(pageId); }
private void ManageModulesToBeRestored(int tabId, TabVersionDetail[] versionDetails) { foreach (var detail in versionDetails) { var module = _moduleController.GetModule(detail.ModuleId, tabId, true); if (module.IsDeleted) { _moduleController.RestoreModule(module); } } }
private void HardDeleteTab(TabInfo tab, bool deleteDescendants, StringBuilder errors) { if (TabPermissionController.CanDeletePage(tab) && tab.IsDeleted) { if (tab.HasChildren && !deleteDescendants) { errors.Append(string.Format(LocalizeString("Service_RemoveTabWithChildError"), tab.TabName)); return; } //get tab modules before deleting page var tabModules = _moduleController.GetTabModules(tab.TabID); //hard delete the tab _tabController.DeleteTab(tab.TabID, tab.PortalID, deleteDescendants); //delete modules that do not have other instances foreach (var kvp in tabModules) { //check if all modules instances have been deleted var delModule = _moduleController.GetModule(kvp.Value.ModuleID, Null.NullInteger, false); if (delModule == null || delModule.TabID == Null.NullInteger) { try { _moduleController.DeleteModule(kvp.Value.ModuleID); } catch (Exception exc) { Logger.Error(exc); } } } } else { errors.AppendFormat(!tab.IsDeleted ? LocalizeString("TabNotSoftDeleted") : LocalizeString("CanNotDeleteTab"), tab.TabID); } }