Пример #1
1
        // feel free to remove any interfaces that you don't wish to use
        // (requires that you also update the .dnn manifest file)

        #region Optional Interfaces

        /// <summary>
        /// Gets the modified search documents for the DNN search engine indexer.
        /// </summary>
        /// <param name="moduleInfo">The module information.</param>
        /// <param name="beginDate">The begin date.</param>
        /// <returns></returns>
        public override IList<SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate)
        {
            var searchDocuments = new List<SearchDocument>();
            var controller = new ItemController();
            var items = controller.GetItems(moduleInfo.ModuleID);

            foreach (var item in items)
            {
                if (item.LastModifiedOnDate.ToUniversalTime() <= beginDate.ToUniversalTime() ||
                    item.LastModifiedOnDate.ToUniversalTime() >= DateTime.UtcNow)
                    continue;

                var content = string.Format("{0}<br />{1}", item.ItemName, item.ItemDescription);

                var searchDocumnet = new SearchDocument
                {
                    UniqueKey = string.Format("Items:{0}:{1}", moduleInfo.ModuleID, item.ItemId),  // any unique identifier to be able to query for your individual record
                    PortalId = moduleInfo.PortalID,  // the PortalID
                    TabId = moduleInfo.TabID, // the TabID
                    AuthorUserId = item.LastModifiedByUserId, // the person who created the content
                    Title = moduleInfo.ModuleTitle,  // the title of the content, but should be the module title
                    Description = moduleInfo.DesktopModule.Description,  // the description or summary of the content
                    Body = content,  // the long form of your content
                    ModifiedTimeUtc = item.LastModifiedOnDate.ToUniversalTime(),  // a time stamp for the search results page
                    CultureCode = moduleInfo.CultureCode, // the current culture code
                    IsActive = true  // allows you to remove the item from the search index (great for soft deletes)
                };

                searchDocuments.Add(searchDocumnet);
            }

            return searchDocuments;
        }
Пример #2
0
        public ModuleSecurity(ModuleInfo moduleInfo)
        {
            var modulePermissionCollection = moduleInfo.ModulePermissions;
            _hasEditTemplatePermission = ModulePermissionController.HasModulePermission(modulePermissionCollection,
                                                                                   PermissionName.HasEditTemplatePermission);

        }
Пример #3
0
        public static void SetAppIdForModule(ModuleInfo module, int? appId)
        {
            // Reset temporary template
            ContentGroupManager.DeletePreviewTemplateId(module.ModuleID);

            // ToDo: Should throw exception if a real ContentGroup exists

            var zoneId = ZoneHelpers.GetZoneID(module.OwnerPortalID);

            if (appId == 0 || !appId.HasValue)
                DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(module.ModuleID, Settings.AppNameString, null);
            else
            {
                var appName = ((BaseCache)DataSource.GetCache(0, 0)).ZoneApps[zoneId.Value].Apps[appId.Value];
                DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(module.ModuleID, Settings.AppNameString, appName);
            }

            // Change to 1. available template if app has been set
            if (appId.HasValue)
            {
                var app = new App(zoneId.Value, appId.Value, PortalSettings.Current);
                var templates = app.TemplateManager.GetAvailableTemplatesForSelector(module.ModuleID, app.ContentGroupManager).ToList();
                if (templates.Any())
                    app.ContentGroupManager.SetModulePreviewTemplateId(module.ModuleID, templates.First().Guid /* .TemplateId */);
            }
        }
        public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List<SearchDocument> ();
            var settings = new EmployeeListSettingsRepository ().GetSettings (modInfo);

            IEnumerable<EmployeeInfo> employees = null;

            using (var modelContext = new UniversityModelContext ()) {
                employees = new EmployeeQuery (modelContext).ListByDivisionId (
                    settings.DivisionID, settings.IncludeSubdivisions, settings.SortType);
            }

            var now = DateTime.Now;
            foreach (var employee in employees) {
                if (employee.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ()) {
                    var aboutEmployee = employee.SearchDocumentText;
                    var sd = new SearchDocument ()
                    {
                        PortalId = modInfo.PortalID,
                        AuthorUserId = employee.LastModifiedByUserID,
                        Title = employee.FullName,
                        // Description = HtmlUtils.Shorten (aboutEmployee, 255, "..."),
                        Body = aboutEmployee,
                        ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime (),
                        UniqueKey = string.Format ("University_Employee_{0}", employee.EmployeeID),
                        Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
                        IsActive = employee.IsPublished (now)
                    };

                    searchDocs.Add (sd);
                }
            }
            return searchDocs;
        }
Пример #5
0
 private void ClearModuleSettings(ModuleInfo objModule)
 {
     if (objModule.ModuleDefinition.FriendlyName == "Text/HTML")
     {
         ModuleController.Instance.DeleteModuleSetting(objModule.ModuleID, "WorkFlowID");
     }
 }
		public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate)
		{
			var searchDocs = new List<SearchDocument> ();
			var settings = new EmployeeSettings (modInfo);
			var employee = Get<EmployeeInfo> (settings.EmployeeID);
		
			if (employee != null && employee.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ())
			{
				var aboutEmployee = employee.SearchDocumentText;
				var sd = new SearchDocument () {
					PortalId = modInfo.PortalID,
					AuthorUserId = employee.LastModifiedByUserID,
					Title = employee.FullName,
					// Description = HtmlUtils.Shorten (aboutEmployee, 255, "..."),
					Body = aboutEmployee,
					ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime (),
					UniqueKey = string.Format ("University_Employee_{0}", employee.EmployeeID),
                    Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
					IsActive = employee.IsPublished
				};
	
				searchDocs.Add (sd);
			}
			return searchDocs;
		}
		public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate)
		{
			var searchDocs = new List<SearchDocument> ();
			var settings = new EmployeeListSettings (modInfo);
		
			var	employees = GetObjects<EmployeeInfo> (CommandType.StoredProcedure, 
				                (settings.IncludeSubdivisions) ? // which SP to use
				"University_GetRecursiveEmployeesByDivisionID" : "University_GetEmployeesByDivisionID", 
				                settings.DivisionID, settings.SortType, false
			                );

            foreach (var employee in employees)
			{
				if (employee.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ())
				{
					var aboutEmployee = employee.SearchDocumentText;
					var sd = new SearchDocument () {
						PortalId = modInfo.PortalID,
						AuthorUserId = employee.LastModifiedByUserID,
						Title = employee.FullName,
						// Description = HtmlUtils.Shorten (aboutEmployee, 255, "..."),
						Body = aboutEmployee,
						ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime (),
						UniqueKey = string.Format ("University_Employee_{0}", employee.EmployeeID),
                        Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
						IsActive = employee.IsPublished
					};

					searchDocs.Add (sd);
				}
			}
			return searchDocs;
		}
