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()); }
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()); }
internal static string GetUrl(object page) { var result = string.Empty; if (page is Page) { result = ActionHelper.GetViewPagePath(WikiManager.ViewVirtualPath, (page as Page).PageName); } else if (page is File) { result = ActionHelper.GetViewFilePath(WikiManager.ViewVirtualPath, (page as File).FileName); } return(result); }
private List <SubscriptionObject> GetSubscriptionObjectsByType(Guid productID, Guid moduleID, Guid typeID) { List <SubscriptionObject> subscriptionObjects = new List <SubscriptionObject>(); ISubscriptionProvider subscriptionProvider = SubscriptionProvider; if (typeID.Equals(_wikiSubscriptionTypeNewPageID)) { List <string> wikiList = new List <string>( subscriptionProvider.GetSubscriptions( Constants.NewPage, WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString())) ); if (wikiList.Contains(null)) { subscriptionObjects.Add(new SubscriptionObject() { ID = new Guid("{56A0EC10-5A1C-45ab-95AA-8F56827A8CCC}").ToString(), Name = WikiResource.NotifyAction_NewPage, URL = string.Empty, SubscriptionType = GetSubscriptionTypes().Find(st => st.ID.Equals(_wikiSubscriptionTypeNewPageID)) }); } } else if (typeID.Equals(_wikiSubscriptionTypeChangePageID)) { List <string> wikiList = new List <string>( subscriptionProvider.GetSubscriptions( Constants.EditPage, WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString())) ); foreach (string wikiObj in wikiList) { subscriptionObjects.Add(new SubscriptionObject() { ID = wikiObj, Name = string.IsNullOrEmpty(wikiObj) ? WikiResource.MainWikiCaption : wikiObj, URL = ActionHelper.GetViewPagePath(WikiNotifySource.Instance.GetDefPageHref(), wikiObj), SubscriptionType = GetSubscriptionTypes().Find(st => st.ID.Equals(_wikiSubscriptionTypeChangePageID)), }); } } else if (typeID.Equals(_wikiSubscriptionTypeAddPageToCat)) { List <string> wikiList = new List <string>( subscriptionProvider.GetSubscriptions( Constants.AddPageToCat, WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString())) ); foreach (string wikiObj in wikiList) { subscriptionObjects.Add(new SubscriptionObject() { ID = wikiObj, Name = wikiObj.Equals(string.Empty) ? WikiResource.MainWikiCaption : wikiObj, URL = ActionHelper.GetViewPagePath(WikiNotifySource.Instance.GetDefPageHref(), wikiObj), SubscriptionType = GetSubscriptionTypes().Find(st => st.ID.Equals(_wikiSubscriptionTypeAddPageToCat)), }); } } return(subscriptionObjects); }