public void ImportModule(int ModuleID, string Content, string Version, int UserId)
 {
     XmlNode xmlSettings = Globals.GetContent(Content, "ConsoleSettings");
     ModuleController moduleCtrl = new ModuleController();
     foreach (string key in _SettingKeys)
     {
         XmlNode node = xmlSettings.SelectSingleNode(key);
         bool doUpdate = true;
         string value = string.Empty;
         try
         {
             if ((node == null))
             {
                 doUpdate = false;
             }
             else
             {
                 value = node.InnerText;
                 switch (key)
                 {
                     case "ParentTabID":
                         int parentTabID = int.Parse(value);
                         TabInfo tabInfo = new TabController().GetTab(parentTabID, PortalController.GetCurrentPortalSettings().PortalId, false);
                         break;
                     case "DefaultSize":
                         doUpdate = GetSizeValues().Contains(value);
                         break;
                     case "DefaultView":
                         doUpdate = GetViewValues().Contains(value);
                         break;
                     case "AllowSizeChange":
                     case "AllowViewChange":
                     case "ShowTooltip":
                         bool.Parse(value);
                         break;
                 }
             }
         }
         catch (Exception ex)
         {
             ex.ToString();
             Exceptions.LogException(new Exception("Unable to import value [" + key + "] for Console Module moduleid [" + ModuleID.ToString() + "]"));
             doUpdate = false;
         }
         if ((doUpdate))
         {
             moduleCtrl.UpdateModuleSetting(ModuleID, key, value);
         }
     }
 }
 public string ExportModule(int moduleID)
 {
     ModuleController moduleCtrl = new ModuleController();
     StringBuilder xmlStr = new StringBuilder();
     xmlStr.Append("<ConsoleSettings>");
     Hashtable settings = moduleCtrl.GetModuleSettings(moduleID);
     if ((settings != null))
     {
         foreach (string key in _SettingKeys)
         {
             AddToXmlStr(xmlStr, settings, key);
         }
     }
     xmlStr.Append("</ConsoleSettings>");
     return xmlStr.ToString();
 }
 protected void AddExistingModule(int moduleId, int tabId, string paneName, int position, string align)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule;
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     int UserId = -1;
     if (Request.IsAuthenticated)
     {
         UserInfo objUserInfo = UserController.GetCurrentUserInfo();
         UserId = objUserInfo.UserID;
     }
     objModule = objModules.GetModule(moduleId, tabId, false);
     if (objModule != null)
     {
         ModuleInfo objClone = objModule.Clone();
         objClone.TabID = PortalSettings.ActiveTab.TabID;
         objClone.ModuleOrder = position;
         objClone.PaneName = paneName;
         objClone.Alignment = align;
         objModules.AddModule(objClone);
         objEventLog.AddLog(objClone, PortalSettings, UserId, "", Services.Log.EventLog.EventLogController.EventLogType.MODULE_CREATED);
     }
 }
        public static TabInfo MessagingPage(string ModuleFriendlyName)
        {
            if (((_MessagingPage != null)))
                return _MessagingPage;

            ModuleController mc = new ModuleController();
            ModuleInfo md = mc.GetModuleByDefinition(PortalSettings.Current.PortalId, ModuleFriendlyName);
            if ((md != null))
            {
                ArrayList a = mc.GetModuleTabs(md.ModuleID);
                if ((a != null))
                {
                    ModuleInfo mi = a[0] as ModuleInfo;
                    if ((mi != null))
                    {
                        TabController tc = new TabController();
                        _MessagingPage = tc.GetTab(mi.TabID, PortalSettings.Current.PortalId, false);
                    }
                }
            }

            return _MessagingPage;

        }
예제 #5
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddModuleToPage adds a module to a Page
        /// </summary>
        /// <remarks>
        /// </remarks>
        ///	<param name="page">The Page to add the Module to</param>
        ///	<param name="ModuleDefId">The Module Deinition Id for the module to be aded to this tab</param>
        ///	<param name="ModuleTitle">The Module's title</param>
        ///	<param name="ModuleIconFile">The Module's icon</param>
        ///	<param name="InheritPermissions">Inherit the Pages View Permisions</param>
        /// <history>
        /// [cnurse]	11/16/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int AddModuleToPage(TabInfo page, int ModuleDefId, string ModuleTitle, string ModuleIconFile, bool InheritPermissions)
        {
            ModuleController objModules = new ModuleController();
            ModuleInfo objModule = new ModuleInfo();
            bool blnDuplicate = false;
            int moduleId = Null.NullInteger;

            if ((page != null))
            {
                blnDuplicate = false;
                foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(page.TabID))
                {
                    objModule = kvp.Value;
                    if (objModule.ModuleDefID == ModuleDefId)
                    {
                        blnDuplicate = true;
                        moduleId = objModule.ModuleID;
                    }
                }

                if (!blnDuplicate)
                {
                    objModule = new ModuleInfo();
                    objModule.ModuleID = Null.NullInteger;
                    objModule.PortalID = page.PortalID;
                    objModule.TabID = page.TabID;
                    objModule.ModuleOrder = -1;
                    objModule.ModuleTitle = ModuleTitle;
                    objModule.PaneName = Globals.glbDefaultPane;
                    objModule.ModuleDefID = ModuleDefId;
                    objModule.CacheTime = 0;
                    objModule.IconFile = ModuleIconFile;
                    objModule.AllTabs = false;
                    objModule.Visibility = VisibilityState.None;
                    objModule.InheritViewPermissions = InheritPermissions;

                    try
                    {
                        moduleId = objModules.AddModule(objModule);
                    }
                    catch
                    {
                    }
                    // error adding module
                }
            }

            return moduleId;
        }
