public void LoadTest() { XHTMLText target = new XHTMLText(); string folder = PathHelper.CombineUrl(Environment.CurrentDirectory, PathHelper.CombineUrl("Data", "Xhtml")); string xhtml = PathHelper.CombineUrl(folder, "sop-1.1.001-management-meetings-v1.1.html"); target.Load(xhtml); xhtml = "<p>The purpose of this Procedure is to specify requirements for scheduling and performing Internal Quality " + "and OH&S Audits of the Sigma Bravo Business Management System (BMS) to verify its maintenance, effectiveness and continual improvement.</p>"; target.Load(xhtml); xhtml = " <h1>Internal & Audits</h1>"; target.Load(xhtml); xhtml = "<p>Doc & Data Develop & Control</p>"; target.Load(xhtml); xhtml = "<p>&</p>"; target.Load(xhtml); xhtml = target.Xhtml; target.Load(xhtml); // This one fails. //xhtml = "<p><h1>&<h1></p>"; //xhtml = HttpUtility.HtmlDecode(xhtml); //target.Load(xhtml); xhtml = PathHelper.CombineUrl(folder, "sop-1.1.002-internal-audits.html"); target.Load(xhtml); xhtml = PathHelper.CombineUrl(folder, "sop-1.1.003-problems-and-enhancements-v1.1.html"); target.Load(xhtml); }
protected void Timer1_Tick(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ChapterId) && IsEditorChanged) { XHTMLText formattedHTML = new XHTMLText(); string content = formattedHTML.FormatXHTML(txtEditor.Content); SaveDraft(ChapterId, content); DisplayUpdateMessage("Last saved at : " + DateTime.Now.ToLongTimeString()); lstChangedChaps.Items.Add(ChapterId); } }
public override IList <string> GetSubChapters(string chapterId) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ChapterVersionDataStore chapVersion = new ChapterVersionDataStore(transaction); ChapterVersion cv = chapVersion.FindAllItems().First(x => x.Id.Equals(chapterId)); XHTMLText xhtmlText = new XHTMLText(); IList <string> subChapters = xhtmlText.GetSubChapters(cv.Content); return(subChapters); } }
private void DisplayContent(string content, int chapNumb, bool isNumbChaps) { txtEditor.Content = content; if (IsNumbChaps) { XHTMLText numberredChapsHTML = new XHTMLText(); litViewContent.InnerHtml = numberredChapsHTML.AddChapNumbers(content, chapNumb); lblChapNumb.Text = chapNumb.ToString() + ". "; } else { litViewContent.InnerHtml = content; } }
public override IList <SubSectionChap> GetChapterSubSection(string chapterId) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ChapterVersionDataStore chapVersion = new ChapterVersionDataStore(transaction); ChapterVersion cv = chapVersion.FindAllItems().First(x => x.Id.Equals(chapterId)); XHTMLText xhtmlText = new XHTMLText(); IList <string> subChapters = xhtmlText.GetSubChapters(cv.Content); List <SubSectionChap> chapSections = new List <SubSectionChap>(); foreach (string subSec in subChapters) { chapSections.Add(new SubSectionChap { ChapId = chapterId, AnchorTag = subSec }); } return(chapSections); } }
public static object wmLoadChapter(string Id, bool IsEdtorChanged, string ChapName) { try { IsEditorChanged = IsEdtorChanged; tempChapterId = ChapterId; //hold the ID of previous chapter when switching. ChapterId = Id; XHTMLText numberedChaps = new XHTMLText(); ChapterVersion chapter = DocoManager.GetChapterVersion(ChapterId); //THIS HAS BEEN REPLACED BY THE AUTO SAVE SERVICE!. //if (IsEditorChanged) //SaveDraft(tempChapterId, EditorContent, ChapName); if (!string.IsNullOrEmpty(contentMode) && contentMode.Equals("draft")) { IList <Draft> drafts = DocoManager.GetDraftsByChapterId(chapter.Id); if (drafts.Count > 0) { Draft draft = drafts.FirstOrDefault <Draft>(); draft.Name = chapter.Name; draft.Sequence = chapter.Sequence + 1; draft.Content = draft.Content; //numberedChaps.AddChapNumbers(draft.Content, draft.Sequence); return(draft); } } chapter.Sequence = chapter.Sequence + 1; chapter.Content = chapter.Content;// numberedChaps.AddChapNumbers(chapter.Content, (chapter.Sequence + 1)); return(chapter); } catch (Exception ex) { //Log - unable to load the requested chapter. throw ex; } }
/// <summary> /// Send a notification to the user of the parent message /// </summary> /// <param name="parent"></param> /// <param name="message">Answer</param> private void NotifyUserReply(Message parent, Message message) { if (NotificationProvider == null) { return; } if (parent.Owner == null) { return; } XHTMLText xhtml = new XHTMLText(); xhtml.Load(message.Body); //Create the parameters list Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("?title?", message.Title); parameters.Add("?bodyhtml?", message.Body); parameters.Add("?bodytext?", xhtml.GetShortText()); parameters.Add("?user?", message.Owner); parameters.Add("?idmessage?", message.Id); parameters.Add("?idforum?", parent.Topic.Category.Id); parameters.Add("?idtopic?", parent.Topic.Id); parameters.Add("?forum?", parent.Topic.Category.Name); parameters.Add("?forumDisplayName?", parent.Topic.Category.DisplayName); if (parent.Owner != null && parent.Owner.Length > 0) { System.Web.Security.MembershipUser destinationUser = System.Web.Security.Membership.GetUser(parent.Owner); if (destinationUser != null && NotificationProvider.UserCanReceiveNotification(destinationUser)) { NotificationProvider.NotifyUser(destinationUser, parameters); } } }
protected void btnSaveContent_Click(object sender, EventArgs e) { //create a new version for chapter //add content to the chapter //SaveContent(ChapterId, "button"); if (!string.IsNullOrEmpty(ChapterId)) { XHTMLText formattedHTML = new XHTMLText(); string content = formattedHTML.FormatXHTML(txtEditor.Content); SaveDraft(ChapterId, content); DisplayUpdateMessage("Last saved at : " + DateTime.Now.ToLongTimeString()); IsEditorChanged = false; //IsNameChanged = false; lstChangedChaps.Items.Add(ChapterId); //Bind the new version to the TOC BindSequence(); //load the saved chapter. LoadChapter(false); } }
/// <summary> /// Send a notification to the user of the parent message /// </summary> /// <param name="parent"></param> /// <param name="message">Answer</param> private void NotifyUserReply(Message parent, Message message) { if (NotificationProvider == null) return; if (parent.Owner == null) return; XHTMLText xhtml = new XHTMLText(); xhtml.Load(message.Body); //Create the parameters list Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters.Add("?title?", message.Title); parameters.Add("?bodyhtml?", message.Body); parameters.Add("?bodytext?", xhtml.GetShortText()); parameters.Add("?user?", message.Owner); parameters.Add("?idmessage?", message.Id); parameters.Add("?idforum?", parent.Topic.Category.Id); parameters.Add("?idtopic?", parent.Topic.Id); parameters.Add("?forum?", parent.Topic.Category.Name); parameters.Add("?forumDisplayName?", parent.Topic.Category.DisplayName); if (parent.Owner != null && parent.Owner.Length > 0) { System.Web.Security.MembershipUser destinationUser = System.Web.Security.Membership.GetUser(parent.Owner); if (destinationUser != null && UserCanReceiveNotification(destinationUser)) //NotificationProvider.UserCanReceiveNotification(destinationUser { NotificationProvider.NotifyUser(destinationUser, parameters); } } }