Пример #1
0
        public override SearchResultItem[] Search(string text)
        {
            var list        = new List <SearchResultItem>();
            var defPageHref = VirtualPathUtility.ToAbsolute(WikiManager.ViewVirtualPath);

            foreach (var page in new WikiEngine().SearchPagesByContent(text))
            {
                var pageName = page.PageName;
                if (string.IsNullOrEmpty(pageName))
                {
                    pageName = WikiResource.MainWikiCaption;
                }

                list.Add(new SearchResultItem
                {
                    Name        = pageName,
                    Description = HtmlUtil.GetText(
                        EditPage.ConvertWikiToHtml(page.PageName, page.Body, defPageHref,
                                                   WikiSection.Section.ImageHangler.UrlFormat, TenantProvider.CurrentTenantID), 120),
                    URL  = ActionHelper.GetViewPagePath(defPageHref, page.PageName),
                    Date = page.Date
                });
            }
            return(list.ToArray());
        }
Пример #2
0
        private ITagValue[] GetNotifyTags(string pageName, string patternType, Comment comment)
        {
            var page = GetPage(pageName);

            if (page == null)
            {
                return(null);
            }

            var user    = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var defPage = VirtualPathUtility.ToAbsolute(WikiManager.ViewVirtualPath);

            var tags = new List <ITagValue>
            {
                new TagValue(Constants.TagPageName, String.IsNullOrEmpty(page.PageName) ? WikiResource.MainWikiCaption : page.PageName),
                new TagValue(Constants.TagURL, CommonLinkUtility.GetFullAbsolutePath(ActionHelper.GetViewPagePath(defPage, page.PageName))),
                new TagValue(Constants.TagUserName, user.DisplayUserName()),
                new TagValue(Constants.TagUserURL, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(user.ID))),
                new TagValue(Constants.TagDate, TenantUtil.DateTimeNow()),
                new TagValue(Constants.TagPostPreview, HtmlUtil.GetText(EditPage.ConvertWikiToHtml(page.PageName, page.Body, defPage, WikiSection.Section.ImageHangler.UrlFormat, CoreContext.TenantManager.GetCurrentTenant().TenantId), 120))
            };

            if (!string.IsNullOrEmpty(patternType))
            {
                tags.Add(new TagValue(Constants.TagChangePageType, patternType));
            }
            if (comment != null)
            {
                tags.Add(new TagValue(Constants.TagCommentBody, comment.Body));
            }

            return(tags.ToArray());
        }
Пример #3
0
        private ITagValue[] GetCategoryNotifyTags(string objectId, string pageName)
        {
            var page = GetPage(pageName);

            if (page == null)
            {
                return(null);
            }

            var user        = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var defPageHref = VirtualPathUtility.ToAbsolute(WikiManager.ViewVirtualPath);

            var tags = new List <ITagValue>
            {
                new TagValue(Constants.TagPageName, page.PageName),
                new TagValue(Constants.TagURL, CommonLinkUtility.GetFullAbsolutePath(ActionHelper.GetViewPagePath(defPageHref, page.PageName))),
                new TagValue(Constants.TagUserName, user.DisplayUserName()),
                new TagValue(Constants.TagUserURL, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(user.ID))),
                new TagValue(Constants.TagDate, TenantUtil.DateTimeNow()),
                new TagValue(Constants.TagPostPreview, HtmlUtil.GetText(EditPage.ConvertWikiToHtml(page.PageName, page.Body, defPageHref, WikiSection.Section.ImageHangler.UrlFormat, CoreContext.TenantManager.GetCurrentTenant().TenantId), 120)),
                new TagValue(Constants.TagCatName, objectId),
                ReplyToTagProvider.Comment("wiki", pageName)
            };

            return(tags.ToArray());
        }
Пример #4
0
        public override SearchResultItem[] Search(string text)
        {
            List <SearchResultItem> list = new List <SearchResultItem>();
            string rootPage    = HttpContext.Current.Request.PhysicalApplicationPath.TrimEnd('\\');
            string defPageHref = VirtualPathUtility.ToAbsolute(WikiManager.ViewVirtualPath);

            string pageName;


            foreach (Page page in new WikiEngine().SearchPagesByContent(text))
            {
                pageName = page.PageName;
                if (string.IsNullOrEmpty(pageName))
                {
                    pageName = WikiResource.MainWikiCaption;
                }

                list.Add(new SearchResultItem()
                {
                    Name        = pageName,
                    Description = HtmlUtility.GetText(
                        EditPage.ConvertWikiToHtml(page.PageName, page.Body, defPageHref,
                                                   WikiSection.Section.ImageHangler.UrlFormat, TenantId), 120),
                    URL  = ActionHelper.GetViewPagePath(defPageHref, page.PageName),
                    Date = page.Date
                });
            }
            return(list.ToArray());
        }
Пример #5
0
 public string ConvertWikiToHtml(string pageName, string wikiValue, string appRelativeCurrentExecutionFilePath,
                                 string imageHandlerUrl)
 {
     return(EditPage.ConvertWikiToHtml(pageName, wikiValue, appRelativeCurrentExecutionFilePath,
                                       imageHandlerUrl, TenantId));
 }