Пример #8
0
        public void Init(Template template, App app, ModuleInfo hostingModule, IDataSource dataSource, InstancePurposes instancePurposes, SxcInstance sexy)
        {
            var templatePath = VirtualPathUtility.Combine(Internal.TemplateManager.GetTemplatePathRoot(template.Location, app) + "/", template.Path);

            // Throw Exception if Template does not exist
            if (!File.Exists(HostingEnvironment.MapPath(templatePath)))
                // todo: rendering exception
                throw new SexyContentException("The template file '" + templatePath + "' does not exist.");

            Template = template;
            TemplatePath = templatePath;
            App = app;
            ModuleInfo = hostingModule;
            DataSource = dataSource;
            InstancePurposes = instancePurposes;
            Sexy = sexy;

            // check common errors
            CheckExpectedTemplateErrors();

            // check access permissions - before initializing or running data-code in the template
            CheckTemplatePermissions(sexy.AppPortalSettings);

            // Run engine-internal init stuff
            Init();

            // call engine internal feature to optionally change what data is actually used or prepared for search...
            CustomizeData();

            // check if rendering is possible, or throw exceptions...
            CheckExpectedNoRenderConditions();

            if(PreRenderStatus == RenderStatusType.Unknown)
                PreRenderStatus = RenderStatusType.Ok;
        }
Пример #9
0
        private void AddModuleInternal(ModuleInfo module)
        {
            var eventLogController = new EventLogController();
            // add module
            if (Null.IsNull(module.ModuleID))
            {
                CreateContentItem(module);

                //Add Module
                module.ModuleID = dataProvider.AddModule(module.ContentItemId,
                                                            module.PortalID,
                                                            module.ModuleDefID,
                                                            module.AllTabs,
                                                            module.StartDate,
                                                            module.EndDate,
                                                            module.InheritViewPermissions,
                                                            module.IsDeleted,
                                                            UserController.GetCurrentUserInfo().UserID);

                //Now we have the ModuleID - update the contentItem
                var contentController = Util.GetContentController();
                contentController.UpdateContentItem(module);

                eventLogController.AddLog(module, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.MODULE_CREATED);

                // set module permissions
                ModulePermissionController.SaveModulePermissions(module);
            }

            //Save ModuleSettings
            UpdateModuleSettings(module);
        }
        public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List<SearchDocument> ();
            var settings = new DivisionSettingsRepository ().GetSettings (modInfo);

            using (var modelContext = new UniversityModelContext ()) {

                var division = modelContext.Get<DivisionInfo> (settings.DivisionID);
                if (division != null && division.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ()) {
                    var aboutDivision = division.SearchDocumentText;
                    var sd = new SearchDocument ()
                    {
                        PortalId = modInfo.PortalID,
                        AuthorUserId = division.LastModifiedByUserID,
                        Title = division.Title,
                        // Description = HtmlUtils.Shorten (aboutDivision, 255, "..."),
                        Body = aboutDivision,
                        ModifiedTimeUtc = division.LastModifiedOnDate.ToUniversalTime (),
                        UniqueKey = string.Format ("University_Division_{0}", division.DivisionID),
                        Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
                        IsActive = division.IsPublished (DateTime.Now)
                    };
	
                    searchDocs.Add (sd);
                }
			
                return searchDocs;
            }
        }
Пример #11
0
        /// <param name="moduleId"></param>
        /// <param name="tabId"></param>
        /// <param name="permissionKey">You can use the constants, but for modules there are only
        /// those two</param>
        /// <returns></returns>
        public static bool canUserAccessModule(UserInfo user, int portalId, int tabId, ModuleInfo moduleInfo, string permissionKey)
        {
            var retVal = false;
            string permissionsString = null;
            if (moduleInfo.InheritViewPermissions)
            {
                var tabPermissionController = new TabPermissionController();
                var tabPermissionCollection =
                    tabPermissionController.GetTabPermissionsCollectionByTabID(tabId, portalId);
                permissionsString = tabPermissionController.GetTabPermissions(tabPermissionCollection, permissionKey);
            }
            else
            {
                var modulePermissionController = new ModulePermissionController();
                var permissionCollection =
                    modulePermissionController.GetModulePermissionsCollectionByModuleID(moduleInfo.ModuleID, tabId);
                permissionsString = modulePermissionController.GetModulePermissions(permissionCollection, permissionKey);
            }

            char[] splitter = { ';' };
            var roles = permissionsString.Split(splitter);
            foreach (var role in roles)
            {
                if (role.Length > 0)
                {
                    if (user != null && user.IsInRole(role))
                        retVal = true;
                    else if (user == null && role.ToLower().Equals("all users"))
                        retVal = true;
                }
                
            }
            return retVal;
        }
        public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo moduleInfo, DateTime beginDate)
        {
            var searchDocs = new List<SearchDocument> ();
			
            var documents = DocumentsDataProvider.Instance.GetDocuments (moduleInfo.ModuleID, moduleInfo.PortalID);

            foreach (var document in documents ?? Enumerable.Empty<DocumentInfo> ()) {
                if (document.ModifiedDate.ToUniversalTime () > beginDate.ToUniversalTime ()) {
                    var documentText = TextUtils.FormatList (" ", document.Title, document.Description);

                    var sd = new SearchDocument () {
                        PortalId = moduleInfo.PortalID,
                        AuthorUserId = document.ModifiedByUserId,
                        Title = document.Title,
                        Description = HtmlUtils.Shorten (documentText, 255, "..."),
                        Body = documentText,
                        ModifiedTimeUtc = document.ModifiedDate.ToUniversalTime (),
                        UniqueKey = string.Format ("Documents_Document_{0}", document.ItemId),
                        IsActive = document.IsPublished,
                        Url = string.Format ("/Default.aspx?tabid={0}#{1}", moduleInfo.TabID, moduleInfo.ModuleID)

                        // FIXME: This one produce null reference exception
                        // Url = Globals.LinkClick (document.Url, moduleInfo.TabID, moduleInfo.ModuleID, document.TrackClicks, document.ForceDownload)
                    };
					
                    searchDocs.Add (sd);
                }
            }
            return searchDocs;
        }