예제 #6
0
        private static void UpgradeToVersion_510()
        {
            //Upgrade to .NET 3.5
            TryUpgradeNETFramework();

            PortalController objPortalController = new PortalController();
            TabController objTabController = new TabController();
            ModuleController objModuleController = new ModuleController();
            int ModuleDefID = 0;
            int ModuleID = 0;

            //add Dashboard module and tab
            if (HostTabExists("Dashboard") == false)
            {
                ModuleDefID = AddModuleDefinition("Dashboard", "Provides a snapshot of your DotNetNuke Application.", "Dashboard", true, true);
                AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Dashboard/Dashboard.ascx", "icon_dashboard_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "Export", "", "DesktopModules/Admin/Dashboard/Export.ascx", "", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "DashboardControls", "", "DesktopModules/Admin/Dashboard/DashboardControls.ascx", "", SecurityAccessLevel.Host, 0);

                //Create New Host Page (or get existing one)
                TabInfo dashboardPage = AddHostPage("Dashboard", "Summary view of application and site settings.", "~/images/icon_dashboard_16px.gif", "~/images/icon_dashboard_32px.gif", true);

                //Add Module To Page
                AddModuleToPage(dashboardPage, ModuleDefID, "Dashboard", "~/images/icon_dashboard_32px.gif");
            }
            else
            {
                //Module was incorrectly assigned as "IsPremium=False"
                RemoveModuleFromPortals("Dashboard");
                //fix path for dashboarcontrols
                ModuleDefID = GetModuleDefinition("Dashboard", "Dashboard");
                RemoveModuleControl(ModuleDefID, "DashboardControls");
                AddModuleControl(ModuleDefID, "DashboardControls", "", "DesktopModules/Admin/Dashboard/DashboardControls.ascx", "", SecurityAccessLevel.Host, 0);
            }

            //Add the Extensions Module
            if (CoreModuleExists("Extensions") == false)
            {
                ModuleDefID = AddModuleDefinition("Extensions", "", "Extensions");
                AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Extensions/Extensions.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.View, 0);
                AddModuleControl(ModuleDefID, "Edit", "Edit Feature", "DesktopModules/Admin/Extensions/EditExtension.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Edit, 0);
                AddModuleControl(ModuleDefID, "PackageWriter", "Package Writer", "DesktopModules/Admin/Extensions/PackageWriter.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "EditControl", "Edit Control", "DesktopModules/Admin/Extensions/Editors/EditModuleControl.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "ImportModuleDefinition", "Import Module Definition", "DesktopModules/Admin/Extensions/Editors/ImportModuleDefinition.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "BatchInstall", "Batch Install", "DesktopModules/Admin/Extensions/BatchInstall.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "NewExtension", "New Extension Wizard", "DesktopModules/Admin/Extensions/ExtensionWizard.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "UsageDetails", "Usage Information", "DesktopModules/Admin/Extensions/UsageDetails.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0, "", true);
            }
            else
            {
                ModuleDefID = GetModuleDefinition("Extensions", "Extensions");
                RemoveModuleControl(ModuleDefID, "EditLanguage");
                RemoveModuleControl(ModuleDefID, "TimeZone");
                RemoveModuleControl(ModuleDefID, "Verify");
                RemoveModuleControl(ModuleDefID, "LanguageSettings");
                RemoveModuleControl(ModuleDefID, "EditResourceKey");
                RemoveModuleControl(ModuleDefID, "EditSkins");
                AddModuleControl(ModuleDefID, "UsageDetails", "Usage Information", "DesktopModules/Admin/Extensions/UsageDetails.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0, "", true);

                //Module was incorrectly assigned as "IsPremium=False"
                RemoveModuleFromPortals("Extensions");
            }

            //Remove Module Definitions Module from Host Page (if present)
            RemoveCoreModule("Module Definitions", "Host", "Module Definitions", false);

            //Remove old Module Definition Validator module
            DesktopModuleController.DeleteDesktopModule("Module Definition Validator");

            //Get Module Definitions
            TabInfo definitionsPage = objTabController.GetTabByName("Module Definitions", Null.NullInteger);

            //Add Module To Page if not present
            ModuleID = AddModuleToPage(definitionsPage, ModuleDefID, "Module Definitions", "~/images/icon_moduledefinitions_32px.gif");
            objModuleController.UpdateModuleSetting(ModuleID, "Extensions_Mode", "Module");

            //Add Extensions Host Page
            TabInfo extensionsPage = AddHostPage("Extensions", "Install, add, modify and delete extensions, such as modules, skins and language packs.", "~/images/icon_extensions_16px.gif", "~/images/icon_extensions_32px.gif", true);

            ModuleID = AddModuleToPage(extensionsPage, ModuleDefID, "Extensions", "~/images/icon_extensions_32px.gif");
            objModuleController.UpdateModuleSetting(ModuleID, "Extensions_Mode", "All");

            //Add Extensions Module to Admin Page for all Portals
            AddAdminPages("Extensions", "Install, add, modify and delete extensions, such as modules, skins and language packs.", "~/images/icon_extensions_16px.gif", "~/images/icon_extensions_32px.gif", true, ModuleDefID, "Extensions", "~/images/icon_extensions_32px.gif");

            //Remove Host Languages Page
            RemoveHostPage("Languages");

            //Remove Admin > Authentication Pages
            RemoveAdminPages("//Admin//Authentication");

            //Remove old Languages module
            DesktopModuleController.DeleteDesktopModule("Languages");

            //Add new Languages module
            ModuleDefID = AddModuleDefinition("Languages", "", "Languages", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0);
            AddModuleControl(ModuleDefID, "Edit", "Edit Language", "DesktopModules/Admin/Languages/EditLanguage.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0);
            AddModuleControl(ModuleDefID, "EditResourceKey", "Full Language Editor", "DesktopModules/Admin/Languages/languageeditorext.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0);
            AddModuleControl(ModuleDefID, "LanguageSettings", "Language Settings", "DesktopModules/Admin/Languages/LanguageSettings.ascx", "", SecurityAccessLevel.Edit, 0);
            AddModuleControl(ModuleDefID, "TimeZone", "TimeZone Editor", "DesktopModules/Admin/Languages/timezoneeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Host, 0);
            AddModuleControl(ModuleDefID, "Verify", "Resource File Verifier", "DesktopModules/Admin/Languages/resourceverifier.ascx", "", SecurityAccessLevel.Host, 0);
            AddModuleControl(ModuleDefID, "PackageWriter", "Language Pack Writer", "DesktopModules/Admin/Languages/LanguagePackWriter.ascx", "", SecurityAccessLevel.Host, 0);

            //Add Module to Admin Page for all Portals
            AddAdminPages("Languages", "Manage Language Resources.", "~/images/icon_language_16px.gif", "~/images/icon_language_32px.gif", true, ModuleDefID, "Language Editor", "~/images/icon_language_32px.gif");

            //Remove Host Skins Page
            RemoveHostPage("Skins");

            //Remove old Skins module
            DesktopModuleController.DeleteDesktopModule("Skins");

            //Add new Skins module
            ModuleDefID = AddModuleDefinition("Skins", "", "Skins", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Skins/editskins.ascx", "~/images/icon_skins_32px.gif", SecurityAccessLevel.View, 0);

            //Add Module to Admin Page for all Portals
            AddAdminPages("Skins", "Manage Skin Resources.", "~/images/icon_skins_16px.gif", "~/images/icon_skins_32px.gif", true, ModuleDefID, "Skin Editor", "~/images/icon_skins_32px.gif");

            //Remove old Skin Designer module
            DesktopModuleController.DeleteDesktopModule("Skin Designer");
            DesktopModuleController.DeleteDesktopModule("SkinDesigner");

            //Add new Skin Designer module
            ModuleDefID = AddModuleDefinition("Skin Designer", "Allows you to modify skin attributes.", "Skin Designer", true, true);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/SkinDesigner/Attributes.ascx", "~/images/icon_skins_32px.gif", SecurityAccessLevel.Host, 0);

            //Add new Skin Designer to every Admin Skins Tab
            AddModuleToPages("//Admin//Skins", ModuleDefID, "Skin Designer", "~/images/icon_skins_32px.gif", true);

            //Remove Admin Whats New Page
            RemoveAdminPages("//Admin//WhatsNew");

            //WhatsNew needs to be set to IsPremium and removed from all portals
            RemoveModuleFromPortals("WhatsNew");

            //Create New WhatsNew Host Page (or get existing one)
            TabInfo newPage = AddHostPage("What's New", "Provides a summary of the major features for each release.", "~/images/icon_whatsnew_16px.gif", "~/images/icon_whatsnew_32px.gif", true);

            //Add WhatsNew Module To Page
            ModuleDefID = GetModuleDefinition("WhatsNew", "WhatsNew");
            AddModuleToPage(newPage, ModuleDefID, "What's New", "~/images/icon_whatsnew_32px.gif");

            //add console module
            ModuleDefID = AddModuleDefinition("Console", "Display children pages as icon links for navigation.", "Console", "DotNetNuke.Modules.Console.Components.ConsoleController", true, false, false);
            AddModuleControl(ModuleDefID, "", "Console", "DesktopModules/Admin/Console/ViewConsole.ascx", "", SecurityAccessLevel.Anonymous, 0);
            AddModuleControl(ModuleDefID, "Settings", "Console Settings", "DesktopModules/Admin/Console/Settings.ascx", "", SecurityAccessLevel.Admin, 0);

            //add console module to host page
            ModuleID = AddModuleToPage("//Host", Null.NullInteger, ModuleDefID, "Basic Features", "", true);
            int tabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host");
            TabInfo tab = null;

            //add console settings for host page
            if ((tabID != Null.NullInteger))
            {
                tab = objTabController.GetTab(tabID, Null.NullInteger, true);
                if (((tab != null)))
                {
                    AddConsoleModuleSettings(tabID, ModuleID);
                }
            }

            //add module to all admin pages
            foreach (PortalInfo portal in objPortalController.GetPortals())
            {
                tabID = TabController.GetTabByTabPath(portal.PortalID, "//Admin");
                if ((tabID != Null.NullInteger))
                {
                    tab = objTabController.GetTab(tabID, portal.PortalID, true);
                    if (((tab != null)))
                    {
                        ModuleID = AddModuleToPage(tab, ModuleDefID, "Basic Features", "", true);
                        AddConsoleModuleSettings(tabID, ModuleID);
                    }
                }
            }

            //Add Google Analytics module
            ModuleDefID = AddModuleDefinition("Google Analytics", "Configure portal Google Analytics settings.", "GoogleAnalytics", false, false);
            AddModuleControl(ModuleDefID, "", "Google Analytics", "DesktopModules/Admin/Analytics/GoogleAnalyticsSettings.ascx", "", SecurityAccessLevel.Admin, 0);
            AddAdminPages("Google Analytics", "Configure portal Google Analytics settings.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, ModuleDefID, "Google Analytics", "~/images/icon_analytics_32px.gif");
        }
예제 #7
0
        private static void AddConsoleModuleSettings(int tabID, int moduleID)
        {
            ModuleController modCtrl = new ModuleController();

            modCtrl.UpdateModuleSetting(moduleID, "DefaultSize", "IconFileLarge");
            modCtrl.UpdateModuleSetting(moduleID, "AllowSizeChange", "False");
            modCtrl.UpdateModuleSetting(moduleID, "DefaultView", "Hide");
            modCtrl.UpdateModuleSetting(moduleID, "AllowViewChange", "False");
            modCtrl.UpdateModuleSetting(moduleID, "ShowTooltip", "True");
        }
예제 #8
0
 public static void RestoreTab(TabInfo objTab, PortalSettings PortalSettings, int UserId)
 {
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     TabController objController = new TabController();
     objTab.IsDeleted = false;
     objController.UpdateTab(objTab);
     List<TabInfo> siblingTabs = objController.GetTabsByPortal(objTab.PortalID).WithParentId(objTab.ParentId);
     int siblingCount = siblingTabs.Count;
     objTab.TabOrder = 2 * siblingTabs.Count + 1;
     objController.UpdateTabOrder(objTab, false);
     objEventLog.AddLog(objTab, PortalSettings, UserId, "", Services.Log.EventLog.EventLogController.EventLogType.TAB_RESTORED);
     ModuleController objmodules = new ModuleController();
     ArrayList arrMods = objmodules.GetAllTabsModules(objTab.PortalID, true);
     foreach (ModuleInfo objModule in arrMods)
     {
         objmodules.CopyModule(objModule.ModuleID, objModule.TabID, objTab.TabID, "", true);
     }
     objController.ClearCache(objTab.PortalID);
 }
 private static ModuleInfo DeserializeModule(XmlNode nodeModule, XmlNode nodePane, int PortalId, int TabId, int ModuleDefId)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = new ModuleInfo();
     objModule.PortalID = PortalId;
     objModule.TabID = TabId;
     objModule.ModuleOrder = -1;
     objModule.ModuleTitle = XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "title");
     objModule.PaneName = XmlUtils.GetNodeValue(nodePane.CreateNavigator(), "name");
     objModule.ModuleDefID = ModuleDefId;
     objModule.CacheTime = XmlUtils.GetNodeValueInt(nodeModule, "cachetime");
     objModule.CacheMethod = XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "cachemethod");
     objModule.Alignment = XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "alignment");
     objModule.IconFile = Globals.ImportFile(PortalId, XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "iconfile"));
     objModule.AllTabs = XmlUtils.GetNodeValueBoolean(nodeModule, "alltabs");
     switch (XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "visibility"))
     {
         case "Maximized":
             objModule.Visibility = VisibilityState.Maximized;
             break;
         case "Minimized":
             objModule.Visibility = VisibilityState.Minimized;
             break;
         case "None":
             objModule.Visibility = VisibilityState.None;
             break;
     }
     objModule.Color = XmlUtils.GetNodeValue(nodeModule, "color", "");
     objModule.Border = XmlUtils.GetNodeValue(nodeModule, "border", "");
     objModule.Header = XmlUtils.GetNodeValue(nodeModule, "header", "");
     objModule.Footer = XmlUtils.GetNodeValue(nodeModule, "footer", "");
     objModule.InheritViewPermissions = XmlUtils.GetNodeValueBoolean(nodeModule, "inheritviewpermissions", false);
     objModule.StartDate = XmlUtils.GetNodeValueDate(nodeModule, "startdate", Null.NullDate);
     objModule.EndDate = XmlUtils.GetNodeValueDate(nodeModule, "enddate", Null.NullDate);
     if (!String.IsNullOrEmpty(XmlUtils.GetNodeValue(nodeModule, "containersrc", "")))
     {
         objModule.ContainerSrc = XmlUtils.GetNodeValue(nodeModule, "containersrc", "");
     }
     objModule.DisplayTitle = XmlUtils.GetNodeValueBoolean(nodeModule, "displaytitle", true);
     objModule.DisplayPrint = XmlUtils.GetNodeValueBoolean(nodeModule, "displayprint", true);
     objModule.DisplaySyndicate = XmlUtils.GetNodeValueBoolean(nodeModule, "displaysyndicate", false);
     objModule.IsWebSlice = XmlUtils.GetNodeValueBoolean(nodeModule, "iswebslice", false);
     if (objModule.IsWebSlice)
     {
         objModule.WebSliceTitle = XmlUtils.GetNodeValue(nodeModule, "webslicetitle", objModule.ModuleTitle);
         objModule.WebSliceExpiryDate = XmlUtils.GetNodeValueDate(nodeModule, "websliceexpirydate", objModule.EndDate);
         objModule.WebSliceTTL = XmlUtils.GetNodeValueInt(nodeModule, "webslicettl", objModule.CacheTime / 60);
     }
     return objModule;
 }
 private void ClearPortalCacheInternal(int portalId, bool cascade, bool clearRuntime)
 {
     RemoveFormattedCacheKey(DataCache.PortalSettingsCacheKey, clearRuntime, portalId);
     Dictionary<string, Locale> locales = CommonLibrary.Services.Localization.Localization.GetLocales(portalId);
     if (locales.Count == 0)
     {
         //At least attempt to remove default locale
         string defaultLocale = PortalController.GetPortalDefaultLanguage(portalId);
         RemoveCacheKey(String.Format(DataCache.PortalCacheKey, portalId.ToString() + "-" + defaultLocale), clearRuntime);
     }
     else
     {
         foreach (Locale portalLocale in Localization.Localization.GetLocales(portalId).Values)
         {
             RemoveCacheKey(String.Format(DataCache.PortalCacheKey, portalId.ToString() + "-" + portalLocale.Code), clearRuntime);
         }
     }
     if (cascade)
     {
         TabController objTabs = new TabController();
         foreach (KeyValuePair<int, TabInfo> tabPair in objTabs.GetTabsByPortal(portalId))
         {
             ClearModuleCacheInternal(tabPair.Value.TabID, clearRuntime);
         }
         ModuleController moduleController = new ModuleController();
         foreach (ModuleInfo moduleInfo in moduleController.GetModules(portalId))
         {
             RemoveCacheKey("GetModuleSettings" + moduleInfo.ModuleID.ToString(), clearRuntime);
         }
     }
     ClearFolderCacheInternal(portalId, clearRuntime);
     ClearCacheKeysByPortalInternal(portalId, clearRuntime);
     ClearDesktopModuleCacheInternal(portalId, clearRuntime);
     ClearTabCacheInternal(portalId, clearRuntime);
 }
 private static void ClearPermissionCache(int moduleId)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = objModules.GetModule(moduleId, Null.NullInteger, false);
     DataCache.ClearModulePermissionsCache(objModule.TabID);
 }
 private static void GetModuleContent(XmlNode nodeModule, int ModuleId, int TabId, int PortalId)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, true);
     string strVersion = nodeModule.SelectSingleNode("content").Attributes["version"].Value;
     string strType = nodeModule.SelectSingleNode("content").Attributes["type"].Value;
     string strcontent = nodeModule.SelectSingleNode("content").InnerXml;
     strcontent = strcontent.Substring(9, strcontent.Length - 12);
     if (!String.IsNullOrEmpty(objModule.DesktopModule.BusinessControllerClass) && !String.IsNullOrEmpty(strcontent))
     {
         PortalInfo objportal;
         PortalController objportals = new PortalController();
         objportal = objportals.GetPortal(PortalId);
         if (objModule.DesktopModule.SupportedFeatures == Null.NullInteger)
         {
             CreateEventQueueMessage(objModule, strcontent, strVersion, objportal.AdministratorId);
         }
         else
         {
             strcontent = HttpContext.Current.Server.HtmlDecode(strcontent);
             if (objModule.DesktopModule.IsPortable)
             {
                 try
                 {
                     object objObject = Framework.Reflection.CreateObject(objModule.DesktopModule.BusinessControllerClass, objModule.DesktopModule.BusinessControllerClass);
                     if (objObject is IPortable)
                     {
                         ((IPortable)objObject).ImportModule(objModule.ModuleID, strcontent, strVersion, objportal.AdministratorId);
                     }
                 }
                 catch
                 {
                     CreateEventQueueMessage(objModule, strcontent, strVersion, objportal.AdministratorId);
                 }
             }
         }
     }
 }
 private static void DeserializeTabModuleSettings(XmlNodeList nodeTabModuleSettings, ModuleInfo objModule)
 {
     string sKey;
     string sValue;
     ModuleController mc = new ModuleController();
     foreach (XmlNode oTabModuleSettingNode in nodeTabModuleSettings)
     {
         sKey = XmlUtils.GetNodeValue(oTabModuleSettingNode.CreateNavigator(), "settingname");
         sValue = XmlUtils.GetNodeValue(oTabModuleSettingNode.CreateNavigator(), "settingvalue");
         objModule.TabModuleSettings[sKey] = sValue;
     }
 }
