コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="modInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            var searchItemCollection = new SearchItemInfoCollection();

            List <Article> colArticles = ArticleController.GetArticles(modInfo.ModuleID);

            foreach (Article objArticle in colArticles)
            {
                string rssDescription;
                if (modInfo.ModuleSettings.Contains("FullArticleText"))
                {
                    rssDescription = Convert.ToBoolean(modInfo.ModuleSettings["FullArticleText"]) ? objArticle.Body : objArticle.Description;
                }
                else
                {
                    rssDescription = objArticle.Description;
                }

                var rssContent = HttpUtility.HtmlDecode(rssDescription);
                if (modInfo.ModuleSettings.Contains("CleanRss"))
                {
                    if (Convert.ToBoolean(modInfo.ModuleSettings["CleanRss"]))
                    {
                        rssContent = DotNetNuke.Common.Utilities.HtmlUtils.StripTags(rssContent, false);
                    }
                }

                var searchItem = new SearchItemInfo(objArticle.Title, rssContent, objArticle.CreatedByUserID, objArticle.CreatedOnDate, modInfo.ModuleID, objArticle.ArticleId.ToString(CultureInfo.InvariantCulture), DotNetNuke.Common.Utilities.HtmlUtils.StripTags(HttpUtility.HtmlDecode(objArticle.Body), false), "aid=" + objArticle.ArticleId);
                searchItemCollection.Add(searchItem);
            }

            return(searchItemCollection);
        }
コード例 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <param name="moduleId">The Id of the module to be exported</param>
        /// -----------------------------------------------------------------------------
        public string ExportModule(int moduleId)
        {
            string strXml = "";

            List <Article> coldnnsimplearticles = ArticleController.GetArticles(moduleId);

            if (coldnnsimplearticles.Count != 0)
            {
                strXml += "<articles>";

                foreach (Article objArticle in coldnnsimplearticles)
                {
                    strXml += "<article>";
                    strXml += "<title>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objArticle.Title) + "</title>";
                    strXml += "<description>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objArticle.Description) + "</description>";
                    strXml += "<body>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objArticle.Body) + "</body>";
                    strXml += "</article>";
                }
                strXml += "</articles>";
            }

            return(strXml);
        }
コード例 #3
0
ファイル: Article.cs プロジェクト: w5golf/dnnsimplearticle
 ///<summary>
 /// Save the article
 ///</summary>
 ///<param name="tabId"></param>
 public void Save(int tabId)
 {
     ArticleId = ArticleController.SaveArticle(this, tabId);
 }