Пример #13
0
 /// <summary>
 /// Initialize this object so it can then give information regarding the permissions of an entity.
 /// Uses a GUID as identifier because that survives export/import. 
 /// </summary>
 /// <param name="zoneId">EAV Zone</param>
 /// <param name="appId">EAV APP</param>
 /// <param name="typeGuid">Entity GUID to check permissions against</param>
 /// <param name="module">DNN Module - necessary for SecurityAccessLevel checks</param>
 public PermissionController(int zoneId, int appId, Guid typeGuid, ModuleInfo module = null)
 {
     ZoneId = zoneId;
     AppId = appId;
     TypeGuid = typeGuid;
     Module = module;
 }
        static void AddContent(XmlNode nodeModule, ModuleInfo module, int maxNumberOfRecords)
        {
            if (module.DesktopModule.BusinessControllerClass != "" && module.DesktopModule.IsPortable)
            {
                try
                {
                    var businessController = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass,
                                                                     module.DesktopModule.BusinessControllerClass);

                    var content = string.Empty;
                    if (businessController is IPortable2)
                    {
                        content =
                            Convert.ToString(((IPortable2) businessController).ExportModule(module.ModuleID,
                                                                                            module.TabID,
                                                                                            maxNumberOfRecords));
                    }
                    else if (businessController is IPortable)
                    {
                        content = Convert.ToString(((IPortable) businessController).ExportModule(module.ModuleID));
                    }

                    if (content != "")
                    {
                        // add attributes to XML document
// ReSharper disable PossibleNullReferenceException
                        XmlNode newnode = nodeModule.OwnerDocument.CreateElement("content");

                        var xmlattr = nodeModule.OwnerDocument.CreateAttribute("type");
                        xmlattr.Value = Globals.CleanName(module.DesktopModule.ModuleName);
                        newnode.Attributes.Append(xmlattr);
                        xmlattr = nodeModule.OwnerDocument.CreateAttribute("version");
                        xmlattr.Value = module.DesktopModule.Version;
                        newnode.Attributes.Append(xmlattr);

                        try
                        {
                            var doc = new XmlDocument();
                            doc.LoadXml(content);
// ReSharper disable AssignNullToNotNullAttribute
                            newnode.AppendChild(newnode.OwnerDocument.ImportNode(doc.DocumentElement, true));
// ReSharper restore AssignNullToNotNullAttribute
                        }
                            // ReSharper restore PossibleNullReferenceException
                        catch (Exception)
                        {
                            //only for invalid xhtml
                            content = HttpContext.Current.Server.HtmlEncode(content);
                            newnode.InnerXml = XmlUtils.XMLEncode(content);
                        }
                        nodeModule.AppendChild(newnode);
                    }
                }
                catch
                {
                    //ignore errors
                }
            }
        }
Пример #15
0
 private void ClearModuleSettings(ModuleInfo objModule)
 {
     var moduleController = new ModuleController();
     if (objModule.ModuleDefinition.FriendlyName == "Text/HTML")
     {
         moduleController.DeleteModuleSetting(objModule.ModuleID, "WorkFlowID");
     }
 }
 public static Settings LoadRazorSettingsControl(this UserControl parent, ModuleInfo configuration, string localResourceFile)
 {
     var control = (Settings) parent.LoadControl("~/DesktopModules/RazorModules/RazorHost/Settings.ascx");
     control.ModuleConfiguration = configuration;
     control.LocalResourceFile = localResourceFile;
     EnsureEditScriptControlIsRegistered(configuration.ModuleDefID);
     return control;
 }
Пример #17
0
        public ToDoSettings(ModuleInfo module)
        {
            ModuleId = module.ModuleID;

            var owner = module.ModuleSettings.GetValueOrDefault(OwnerTypeKey, "module");
            OwnerType = owner == "module" ? OwnerType.Module : OwnerType.User;

            SoftDeleteToDos = module.ModuleSettings.GetValueOrDefault(SoftDeleteKey, false);
        }
 public bool CanInjectModule(ModuleInfo module, PortalSettings portalSettings)
 {
     return ModulePermissionController.CanViewModule(module) 
             && module.IsDeleted == false 
             && ((module.StartDate < DateTime.Now && module.EndDate > DateTime.Now) 
                     || Globals.IsLayoutMode() 
                     || Globals.IsEditMode()
             );
 }
Пример #19
0
 public PermissionController(int zoneId, int appId, Guid typeGuid, IEntity targetItem, ModuleInfo module = null)
 {
     ZoneId = zoneId;
     AppId = appId;
     TypeGuid = typeGuid;
     if (targetItem != null)
         TargetItem = targetItem;
     Module = module;
 }
Пример #20
0
        public static string TryToGetReliableSetting(ModuleInfo module, string settingName)
        {
            if (module.ModuleSettings.ContainsKey(settingName))
                return module.ModuleSettings[settingName].ToString();

            // if not found, it could be a caching issue
            var settings = new ModuleController().GetModuleSettings(module.ModuleID);
            return settings.ContainsKey(settingName) ? settings[settingName].ToString() : null;
        }