예제 #14
0
 private bool ProcessSlaveModule()
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = null;
     ModuleInfo slaveModule = null;
     int moduleId = -1;
     string key = "";
     bool bSuccess = true;
     if (Request.QueryString["mid"] != null)
     {
         Int32.TryParse(Request.QueryString["mid"], out moduleId);
     }
     if (Request.QueryString["ctl"] != null)
     {
         key = Request.QueryString["ctl"];
     }
     if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
     {
         Int32.TryParse(Request.QueryString["moduleid"], out moduleId);
     }
     if (moduleId != -1)
     {
         objModule = objModules.GetModule(moduleId, PortalSettings.ActiveTab.TabID, false);
         if (objModule != null)
         {
             slaveModule = objModule.Clone();
         }
     }
     if (slaveModule == null)
     {
         slaveModule = new ModuleInfo();
         slaveModule.ModuleID = moduleId;
         slaveModule.ModuleDefID = -1;
         slaveModule.TabID = PortalSettings.ActiveTab.TabID;
     }
     if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
     {
         slaveModule.ModuleDefID = -1;
     }
     if (Request.QueryString["dnnprintmode"] != "true")
     {
         slaveModule.ModuleTitle = "";
     }
     slaveModule.Header = "";
     slaveModule.Footer = "";
     slaveModule.StartDate = DateTime.MinValue;
     slaveModule.EndDate = DateTime.MaxValue;
     slaveModule.PaneName = Common.Globals.glbDefaultPane;
     slaveModule.Visibility = VisibilityState.None;
     slaveModule.Color = "";
     slaveModule.Border = "";
     slaveModule.DisplayTitle = true;
     slaveModule.DisplayPrint = false;
     slaveModule.DisplaySyndicate = false;
     slaveModule.ContainerSrc = PortalSettings.ActiveTab.ContainerSrc;
     if (string.IsNullOrEmpty(slaveModule.ContainerSrc))
     {
         slaveModule.ContainerSrc = PortalSettings.DefaultPortalContainer;
     }
     slaveModule.ContainerSrc = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, PortalSettings);
     slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);
     Pane pane = null;
     bool bFound = Panes.TryGetValue(Common.Globals.glbDefaultPane.ToLowerInvariant(), out pane);
     ModuleControlInfo objModuleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);
     if (objModuleControl != null)
     {
         slaveModule.ModuleControlId = objModuleControl.ModuleControlID;
         slaveModule.IconFile = objModuleControl.IconFile;
         if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, Null.NullString, slaveModule))
         {
             bSuccess = InjectModule(pane, slaveModule);
         }
         else
         {
             Response.Redirect(Common.Globals.AccessDeniedURL(MODULEACCESS_ERROR), true);
         }
     }
     return bSuccess;
 }
 private static bool FindModule(XmlNode nodeModule, int TabId, PortalTemplateModuleAction mergeTabs)
 {
     ModuleController objModules = new ModuleController();
     Dictionary<int, ModuleInfo> dicModules = objModules.GetTabModules(TabId);
     ModuleInfo objModule;
     bool moduleFound = false;
     string modTitle = XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "title");
     if (mergeTabs == PortalTemplateModuleAction.Merge)
     {
         foreach (KeyValuePair<int, ModuleInfo> kvp in dicModules)
         {
             objModule = kvp.Value;
             if (modTitle == objModule.ModuleTitle)
             {
                 moduleFound = true;
                 break;
             }
         }
     }
     return moduleFound;
 }
