Exemplo n.º 1
0
        /// <summary>
        /// Exports the module (Implements the IPortable interface)
        /// </summary>
        /// <param name="moduleID">The module ID</param>
        /// <returns>XML String of the module data</returns>
        public string ExportModule(int moduleID)
        {
            StringBuilder xml   = new StringBuilder();
            var           links = LinkController.GetLinks(moduleID);

            if (links.Count() != 0)
            {
                var module = ModuleController.Instance.GetModule(moduleID, DotNetNuke.Common.Utilities.Null.NullInteger, false);
                xml.Append("<links>");
                foreach (var link in links)
                {
                    xml.Append("<link>");
                    xml.AppendFormat("<title>{0}</title>", XmlUtils.XMLEncode(link.Title));
                    xml.AppendFormat("<url>{0}</url>", XmlUtils.XMLEncode(link.Url));
                    xml.AppendFormat("<vieworder>{0}</vieworder>", XmlUtils.XMLEncode(link.ViewOrder.ToString()));
                    xml.AppendFormat("<description>{0}</description>", XmlUtils.XMLEncode(link.Description));
                    xml.AppendFormat("<newwindow>{0}</newwindow>", XmlUtils.XMLEncode(link.NewWindow.ToString()));
                    xml.AppendFormat("<trackclicks>{0}</trackclicks>", XmlUtils.XMLEncode(link.TrackClicks.ToString()));
                    xml.Append("</link>");
                }

                xml.Append("</links>");
            }

            return(xml.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Exports the module (Implements the IPortable interface)
        /// </summary>
        /// <param name="moduleID">The module ID</param>
        /// <returns>XML String of the module data</returns>
        public string ExportModule(int moduleID)
        {
            StringBuilder xml   = new StringBuilder();
            var           links = LinkController.GetLinks(moduleID);

            if (links.Count() != 0)
            {
                var module   = ModuleController.Instance.GetModule(moduleID, DotNetNuke.Common.Utilities.Null.NullInteger, false);
                var portalId = module?.PortalID ?? Null.NullInteger;
                xml.Append("<links>");
                foreach (var link in links)
                {
                    xml.Append("<link>");
                    xml.AppendFormat("<title>{0}</title>", XmlUtils.XMLEncode(link.Title));
                    xml.AppendFormat("<url>{0}</url>", XmlUtils.XMLEncode(link.Url));
                    xml.AppendFormat("<vieworder>{0}</vieworder>", XmlUtils.XMLEncode(link.ViewOrder.ToString()));
                    xml.AppendFormat("<description>{0}</description>", XmlUtils.XMLEncode(link.Description));
                    xml.AppendFormat("<newwindow>{0}</newwindow>", XmlUtils.XMLEncode(link.NewWindow.ToString()));
                    xml.AppendFormat("<trackclicks>{0}</trackclicks>", XmlUtils.XMLEncode(link.TrackClicks.ToString()));
                    xml.AppendFormat("<logactivity>{0}</logactivity>", XmlUtils.XMLEncode(link.LogActivity.ToString()));
                    xml.AppendFormat("<refreshinterval>{0}</refreshinterval>", XmlUtils.XMLEncode(link.RefreshInterval.ToString()));
                    xml.AppendFormat("<grantroles>{0}</grantroles>", XmlUtils.XMLEncode(ConvertToRoleNames(portalId, link.GrantRoles)));
                    xml.Append("</link>");
                }

                xml.Append("</links>");
            }

            return(xml.ToString());
        }
Exemplo n.º 3
0
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc)
        {
            // TODO: Would be better performing if we had a last modified date and soft deletes
            DotNetNuke.Services.Search.Internals.InternalSearchController.Instance.DeleteSearchDocumentsByModule(moduleInfo.PortalID, moduleInfo.ModuleID, moduleInfo.ModuleDefID);
            List <SearchDocument> searchDocuments = new List <SearchDocument>();
            var links = LinkController.GetLinks(moduleInfo.ModuleID);

            foreach (var link in links)
            {
                var searchDoc = new SearchDocument
                {
                    UniqueKey       = moduleInfo.ModuleID.ToString(),
                    PortalId        = moduleInfo.PortalID,
                    Title           = link.Title,
                    Description     = link.Description,
                    Body            = link.Description,
                    ModifiedTimeUtc = link.CreatedDate
                };
                searchDocuments.Add(searchDoc);
            }

            return(searchDocuments);
        }