Пример #21
0
        private static void AddArticleSearchItems(SearchItemInfoCollection items, ModuleInfo modInfo)
        {
            //get all the updated items
            //DataTable dt = Article.GetArticlesSearchIndexingUpdated(modInfo.PortalID, modInfo.ModuleDefID, modInfo.TabID);

            //TODO: we should get articles by ModuleID and only perform indexing by ModuleID
            DataTable dt = Article.GetArticles(modInfo.PortalID);
            SearchArticleIndex(dt, items, modInfo);
        }
        /// <summary>
        /// Gets a collection of <see cref="SearchItemInfo"/> instances, describing the job openings that can be viewed in the given Job Details module.
        /// </summary>
        /// <param name="modInfo">Information about the module instance for which jobs should be returned.</param>
        /// <returns>A collection of <see cref="SearchItemInfo"/> instances</returns>
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            if (modInfo == null)
            {
                throw new ArgumentNullException("modInfo", @"modInfo must not be null.");
            }

            var searchItems = new SearchItemInfoCollection();

            // only index the JobDetail module definition (since most of this information is only viewable there,
            // and because the Guid parameter on the SearchItemInfo ("jobid=" + jobid) gets put on the querystring to make it work all automagically).  BD
            if (ModuleDefinitionController.GetModuleDefinitionByFriendlyName(ModuleDefinition.JobDetail.ToString(), modInfo.DesktopModuleID).ModuleDefID == modInfo.ModuleDefID
                && ModuleSettings.JobDetailEnableDnnSearch.GetValueAsBooleanFor(DesktopModuleName, modInfo, ModuleSettings.JobDetailEnableDnnSearch.DefaultValue))
            {
                int? jobGroupId = ModuleSettings.JobGroupId.GetValueAsInt32For(DesktopModuleName, modInfo, ModuleSettings.JobGroupId.DefaultValue);

                using (IDataReader jobs = DataProvider.Instance().GetJobs(jobGroupId, modInfo.PortalID))
                {
                    while (jobs.Read())
                    {
                        if (!(bool)jobs["IsFilled"])
                        {
                            string jobId = ((int)jobs["JobId"]).ToString(CultureInfo.InvariantCulture);
                            string searchDescription = HtmlUtils.StripWhiteSpace(HtmlUtils.Clean((string)jobs["JobDescription"], false), true);
                            string searchItemTitle = string.Format(
                                CultureInfo.CurrentCulture,
                                Utility.GetString("JobInLocation", LocalResourceFile, modInfo.PortalID),
                                (string)jobs["JobTitle"],
                                (string)jobs["LocationName"],
                                (string)jobs["StateName"]);

                            string searchedContent =
                                HtmlUtils.StripWhiteSpace(
                                    HtmlUtils.Clean(
                                        (string)jobs["JobTitle"] + " " + (string)jobs["JobDescription"] + " " + (string)jobs["RequiredQualifications"] +
                                        " " + (string)jobs["DesiredQualifications"],
                                        false),
                                    true);

                            searchItems.Add(
                                new SearchItemInfo(
                                    searchItemTitle,
                                    searchDescription,
                                    (int)jobs["RevisingUser"],
                                    (DateTime)jobs["RevisionDate"],
                                    modInfo.ModuleID,
                                    jobId,
                                    searchedContent,
                                    "jobid=" + jobId));
                        }
                    }
                }
            }

            return searchItems;
        }
        public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo moduleInfo, DateTime beginDateUtc)
        {
            var searchDocs = new List<SearchDocument> ();

            // TODO: Implement GetModifiedSearchDocuments () here
            // var sd = new SearchDocument ();
            // searchDocs.Add (searchDoc);
                     
            return searchDocs;
        }
 public ModulePermissionCollection(ModuleInfo objModule)
 {
     foreach (ModulePermissionInfo permission in objModule.ModulePermissions)
     {
         if (permission.ModuleID == objModule.ModuleID)
         {
             Add(permission);
         }
     }
 }
Пример #25
0
        public ModuleContentBlock(ModuleInfo moduleInfo, IEnumerable<KeyValuePair<string, string>> overrideParams = null)
        {
            if(moduleInfo == null)
                throw new Exception("Need valid ModuleInfo / ModuleConfiguration of runtime");

            ModuleInfo = moduleInfo;
            ParentId = moduleInfo.ModuleID;
            ContentBlockId = ParentId;

            // url-params
            _urlParams = overrideParams ?? DnnWebForms.Helpers.SystemWeb.GetUrlParams();

            // Ensure we know what portal the stuff is coming from
            // PortalSettings is null, when in search mode
            PortalSettings = PortalSettings.Current == null || moduleInfo.OwnerPortalID != moduleInfo.PortalID
                ? new PortalSettings(moduleInfo.OwnerPortalID)
                : PortalSettings.Current;

            ZoneId = ZoneHelpers.GetZoneID(moduleInfo.OwnerPortalID) ?? 0; // new

            AppId = AppHelpers.GetAppIdFromModule(moduleInfo, ZoneId) ?? 0;// fallback/undefined YET

            if (AppId == Settings.DataIsMissingInDb)
            {
                _dataIsMissing = true;
                return;
            }

            if (AppId != 0)
            {
                // try to load the app - if possible
                App = new App(ZoneId, AppId, PortalSettings);
                ContentGroup = App.ContentGroupManager.GetContentGroupForModule(moduleInfo.ModuleID);

                if (ContentGroup.DataIsMissing)
                {
                    _dataIsMissing = true;
                    App = null;
                    return;
                }

                // use the content-group template, which already covers stored data + module-level stored settings
                Template = ContentGroup.Template;

                // set show-status of the template/view picker
                var showStatus = moduleInfo.ModuleSettings[Settings.SettingsShowTemplateChooser];
                bool show;
                if (bool.TryParse((showStatus ?? true).ToString(), out show))
                    ShowTemplateChooser = show;

                // maybe ensure that App.Data is ready
                App.InitData(SxcInstance.Environment.Permissions.UserMayEditContent, Data.ConfigurationProvider);
            }
        }
Пример #26
0
 public override IList<SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate)
 {
     try
     {
         return new SearchController().GetModifiedSearchDocuments(moduleInfo, beginDate);
     }
     catch (Exception e)
     {
         throw new SearchIndexException(moduleInfo, e);
     }
 }
Пример #27
0
        public static int? GetAppIdFromModule(ModuleInfo module, int zoneId)
        {
            if (module.DesktopModule.ModuleName == "2sxc")
                return GetDefaultAppId(zoneId);// : new int?();

            var appName = DnnStuffToRefactor.TryToGetReliableSetting(module, Settings.AppNameString);

            if (appName != null)
                return GetAppIdFromGuidName(zoneId, appName);

            return null;
        }
        public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List<SearchDocument> ();

            // TODO: Realize GetModifiedSearchDocuments()

            /* var sd = new SearchDocument();
            searchDocs.Add(searchDoc);
            */

            return searchDocs;
        }
        public bool TryFindModuleInfo(HttpRequestMessage request, out ModuleInfo moduleInfo)
        {
            moduleInfo = null;

            int tabId, moduleId;
            if(TryFindTabId(request, out tabId) && TryFindModuleId(request, out moduleId))
            {
                moduleInfo = ModuleController.Instance.GetModule(moduleId, tabId, false);
            }

            return moduleInfo != null;
        }