예제 #16
0
 public void CopyTab(int PortalId, int FromTabId, int ToTabId, bool asReference)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule;
     foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(FromTabId))
     {
         objModule = kvp.Value;
         if (!objModule.AllTabs)
         {
             if (asReference == false)
             {
                 objModule.ModuleID = Null.NullInteger;
             }
             objModule.TabID = ToTabId;
             objModules.AddModule(objModule);
         }
     }
 }
예제 #17
0
 private void AddAllTabsModules(TabInfo objTab)
 {
     ModuleController objmodules = new ModuleController();
     foreach (ModuleInfo allTabsModule in objmodules.GetAllTabsModules(objTab.PortalID, true))
     {
         bool canAdd = false;
         foreach (ModuleInfo allTabsInstance in objmodules.GetModuleTabs(allTabsModule.ModuleID))
         {
             TabInfo tab = new TabController().GetTab(allTabsInstance.TabID, objTab.PortalID, false);
             if (!tab.IsDeleted)
             {
                 canAdd = true;
                 break;
             }
         }
         if (canAdd)
         {
             objmodules.CopyModule(allTabsModule.ModuleID, allTabsModule.TabID, objTab.TabID, "", true);
         }
     }
 }
예제 #18
0
 public static XmlNode SerializeTab(XmlDocument xmlTab, Hashtable hTabs, TabInfo objTab, PortalInfo objPortal, bool includeContent)
 {
     XmlNode nodeTab;
     XmlNode urlNode;
     XmlNode newnode;
     CBO.SerializeObject(objTab, xmlTab);
     nodeTab = xmlTab.SelectSingleNode("tab");
     nodeTab.Attributes.Remove(nodeTab.Attributes["xmlns:xsd"]);
     nodeTab.Attributes.Remove(nodeTab.Attributes["xmlns:xsi"]);
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("tabid"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("moduleID"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("taborder"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("portalid"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("parentid"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("isdeleted"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("tabpath"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("haschildren"));
     nodeTab.RemoveChild(nodeTab.SelectSingleNode("skindoctype"));
     foreach (XmlNode nodePermission in nodeTab.SelectNodes("tabpermissions/permission"))
     {
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("tabpermissionid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("permissionid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("tabid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("roleid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("userid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("username"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("displayname"));
     }
     urlNode = xmlTab.SelectSingleNode("tab/url");
     switch (objTab.TabType)
     {
         case TabType.Normal:
             urlNode.Attributes.Append(XmlUtils.CreateAttribute(xmlTab, "type", "Normal"));
             break;
         case TabType.Tab:
             urlNode.Attributes.Append(XmlUtils.CreateAttribute(xmlTab, "type", "Tab"));
             TabInfo tab = new TabController().GetTab(Int32.Parse(objTab.Url), objTab.PortalID, false);
             urlNode.InnerXml = tab.TabPath;
             break;
         case TabType.File:
             urlNode.Attributes.Append(XmlUtils.CreateAttribute(xmlTab, "type", "File"));
             Services.FileSystem.FileInfo file = new Services.FileSystem.FileController().GetFileById(Int32.Parse(objTab.Url.Substring(7)), objTab.PortalID);
             urlNode.InnerXml = file.RelativePath;
             break;
         case TabType.Url:
             urlNode.Attributes.Append(XmlUtils.CreateAttribute(xmlTab, "type", "Url"));
             break;
     }
     XmlUtils.SerializeHashtable(objTab.TabSettings, xmlTab, nodeTab, "tabsetting", "settingname", "settingvalue");
     if (objPortal != null)
     {
         if (objTab.TabID == objPortal.SplashTabId)
         {
             newnode = xmlTab.CreateElement("tabtype");
             newnode.InnerXml = "splashtab";
             nodeTab.AppendChild(newnode);
         }
         else if (objTab.TabID == objPortal.HomeTabId)
         {
             newnode = xmlTab.CreateElement("tabtype");
             newnode.InnerXml = "hometab";
             nodeTab.AppendChild(newnode);
         }
         else if (objTab.TabID == objPortal.UserTabId)
         {
             newnode = xmlTab.CreateElement("tabtype");
             newnode.InnerXml = "usertab";
             nodeTab.AppendChild(newnode);
         }
         else if (objTab.TabID == objPortal.LoginTabId)
         {
             newnode = xmlTab.CreateElement("tabtype");
             newnode.InnerXml = "logintab";
             nodeTab.AppendChild(newnode);
         }
     }
     if (hTabs != null)
     {
         if (!Null.IsNull(objTab.ParentId))
         {
             newnode = xmlTab.CreateElement("parent");
             newnode.InnerXml = HttpContext.Current.Server.HtmlEncode(hTabs[objTab.ParentId].ToString());
             nodeTab.AppendChild(newnode);
             hTabs.Add(objTab.TabID, hTabs[objTab.ParentId].ToString() + "/" + objTab.TabName);
         }
         else
         {
             hTabs.Add(objTab.TabID, objTab.TabName);
         }
     }
     XmlNode nodePanes;
     XmlNode nodePane;
     XmlNode nodeName;
     XmlNode nodeModules;
     XmlNode nodeModule;
     XmlDocument xmlModule;
     ModuleInfo objmodule;
     ModuleController objmodules = new ModuleController();
     nodePanes = nodeTab.AppendChild(xmlTab.CreateElement("panes"));
     foreach (KeyValuePair<int, ModuleInfo> kvp in objmodules.GetTabModules(objTab.TabID))
     {
         objmodule = kvp.Value;
         if (!objmodule.IsDeleted)
         {
             xmlModule = new XmlDocument();
             nodeModule = ModuleController.SerializeModule(xmlModule, objmodule, includeContent);
             if (nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']") == null)
             {
                 nodePane = xmlModule.CreateElement("pane");
                 nodeName = nodePane.AppendChild(xmlModule.CreateElement("name"));
                 nodeName.InnerText = objmodule.PaneName;
                 nodePane.AppendChild(xmlModule.CreateElement("modules"));
                 nodePanes.AppendChild(xmlTab.ImportNode(nodePane, true));
             }
             nodeModules = nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']/modules");
             nodeModules.AppendChild(xmlTab.ImportNode(nodeModule, true));
         }
     }
     return nodeTab;
 }
예제 #19
0
        private static int RemoveModule(string DesktopModuleName, string TabName, int ParentId, bool TabRemove)
        {
            TabController objTabs = new TabController();
            ModuleController objModules = new ModuleController();
            TabInfo objTab = objTabs.GetTabByName(TabName, Null.NullInteger, ParentId);
            int intModuleDefId = 0;
            int intCount = 0;

            //Get the Modules on the Tab
            if (objTab != null)
            {
                foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(objTab.TabID))
                {
                    ModuleInfo objModule = kvp.Value;
                    if (objModule.DesktopModule.FriendlyName == DesktopModuleName)
                    {
                        //Delete the Module from the Modules list
                        objModules.DeleteTabModule(objModule.TabID, objModule.ModuleID, false);
                        intModuleDefId = objModule.ModuleDefID;
                    }
                    else
                    {
                        intCount += 1;
                    }
                }

                //If Tab has no modules optionally remove tab
                if (intCount == 0 & TabRemove)
                {
                    objTabs.DeleteTab(objTab.TabID, objTab.PortalID);
                }
            }

            return intModuleDefId;
        }
예제 #20
0
 private void GetPortalSettings(int tabID, PortalInfo portal)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule;
     this.PortalId = portal.PortalID;
     this.PortalName = portal.PortalName;
     this.LogoFile = portal.LogoFile;
     this.FooterText = portal.FooterText;
     this.ExpiryDate = portal.ExpiryDate;
     this.UserRegistration = portal.UserRegistration;
     this.BannerAdvertising = portal.BannerAdvertising;
     this.Currency = portal.Currency;
     this.AdministratorId = portal.AdministratorId;
     this.Email = portal.Email;
     this.HostFee = portal.HostFee;
     this.HostSpace = portal.HostSpace;
     this.PageQuota = portal.PageQuota;
     this.UserQuota = portal.UserQuota;
     this.AdministratorRoleId = portal.AdministratorRoleId;
     this.AdministratorRoleName = portal.AdministratorRoleName;
     this.RegisteredRoleId = portal.RegisteredRoleId;
     this.RegisteredRoleName = portal.RegisteredRoleName;
     this.Description = portal.Description;
     this.KeyWords = portal.KeyWords;
     this.BackgroundFile = portal.BackgroundFile;
     this.GUID = portal.GUID;
     this.SiteLogHistory = portal.SiteLogHistory;
     this.AdminTabId = portal.AdminTabId;
     this.SuperTabId = portal.SuperTabId;
     this.SplashTabId = portal.SplashTabId;
     this.HomeTabId = portal.HomeTabId;
     this.LoginTabId = portal.LoginTabId;
     this.RegisterTabId = portal.RegisterTabId;
     this.UserTabId = portal.UserTabId;
     this.DefaultLanguage = portal.DefaultLanguage;
     this.TimeZoneOffset = portal.TimeZoneOffset;
     this.HomeDirectory = portal.HomeDirectory;
     this.Pages = portal.Pages;
     this.Users = portal.Users;
     if (Null.IsNull(this.HostSpace))
     {
         this.HostSpace = 0;
     }
     if (Null.IsNull(this.DefaultLanguage))
     {
         this.DefaultLanguage = Localization.SystemLocale;
     }
     if (Null.IsNull(this.TimeZoneOffset))
     {
         this.TimeZoneOffset = Localization.SystemTimeZoneOffset;
     }
     this.HomeDirectory = Common.Globals.ApplicationPath + "/" + portal.HomeDirectory + "/";
     if (VerifyPortalTab(PortalId, tabID))
     {
         if (this.ActiveTab != null)
         {
             if (Globals.IsAdminSkin())
             {
                 this.ActiveTab.SkinSrc = this.DefaultAdminSkin;
             }
             else
             {
                 if (String.IsNullOrEmpty(this.ActiveTab.SkinSrc))
                 {
                     this.ActiveTab.SkinSrc = this.DefaultPortalSkin;
                 }
             }
             this.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(this.ActiveTab.SkinSrc, this);
             this.ActiveTab.SkinPath = SkinController.FormatSkinPath(this.ActiveTab.SkinSrc);
             if (Globals.IsAdminSkin())
             {
                 this.ActiveTab.ContainerSrc = this.DefaultAdminContainer;
             }
             else
             {
                 if (String.IsNullOrEmpty(this.ActiveTab.ContainerSrc))
                 {
                     this.ActiveTab.ContainerSrc = this.DefaultPortalContainer;
                 }
             }
             this.ActiveTab.ContainerSrc = SkinController.FormatSkinSrc(this.ActiveTab.ContainerSrc, this);
             this.ActiveTab.ContainerPath = SkinController.FormatSkinPath(this.ActiveTab.ContainerSrc);
             this.ActiveTab.Panes = new ArrayList();
             this.ActiveTab.Modules = new ArrayList();
             ArrayList crumbs = new ArrayList();
             GetBreadCrumbsRecursively(ref crumbs, this.ActiveTab.TabID);
             this.ActiveTab.BreadCrumbs = crumbs;
         }
     }
     if (this.ActiveTab != null)
     {
         Dictionary<string, int> objPaneModules = new Dictionary<string, int>();
         foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(this.ActiveTab.TabID))
         {
             ModuleInfo cloneModule = kvp.Value.Clone();
             if (Null.IsNull(cloneModule.StartDate))
             {
                 cloneModule.StartDate = System.DateTime.MinValue;
             }
             if (Null.IsNull(cloneModule.EndDate))
             {
                 cloneModule.EndDate = System.DateTime.MaxValue;
             }
             if (String.IsNullOrEmpty(cloneModule.ContainerSrc))
             {
                 cloneModule.ContainerSrc = this.ActiveTab.ContainerSrc;
             }
             cloneModule.ContainerSrc = SkinController.FormatSkinSrc(cloneModule.ContainerSrc, this);
             cloneModule.ContainerPath = SkinController.FormatSkinPath(cloneModule.ContainerSrc);
             if (objPaneModules.ContainsKey(cloneModule.PaneName) == false)
             {
                 objPaneModules.Add(cloneModule.PaneName, 0);
             }
             cloneModule.PaneModuleCount = 0;
             if (!cloneModule.IsDeleted)
             {
                 objPaneModules[cloneModule.PaneName] = objPaneModules[cloneModule.PaneName] + 1;
                 cloneModule.PaneModuleIndex = objPaneModules[cloneModule.PaneName] - 1;
             }
             this.ActiveTab.Modules.Add(cloneModule);
         }
         foreach (ModuleInfo module in this.ActiveTab.Modules)
         {
             module.PaneModuleCount = objPaneModules[module.PaneName];
         }
     }
 }
예제 #21
0
        private static void UpgradeToVersion_500()
        {
            PortalController objPortals = new PortalController();
            ArrayList arrPortals = objPortals.GetPortals();
            TabController controller = new TabController();

            //Add Edit Permissions for Admin Tabs to legacy portals
            PermissionController permissionControler = new PermissionController();
            TabPermissionController tabPermissionControler = new TabPermissionController();
            ArrayList permissions = permissionControler.GetPermissionByCodeAndKey("SYSTEM_TAB", "EDIT");
            int permissionID = Null.NullInteger;
            if (permissions.Count == 1)
            {
                PermissionInfo permission = permissions[0] as PermissionInfo;
                permissionID = permission.PermissionID;

                foreach (PortalInfo portal in arrPortals)
                {
                    TabInfo adminTab = controller.GetTab(portal.AdminTabId, portal.PortalID, true);
                    if (adminTab != null)
                    {
                        TabPermissionInfo tabPermission = new TabPermissionInfo();
                        tabPermission.TabID = adminTab.TabID;
                        tabPermission.PermissionID = permissionID;
                        tabPermission.AllowAccess = true;
                        tabPermission.RoleID = portal.AdministratorRoleId;
                        if (!TabPermissionExists(tabPermission, portal.PortalID))
                        {
                            adminTab.TabPermissions.Add(tabPermission);
                        }

                        //Save Tab Permissions to Data Base
                        TabPermissionController.SaveTabPermissions(adminTab);

                        foreach (TabInfo childTab in TabController.GetTabsByParent(portal.AdminTabId, portal.PortalID))
                        {
                            tabPermission = new TabPermissionInfo();
                            tabPermission.TabID = childTab.TabID;
                            tabPermission.PermissionID = permissionID;
                            tabPermission.AllowAccess = true;
                            tabPermission.RoleID = portal.AdministratorRoleId;
                            if (!TabPermissionExists(tabPermission, portal.PortalID))
                            {
                                childTab.TabPermissions.Add(tabPermission);
                            }
                            //Save Tab Permissions to Data Base
                            TabPermissionController.SaveTabPermissions(childTab);
                        }
                    }
                }
            }

            //Update Host/Admin modules Visibility setting
            bool superTabProcessed = Null.NullBoolean;
            ModuleController moduleController = new ModuleController();
            foreach (PortalInfo portal in arrPortals)
            {
                if (!superTabProcessed)
                {
                    //Process Host Tabs
                    foreach (TabInfo childTab in TabController.GetTabsByParent(portal.SuperTabId, Null.NullInteger))
                    {
                        foreach (ModuleInfo tabModule in moduleController.GetTabModules(childTab.TabID).Values)
                        {
                            tabModule.Visibility = VisibilityState.None;
                            moduleController.UpdateModule(tabModule);
                        }
                    }
                }

                //Process Portal Tabs
                foreach (TabInfo childTab in TabController.GetTabsByParent(portal.AdminTabId, portal.PortalID))
                {
                    foreach (ModuleInfo tabModule in moduleController.GetTabModules(childTab.TabID).Values)
                    {
                        tabModule.Visibility = VisibilityState.None;
                        moduleController.UpdateModule(tabModule);
                    }
                }
            }

            //Upgrade PortalDesktopModules to support new "model"
            permissions = permissionControler.GetPermissionByCodeAndKey("SYSTEM_DESKTOPMODULE", "DEPLOY");
            if (permissions.Count == 1)
            {
                PermissionInfo permission = permissions[0] as PermissionInfo;
                permissionID = permission.PermissionID;
                foreach (PortalInfo portal in arrPortals)
                {
                    foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values)
                    {
                        if (!desktopModule.IsPremium)
                        {
                            //Parse the permissions
                            DesktopModulePermissionCollection deployPermissions = new DesktopModulePermissionCollection();
                            DesktopModulePermissionInfo deployPermission = default(DesktopModulePermissionInfo);

                            // if Not IsAdmin add Registered Users
                            if (!desktopModule.IsAdmin)
                            {
                                deployPermission = new DesktopModulePermissionInfo();
                                deployPermission.PermissionID = permissionID;
                                deployPermission.AllowAccess = true;
                                deployPermission.RoleID = portal.RegisteredRoleId;
                                deployPermissions.Add(deployPermission);
                            }

                            // if Not a Host Module add Administrators
                            string hostModules = "Portals, SQL, HostSettings, Scheduler, SearchAdmin, Lists, SkinDesigner, Extensions";
                            if (!hostModules.Contains(desktopModule.ModuleName))
                            {
                                deployPermission = new DesktopModulePermissionInfo();
                                deployPermission.PermissionID = permissionID;
                                deployPermission.AllowAccess = true;
                                deployPermission.RoleID = portal.AdministratorRoleId;
                                deployPermissions.Add(deployPermission);
                            }

                            //Add Portal/Module to PortalDesktopModules
                            DesktopModuleController.AddDesktopModuleToPortal(portal.PortalID, desktopModule, deployPermissions, false);
                        }
                    }

                    DataCache.ClearPortalCache(portal.PortalID, true);
                }
            }

            LegacyUtil.ProcessLegacyModules();
            LegacyUtil.ProcessLegacyLanguages();
            LegacyUtil.ProcessLegacySkins();
            LegacyUtil.ProcessLegacySkinControls();
        }
        //private DataTable PopulateSelectedRights(int PermissionId)
        //{
        //    string RoleId = string.Empty;
        //    if (Request.QueryString["role_id"] != null && Request.QueryString["role_id"].ToString() != string.Empty)
        //    {
        //        RoleId = Request.QueryString["role_id"].ToString();
        //    }
        //    TabPermissionController tab_permission_obj = new TabPermissionController();
        //    DataTable dt = tab_permission_obj.GetListByRoleIdPermissionId(RoleId, PermissionId);
        //    return dt;
        //}

        private void FillDataInGrid()
        {
            string PortalId = ddlPortalList.SelectedValue;
            if (PortalId != string.Empty)
            {
                ModuleController module_obj = new ModuleController();
                dt = module_obj.GetListByPortalId(PortalId);

                if (dt.Rows.Count > 0)
                {
                    GridView1.DataSource = dt;
                    GridView1.DataBind();
                    //GridView1.HeaderRow.Attributes["style"] = "display:block";
                    //GridView1.UseAccessibleHeader = true;
                    //GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                else
                {
                    dt.Rows.Add(dt.NewRow());
                    GridView1.DataSource = dt;
                    GridView1.DataBind();

                    int TotalColumns = GridView1.Rows[0].Cells.Count;
                    GridView1.Rows[0].Cells.Clear();
                    GridView1.Rows[0].Cells.Add(new TableCell());
                    GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                    GridView1.Rows[0].Cells[0].Text = "No Record Found";
                }
            }
        }
        private int AddData()
        {          
            string Title = txtControlTitle.Text;
            int Type = int.Parse(ddlControlType.SelectedValue);
            string Key = txtControlKey.Text;
            string ControlSrc = string.Empty;
            if (ControlSrc_File.Value != string.Empty)
            {
                ControlSrc = GetVirtualPath(ControlSrc_File.Value);
            }
            //string Physical_ControlSrc=  ControlSrcFile.Value;
            //string ControlSrc = GetVirtualPath(Physical_ControlSrc.Value);
            //  Uri uriSiteRoot = new Uri(context.Request.Url.GetLeftPart(UriPartial.Authority));
            //string ControlSrc = uriSiteRoot + "/" + Physical_ControlSrc;


            /*** UPLOAD ****************************************************************************************************************************************/
            HttpPostedFile file = IconFile.PostedFile;
            string Icon_FileName = "";
            if (file.ContentLength > 0)
            {
                Icon_FileName = System.IO.Path.GetFileName(file.FileName);
                string savePath = Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"]
                    + "/module_images/" + Icon_FileName);
                file.SaveAs(savePath);
            }
            /*******************************************************************************************************************************************/
            
            ModuleController module_control_obj = new ModuleController();
            int result = module_control_obj.Insert(_idx, Title, Key, ControlSrc, Type, Icon_FileName);
            return result;
        }
 protected bool GetModulePermission(int PortalID, string FriendlyName)
 {
     bool AllowAccess = Null.NullBoolean;
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = objModules.GetModuleByDefinition(PortalID, FriendlyName);
     if (objModule != null)
     {
         AllowAccess = ModulePermissionController.CanViewModule(objModule);
     }
     return AllowAccess;
 }
 public static void DeserializeModule(XmlNode nodeModule, XmlNode nodePane, int PortalId, int TabId, PortalTemplateModuleAction mergeTabs, Hashtable hModules)
 {
     ModuleController objModules = new ModuleController();
     ModuleDefinitionInfo objModuleDefinition = GetModuleDefinition(nodeModule);
     ModuleInfo objModule;
     int intModuleId;
     int templateModuleID = XmlUtils.GetNodeValueInt(nodeModule, "moduleID");
     bool IsInstance = CheckIsInstance(templateModuleID, hModules);
     if (objModuleDefinition != null)
     {
         if (!FindModule(nodeModule, TabId, mergeTabs))
         {
             objModule = DeserializeModule(nodeModule, nodePane, PortalId, TabId, objModuleDefinition.ModuleDefID);
             XmlNodeList nodeModuleSettings = nodeModule.SelectNodes("modulesettings/modulesetting");
             DeserializeModuleSettings(nodeModuleSettings, objModule);
             XmlNodeList nodeTabModuleSettings = nodeModule.SelectNodes("tabmodulesettings/tabmodulesetting");
             DeserializeTabModuleSettings(nodeTabModuleSettings, objModule);
             if (!IsInstance)
             {
                 intModuleId = objModules.AddModule(objModule);
                 if (templateModuleID > 0)
                 {
                     hModules.Add(templateModuleID, intModuleId);
                 }
             }
             else
             {
                 objModule.ModuleID = Convert.ToInt32(hModules[templateModuleID]);
                 intModuleId = objModules.AddModule(objModule);
             }
             if (!String.IsNullOrEmpty(XmlUtils.GetNodeValue(nodeModule.CreateNavigator(), "content")) && !IsInstance)
             {
                 GetModuleContent(nodeModule, intModuleId, TabId, PortalId);
             }
             if (!IsInstance)
             {
                 XmlNodeList nodeModulePermissions = nodeModule.SelectNodes("modulepermissions/permission");
                 DeserializeModulePermissions(nodeModulePermissions, PortalId, TabId, objModule);
                 ModulePermissionController.SaveModulePermissions(objModule);
             }
         }
     }
 }
예제 #26
0
 public static void DeserializePanes(XmlNode nodePanes, int PortalId, int TabId, PortalTemplateModuleAction mergeTabs, Hashtable hModules)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule;
     Dictionary<int, ModuleInfo> dicModules = objModules.GetTabModules(TabId);
     if (mergeTabs == PortalTemplateModuleAction.Replace)
     {
         foreach (KeyValuePair<int, ModuleInfo> kvp in dicModules)
         {
             objModule = kvp.Value;
             objModules.DeleteTabModule(TabId, objModule.ModuleID, false);
         }
     }
     foreach (XmlNode nodePane in nodePanes.ChildNodes)
     {
         if (nodePane.SelectSingleNode("modules") != null)
         {
             foreach (XmlNode nodeModule in nodePane.SelectSingleNode("modules"))
             {
                 ModuleController.DeserializeModule(nodeModule, nodePane, PortalId, TabId, mergeTabs, hModules);
             }
         }
     }
 }
 public static XmlNode SerializeModule(XmlDocument xmlModule, ModuleInfo objModule, bool includeContent)
 {
     XmlSerializer xserModules = new XmlSerializer(typeof(ModuleInfo));
     XmlNode nodeModule;
     XmlNode nodeDefinition;
     XmlNode newnode;
     ModuleController objmodules = new ModuleController();
     StringWriter sw = new StringWriter();
     xserModules.Serialize(sw, objModule);
     xmlModule.LoadXml(sw.GetStringBuilder().ToString());
     nodeModule = xmlModule.SelectSingleNode("module");
     nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsd"]);
     nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsi"]);
     nodeModule.RemoveChild(nodeModule.SelectSingleNode("portalid"));
     nodeModule.RemoveChild(nodeModule.SelectSingleNode("tabid"));
     nodeModule.RemoveChild(nodeModule.SelectSingleNode("tabmoduleid"));
     nodeModule.RemoveChild(nodeModule.SelectSingleNode("moduleorder"));
     nodeModule.RemoveChild(nodeModule.SelectSingleNode("panename"));
     nodeModule.RemoveChild(nodeModule.SelectSingleNode("isdeleted"));
     foreach (XmlNode nodePermission in nodeModule.SelectNodes("modulepermissions/permission"))
     {
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("modulepermissionid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("permissionid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("moduleid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("roleid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("userid"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("username"));
         nodePermission.RemoveChild(nodePermission.SelectSingleNode("displayname"));
     }
     if (includeContent)
     {
         AddContent(nodeModule, objModule);
     }
     XmlUtils.SerializeHashtable(objModule.ModuleSettings, xmlModule, nodeModule, "modulesetting", "settingname", "settingvalue");
     XmlUtils.SerializeHashtable(objModule.TabModuleSettings, xmlModule, nodeModule, "tabmodulesetting", "settingname", "settingvalue");
     newnode = xmlModule.CreateElement("definition");
     ModuleDefinitionInfo objModuleDef = ModuleDefinitionController.GetModuleDefinitionByID(objModule.ModuleDefID);
     newnode.InnerText = DesktopModuleController.GetDesktopModule(objModuleDef.DesktopModuleID, objModule.PortalID).ModuleName;
     nodeModule.AppendChild(newnode);
     nodeDefinition = xmlModule.CreateElement("moduledefinition");
     nodeDefinition.InnerText = objModuleDef.FriendlyName;
     nodeModule.AppendChild(nodeDefinition);
     return nodeModule;
 }
 public static void SynchronizeModule(int moduleID)
 {
     ModuleController objModules = new ModuleController();
     ArrayList arrModules = objModules.GetModuleTabs(moduleID);
     TabController tabController = new TabController();
     Hashtable tabSettings;
     foreach (ModuleInfo objModule in arrModules)
     {
         tabSettings = tabController.GetTabSettings(objModule.TabID);
         if (tabSettings["CacheProvider"] != null && tabSettings["CacheProvider"].ToString().Length > 0)
         {
             OutputCachingProvider provider = OutputCachingProvider.Instance(tabSettings["CacheProvider"].ToString());
             if (provider != null)
             {
                 provider.Remove(objModule.TabID);
             }
         }
         if (HttpContext.Current != null)
         {
             ModuleCachingProvider provider = ModuleCachingProvider.Instance(objModule.GetEffectiveCacheMethod());
             if (provider != null)
             {
                 provider.Remove(objModule.TabModuleID);
             }
         }
     }
 }
예제 #29
0
 private void ModuleMoveToPanePostBack(Utilities.ClientAPIPostBackEventArgs args)
 {
     PortalSettings PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
     if (TabPermissionController.CanAdminPage())
     {
         int intModuleID = Convert.ToInt32(args.EventArguments["moduleid"]);
         string strPaneName = Convert.ToString(args.EventArguments["pane"]);
         int intOrder = Convert.ToInt32(args.EventArguments["order"]);
         ModuleController objModules = new ModuleController();
         objModules.UpdateModuleOrder(PortalSettings.ActiveTab.TabID, intModuleID, intOrder, strPaneName);
         objModules.UpdateTabModuleOrder(PortalSettings.ActiveTab.TabID);
         PaneControl.Page.Response.Redirect(PaneControl.Page.Request.RawUrl, true);
     }
 }
 protected string BuildURL(int PortalID, string FriendlyName)
 {
     string strURL = "~/" + Globals.glbDefaultPage;
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = objModules.GetModuleByDefinition(PortalID, FriendlyName);
     if (objModule != null)
     {
         if (PortalID == Null.NullInteger)
         {
             strURL = Globals.NavigateURL(objModule.TabID, true);
         }
         else
         {
             strURL = Globals.NavigateURL(objModule.TabID);
         }
     }
     return strURL;
 }