Пример #30
0
        public CustomSettings(ModuleInfo moduleInfo)
        {
            var moduleSettings = moduleInfo.ModuleSettings;

            foreach (DictionaryEntry moduleSetting in moduleSettings)
            {
                var prop = this.GetType().GetProperty(moduleSetting.Key.ToString());
                if (prop != null)
                {
                    this.GetType().GetProperty(prop.Name).SetValue(this, moduleSetting.Value);
                }
            }
        }
Пример #31
0
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            SearchItemInfoCollection itmSearchColl = new SearchItemInfoCollection();
            MediaInfo itm = GetMedia(ModInfo.ModuleID);

            if (itm != null)
            {
                string content = string.Concat(itm.Alt, " :: ", StripTags(itm.MediaMessage));

                SearchItemInfo itmSearch = new SearchItemInfo(ModInfo.ModuleTitle, content, itm.LastUpdatedBy, itm.LastUpdatedDate, ModInfo.ModuleID, itm.ModuleID.ToString(), content);
                itmSearchColl.Add(itmSearch);
            }

            return(itmSearchColl);
        }
Пример #32
0
 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;
         }
     }
 }
Пример #33
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            //SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();

            //List<SurveyBoxInfo> colSurveyBoxs = GetSurveyBoxs(ModInfo.ModuleID);

            //foreach (SurveyBoxInfo objSurveyBox in colSurveyBoxs)
            //{
            //    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objSurveyBox.Content, objSurveyBox.CreatedByUser, objSurveyBox.CreatedDate, ModInfo.ModuleID, objSurveyBox.ItemId.ToString(), objSurveyBox.Content, "ItemId=" + objSurveyBox.ItemId.ToString());
            //    SearchItemCollection.Add(SearchItem);
            //}

            //return SearchItemCollection;

            throw new System.NotImplementedException("The method or operation is not implemented.");
        }
Пример #34
0
 public override void UpdateSettings()
 {
     if (Page.IsValid)
     {
         try
         {
             _MyConfiguration.SelectBy                 = (Enums.SelectBy)Convert.ToInt32(rblSelectBy.SelectedValue);
             _MyConfiguration.MultipleHandling         = (Enums.MultipleHandling)Convert.ToInt32(rblMultipleHandling.SelectedValue);
             _MyConfiguration.HideWhenNoContent        = cbHideWhenNoContent.Checked;
             _MyConfiguration.EnableUserTimeConversion = cbEnableUserTimeConversion.Checked;
             _MyConfiguration.CategoryID               = int.Parse(ddlCategory.SelectedValue);
             _MyConfiguration.ProfilePropertyName      = ddlProfilePropertyName.SelectedValue;
             _MyConfiguration.IncludeDisabled          = cbIncludeDisabled.Checked;
             _MyConfiguration.ReplaceTitle             = cbReplaceTitle.Checked;
             _MyConfiguration.ReplaceTokens            = cbReplaceTokens.Checked;
             var i = 0;
             if (int.TryParse(tbNumericInterval.Text, out i))
             {
                 _MyConfiguration.Interval = i;
             }
             // refresh cache
             ModuleController.SynchronizeModule(ModuleId);
             _MyConfiguration.SaveSettings();
             // disable module caching if token replace is enabled
             if (cbReplaceTokens.Checked)
             {
                 var mc = new ModuleController();
                 DotNetNuke.Entities.Modules.ModuleInfo objModule = mc.GetModule(ModuleId, TabId, false);
                 if (objModule.CacheTime > 0)
                 {
                     objModule.CacheTime = 0;
                     mc.UpdateModule(objModule);
                 }
             }
         }
         catch (Exception exc) //Module failed to load
         {
             Exceptions.ProcessModuleLoadException(this, exc);
         }
     }
 }
Пример #35
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();

            List <Classes> colSchoolGradess = new List <Classes>();

            foreach (Classes e in new ClassController().GetClasses())
            {
                colSchoolGradess.Add(e);
            }

            foreach (Classes objSchoolGrades in colSchoolGradess)
            {
                SearchItemInfo SearchItem2 = new SearchItemInfo(ModInfo.ModuleTitle, objSchoolGrades.SubjectId.ToString(), objSchoolGrades.StudentId, System.DateTime.Now, ModInfo.ModuleID, objSchoolGrades.StudentId.ToString(), "SubId=" + objSchoolGrades.SubjectId.ToString());
                SearchItemCollection.Add(SearchItem2);
            }

            return(SearchItemCollection);

            //	throw new System.NotImplementedException("The method or operation is not implemented.");
        }
Пример #36
0
        protected override void Page_Init(System.Object sender, System.EventArgs e)
        {
            //调用基类Page_Init,主要用于权限验证
            base.Page_Init(sender, e);

            try
            {
                if (!IsPostBack)
                {
                    //VerificationAuthor();


                    DotNetNuke.Entities.Modules.ModuleInfo m = ModuleConfiguration;
                    litModuleTitle.Text   = ModuleProperty(m, "ModuleName");
                    litModuleVersion.Text = ModuleProperty(m, "Version");

                    String Downloadlink  = String.Empty;
                    String latestversion = String.Empty;
                    //litUpdateVersion.Text = Common.LoadUpdateVersionBy2(m.ModuleName, m.Version, out Downloadlink, out latestversion);
                    hlModuleLink.NavigateUrl = Downloadlink;
                    hlModuleLink.Attributes.Add("data-original-title", String.Format(ViewResourceText("latest_version", "Click to download the latest version:{0}"), latestversion));
                }



                //LoadManagerScript();

                //绑定Tabs和容器中的控件
                BindContainer();


                // 绑定左菜单
                BindLeftMenu();
            }
            catch (Exception exc) //Module failed to load
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #37
0
        public void UpdateModule(ModuleInfo objModule)
        {
            // update module
            DataProvider.Instance().UpdateModule(objModule.ModuleID, objModule.ModuleTitle, objModule.AllTabs, objModule.Header, objModule.Footer, objModule.StartDate, objModule.EndDate, objModule.InheritViewPermissions, objModule.IsDeleted);

            // update module permissions
            ModulePermissionController objModulePermissionController = new ModulePermissionController();
            ModulePermissionCollection objCurrentModulePermissions;

            objCurrentModulePermissions = objModulePermissionController.GetModulePermissionsCollectionByModuleID(objModule.ModuleID, objModule.TabID);
            if (!objCurrentModulePermissions.CompareTo(objModule.ModulePermissions))
            {
                objModulePermissionController.DeleteModulePermissionsByModuleID(objModule.ModuleID);
                foreach (ModulePermissionInfo objModulePermission in objModule.ModulePermissions)
                {
                    objModulePermission.ModuleID = objModule.ModuleID;
                    if (objModule.InheritViewPermissions && objModulePermission.PermissionKey == "VIEW")
                    {
                        objModulePermissionController.DeleteModulePermission(objModulePermission.ModulePermissionID);
                    }
                    else
                    {
                        if (objModulePermission.AllowAccess)
                        {
                            objModulePermissionController.AddModulePermission(objModulePermission, objModule.TabID);
                        }
                    }
                }
            }

            if (!Null.IsNull(objModule.TabID))
            {
                // update tabmodule
                DataProvider.Instance().UpdateTabModule(objModule.TabID, objModule.ModuleID, objModule.ModuleOrder, objModule.PaneName, objModule.CacheTime, objModule.Alignment, objModule.Color, objModule.Border, objModule.IconFile, (int)objModule.Visibility, objModule.ContainerSrc, objModule.DisplayTitle, objModule.DisplayPrint, objModule.DisplaySyndicate);

                // update module order in pane
                UpdateModuleOrder(objModule.TabID, objModule.ModuleID, objModule.ModuleOrder, objModule.PaneName);

                // set the default module
                if (objModule.IsDefaultModule)
                {
                    PortalSettings.UpdatePortalSetting(objModule.PortalID, "defaultmoduleid", objModule.ModuleID.ToString());
                    PortalSettings.UpdatePortalSetting(objModule.PortalID, "defaulttabid", objModule.TabID.ToString());
                }

                // apply settings to all desktop modules in portal
                if (objModule.AllModules)
                {
                    TabController objTabs = new TabController();
                    foreach (KeyValuePair <int, TabInfo> tabPair in objTabs.GetTabsByPortal(objModule.PortalID))
                    {
                        TabInfo objTab = tabPair.Value;
                        if (!objTab.IsAdminTab)
                        {
                            foreach (KeyValuePair <int, ModuleInfo> modulePair in GetTabModules(objTab.TabID))
                            {
                                ModuleInfo objTargetModule = modulePair.Value;
                                DataProvider.Instance().UpdateTabModule(objTargetModule.TabID, objTargetModule.ModuleID, objTargetModule.ModuleOrder, objTargetModule.PaneName, objModule.CacheTime, objModule.Alignment, objModule.Color, objModule.Border, objModule.IconFile, (int)objModule.Visibility, objModule.ContainerSrc, objModule.DisplayTitle, objModule.DisplayPrint, objModule.DisplaySyndicate);
                            }
                        }
                    }
                }
            }
            ClearCache(objModule.TabID);
        }
Пример #38
0
        /// -----------------------------------------------------------------------------
        ///         ''' <summary>
        ///         ''' UpdateSettings saves the modified settings to the Database
        ///         ''' </summary>
        ///         ''' <remarks>
        ///         ''' </remarks>
        ///         ''' <history>
        ///         '''		[cnurse]	10/20/2004	created
        ///         '''		[cnurse]	10/25/2004	upated to use TabModuleId rather than TabId/ModuleId
        ///         ''' </history>
        ///         ''' -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            try
            {
                Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
                // 2014 TODO: Menu
                objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayMode, optControl.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.Direction, optView.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.LinkDescriptionMode, optInfo.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.Icon, ctlIcon.Url);
                objModules.UpdateModuleSetting(ModuleId, "nowrap", optNoWrap.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.ModuleContentType, optLinkModuleType.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, SettingName.UsePermissions, optUsePermissions.SelectedValue);
                // objModules.UpdateModuleSetting(ModuleId, "usepopup", optUsePopup.SelectedValue)
                objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayAttribute, optDisplayAttribute.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayOrder, optDisplayOrder.SelectedValue);
                // 2014 TODO
                objModules.UpdateModuleSetting(ModuleId, SettingName.MenuAllUsers, optMenuAllUsers.SelectedValue);

                switch ((Enums.ModuleContentTypes) int.Parse(optLinkModuleType.SelectedValue))
                {
                case Enums.ModuleContentTypes.Menu:
                {
                    objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue);
                    break;
                }

                case Enums.ModuleContentTypes.Folder:
                {
                    objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue);
                    objModules.UpdateModuleSetting(ModuleId, Consts.FolderId, optTypeContentSelection.SelectedValue);
                    break;
                }

                case Enums.ModuleContentTypes.Friends:
                {
                    objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue);
                    break;
                }

                default:
                {
                    break;
                }
                }

                bool allowCaching = true;

                if (optControl.SelectedItem.Value == Consts.DisplayModeDropdown)
                {
                    allowCaching = false;
                }

                if (optInfo.SelectedItem.Value == "Y")
                {
                    allowCaching = false;
                }

                if (!allowCaching)
                {
                    DotNetNuke.Entities.Modules.ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, false);
                    if (objModule.CacheTime > 0)
                    {
                        objModule.CacheTime = 0;
                        objModules.UpdateModule(objModule);
                    }
                }

                ModuleController.SynchronizeModule(ModuleId);
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #39
0
        public void Initialize(int PortalId)
        {
            _PortalID                = PortalId;
            _TabID                   = -1;
            _ModuleID                = -1;
            _ModuleDefID             = -1;
            _ModuleOrder             = -1;
            _PaneName                = "";
            _ModuleTitle             = "";
            _AuthorizedEditRoles     = "";
            _CacheTime               = -1;
            _AuthorizedViewRoles     = "";
            _Alignment               = "";
            _Color                   = "";
            _Border                  = "";
            _IconFile                = "";
            _AllTabs                 = false;
            _Visibility              = VisibilityState.Maximized;
            _IsDeleted               = false;
            _Header                  = "";
            _Footer                  = "";
            _StartDate               = Null.NullDate;
            _EndDate                 = Null.NullDate;
            _DisplayTitle            = true;
            _DisplayPrint            = true;
            _DisplaySyndicate        = false;
            _InheritViewPermissions  = false;
            _ContainerSrc            = "";
            _DesktopModuleID         = -1;
            _FriendlyName            = "";
            _Description             = "";
            _Version                 = "";
            _IsPremium               = false;
            _IsAdmin                 = false;
            _SupportedFeatures       = 0;
            _BusinessControllerClass = "";
            _ModuleControlId         = -1;
            _ControlSrc              = "";
            _ControlType             = SecurityAccessLevel.Anonymous;
            _ControlTitle            = "";
            _HelpUrl                 = "";
            _ContainerPath           = "";
            _PaneModuleIndex         = 0;
            _PaneModuleCount         = 0;
            _IsDefaultModule         = false;
            _AllModules              = false;

            // get default module settings
            Hashtable settings = PortalSettings.GetSiteSettings(PortalId);

            if (Convert.ToString(settings["defaultmoduleid"]) != "" && Convert.ToString(settings["defaulttabid"]) != "")
            {
                ModuleController objModules = new ModuleController();
                ModuleInfo       objModule  = objModules.GetModule(int.Parse(Convert.ToString(settings["defaultmoduleid"])), int.Parse(Convert.ToString(settings["defaulttabid"])), true);
                if (objModule != null)
                {
                    _CacheTime        = objModule.CacheTime;
                    _Alignment        = objModule.Alignment;
                    _Color            = objModule.Color;
                    _Border           = objModule.Border;
                    _IconFile         = objModule.IconFile;
                    _Visibility       = objModule.Visibility;
                    _ContainerSrc     = objModule.ContainerSrc;
                    _DisplayTitle     = objModule.DisplayTitle;
                    _DisplayPrint     = objModule.DisplayPrint;
                    _DisplaySyndicate = objModule.DisplaySyndicate;
                }
            }
        }
Пример #40
0
 public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
 {
     return(null);
 }
Пример #41
0
 public void CopyTabModuleSettings(ModuleInfo fromModule, ModuleInfo toModule)
 {
     CopyTabModuleSettingsInternal(fromModule, toModule);
 }
Пример #42
0
 /// <summary>
 /// Return a list of Modified Search Documents based on date. The documents will be stored in Search Index.
 /// </summary>
 /// <param name="moduleInfo">Module Info</param>
 /// <param name="beginDate">Provide modified content from this time in Utc</param>
 /// <returns>Collection of SearchDocument</returns>
 /// <remarks>Module must return New, Updated and Deleted Search Documents.
 /// It is important to include all the relevant Properties for Updated content (sames as supplied for New document), as partial SearchDocument cannot be Updated in Search Index.
 /// This is different from standard SQL Update where selective columns can updated. In this case, entire Document must be supplied during Update or else information will be lost.
 /// For Deleted content, set IsActive = false property.
 /// When IsActive = true, an attempt is made to delete any existing document with same UniqueKey, PortalId, SearchTypeId=Module, ModuleDefitionId and ModuleId(if specified).
 /// System calls the module based on Scheduler Frequency. This call is performed for modules that have indicated supportedFeature type="Searchable" in manifest.
 /// Call is performed for every Module Definition defined by the Module. If a module has more than one Module Defition, module must return data for the main Module Defition,
 /// or else duplicate content may get stored.
 /// Module must include ModuleDefition Id in the SearchDocument. In addition ModuleId and / or TabId can also be specified if module has TabId / ModuleId specific content.</remarks>
 public abstract IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate);
Пример #43
0
 //constructor with exception message
 public ModuleLoadException(string message, Exception inner, ModuleInfo ModuleConfiguration)
     : base(message, inner)
 {
     m_ModuleConfiguration = ModuleConfiguration;
     InitilizePrivateVariables();
 }
Пример #44
0
        private ModuleInfo FillModuleInfo(IDataReader dr, bool CheckForOpenDataReader, bool IncludePermissions)
        {
            ModuleInfo objModuleInfo = new ModuleInfo();
            ModulePermissionController objModulePermissionController = new ModulePermissionController();
            // read datareader
            bool canContinue = true;

            if (CheckForOpenDataReader)
            {
                canContinue = false;
                if (dr.Read())
                {
                    canContinue = true;
                }
            }
            if (canContinue)
            {
                objModuleInfo.PortalID    = Convert.ToInt32(Null.SetNull(dr["PortalID"], objModuleInfo.PortalID));
                objModuleInfo.TabID       = Convert.ToInt32(Null.SetNull(dr["TabID"], objModuleInfo.TabID));
                objModuleInfo.TabModuleID = Convert.ToInt32(Null.SetNull(dr["TabModuleID"], objModuleInfo.TabModuleID));
                objModuleInfo.ModuleID    = Convert.ToInt32(Null.SetNull(dr["ModuleID"], objModuleInfo.ModuleID));
                objModuleInfo.ModuleDefID = Convert.ToInt32(Null.SetNull(dr["ModuleDefID"], objModuleInfo.ModuleDefID));
                objModuleInfo.ModuleOrder = Convert.ToInt32(Null.SetNull(dr["ModuleOrder"], objModuleInfo.ModuleOrder));
                objModuleInfo.PaneName    = Convert.ToString(Null.SetNull(dr["PaneName"], objModuleInfo.PaneName));
                objModuleInfo.ModuleTitle = Convert.ToString(Null.SetNull(dr["ModuleTitle"], objModuleInfo.ModuleTitle));
                objModuleInfo.CacheTime   = Convert.ToInt32(Null.SetNull(dr["CacheTime"], objModuleInfo.CacheTime));
                objModuleInfo.Alignment   = Convert.ToString(Null.SetNull(dr["Alignment"], objModuleInfo.Alignment));
                objModuleInfo.Color       = Convert.ToString(Null.SetNull(dr["Color"], objModuleInfo.Color));
                objModuleInfo.Border      = Convert.ToString(Null.SetNull(dr["Border"], objModuleInfo.Border));
                objModuleInfo.IconFile    = Convert.ToString(Null.SetNull(dr["IconFile"], objModuleInfo.IconFile));
                objModuleInfo.AllTabs     = Convert.ToBoolean(Null.SetNull(dr["AllTabs"], objModuleInfo.AllTabs));
                int intVisibility = 0;
                if (((Convert.ToInt32(Null.SetNull(dr["Visibility"], intVisibility))) == 0) || ((Convert.ToInt32(Null.SetNull(dr["Visibility"], intVisibility))) == Null.NullInteger))
                {
                    objModuleInfo.Visibility = VisibilityState.Maximized;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["Visibility"], intVisibility))) == 1)
                {
                    objModuleInfo.Visibility = VisibilityState.Minimized;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["Visibility"], intVisibility))) == 2)
                {
                    objModuleInfo.Visibility = VisibilityState.None;
                }
                objModuleInfo.IsDeleted               = Convert.ToBoolean(Null.SetNull(dr["IsDeleted"], objModuleInfo.IsDeleted));
                objModuleInfo.Header                  = Convert.ToString(Null.SetNull(dr["Header"], objModuleInfo.Header));
                objModuleInfo.Footer                  = Convert.ToString(Null.SetNull(dr["Footer"], objModuleInfo.Footer));
                objModuleInfo.StartDate               = Convert.ToDateTime(Null.SetNull(dr["StartDate"], objModuleInfo.StartDate));
                objModuleInfo.EndDate                 = Convert.ToDateTime(Null.SetNull(dr["EndDate"], objModuleInfo.EndDate));
                objModuleInfo.ContainerSrc            = Convert.ToString(Null.SetNull(dr["ContainerSrc"], objModuleInfo.ContainerSrc));
                objModuleInfo.DisplayTitle            = Convert.ToBoolean(Null.SetNull(dr["DisplayTitle"], objModuleInfo.DisplayTitle));
                objModuleInfo.DisplayPrint            = Convert.ToBoolean(Null.SetNull(dr["DisplayPrint"], objModuleInfo.DisplayPrint));
                objModuleInfo.DisplaySyndicate        = Convert.ToBoolean(Null.SetNull(dr["DisplaySyndicate"], objModuleInfo.DisplaySyndicate));
                objModuleInfo.InheritViewPermissions  = Convert.ToBoolean(Null.SetNull(dr["InheritViewPermissions"], objModuleInfo.InheritViewPermissions));
                objModuleInfo.DesktopModuleID         = Convert.ToInt32(Null.SetNull(dr["DesktopModuleID"], objModuleInfo.DesktopModuleID));
                objModuleInfo.FriendlyName            = Convert.ToString(Null.SetNull(dr["FriendlyName"], objModuleInfo.FriendlyName));
                objModuleInfo.Description             = Convert.ToString(Null.SetNull(dr["Description"], objModuleInfo.Description));
                objModuleInfo.Version                 = Convert.ToString(Null.SetNull(dr["Version"], objModuleInfo.Version));
                objModuleInfo.IsPremium               = Convert.ToBoolean(Null.SetNull(dr["IsPremium"], objModuleInfo.IsPremium));
                objModuleInfo.IsAdmin                 = Convert.ToBoolean(Null.SetNull(dr["IsAdmin"], objModuleInfo.IsAdmin));
                objModuleInfo.BusinessControllerClass = Convert.ToString(Null.SetNull(dr["BusinessControllerClass"], objModuleInfo.BusinessControllerClass));
                objModuleInfo.SupportedFeatures       = Convert.ToInt32(Null.SetNull(dr["SupportedFeatures"], objModuleInfo.SupportedFeatures));
                objModuleInfo.ModuleControlId         = Convert.ToInt32(Null.SetNull(dr["ModuleControlId"], objModuleInfo.ModuleControlId));
                objModuleInfo.ControlSrc              = Convert.ToString(Null.SetNull(dr["ControlSrc"], objModuleInfo.ControlSrc));
                int intControlType = 0;
                if ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == -3)
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.ControlPanel;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == -2)
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.SkinObject;
                }
                else if (((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == -1) || ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == Null.NullInteger))
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.Anonymous;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == 0)
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.View;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == 1)
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.Edit;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == 2)
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.Admin;
                }
                else if ((Convert.ToInt32(Null.SetNull(dr["ControlType"], intControlType))) == 3)
                {
                    objModuleInfo.ControlType = SecurityAccessLevel.Host;
                }
                objModuleInfo.ControlTitle = Convert.ToString(Null.SetNull(dr["ControlTitle"], objModuleInfo.ControlTitle));
                objModuleInfo.HelpUrl      = Convert.ToString(Null.SetNull(dr["HelpUrl"], objModuleInfo.HelpUrl));

                if (IncludePermissions)
                {
                    if (objModuleInfo != null)
                    {
                        //Get the Module permissions first (then we can parse the collection to determine the View/Edit Roles)
                        objModuleInfo.ModulePermissions   = objModulePermissionController.GetModulePermissionsCollectionByModuleID(objModuleInfo.ModuleID, objModuleInfo.TabID);
                        objModuleInfo.AuthorizedEditRoles = objModulePermissionController.GetModulePermissions(objModuleInfo.ModulePermissions, "EDIT");
                        if (objModuleInfo.AuthorizedEditRoles == ";")
                        {
                            // this code is here for legacy support - the AuthorizedEditRoles were stored as a concatenated list of roleids prior to DNN 3.0
                            try
                            {
                                objModuleInfo.AuthorizedEditRoles = Convert.ToString(Null.SetNull(dr["AuthorizedEditRoles"], objModuleInfo.AuthorizedEditRoles));
                            }
                            catch
                            {
                                // the AuthorizedEditRoles field was removed from the Tabs table in 3.0
                            }
                        }
                        try
                        {
                            if (objModuleInfo.InheritViewPermissions)
                            {
                                TabPermissionController objTabPermissionController = new TabPermissionController();
                                TabPermissionCollection objTabPermissionCollection = objTabPermissionController.GetTabPermissionsCollectionByTabID(objModuleInfo.TabID, objModuleInfo.PortalID);
                                objModuleInfo.AuthorizedViewRoles = objTabPermissionController.GetTabPermissions(objTabPermissionCollection, "VIEW");
                            }
                            else
                            {
                                objModuleInfo.AuthorizedViewRoles = objModulePermissionController.GetModulePermissions(objModuleInfo.ModulePermissions, "VIEW");
                            }
                            if (objModuleInfo.AuthorizedViewRoles == ";")
                            {
                                // this code is here for legacy support - the AuthorizedViewRoles were stored as a concatenated list of roleids prior to DNN 3.0
                                try
                                {
                                    objModuleInfo.AuthorizedViewRoles = Convert.ToString(Null.SetNull(dr["AuthorizedViewRoles"], objModuleInfo.AuthorizedViewRoles));
                                }
                                catch
                                {
                                    // the AuthorizedViewRoles field was removed from the Tabs table in 3.0
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            else
            {
                objModuleInfo = null;
            }
            return(objModuleInfo);
        }