Beispiel #1
0
    private string ElaborateXHTML(BusiBlocks.DocoBlock.Article latestArticle, BusiBlocks.DocoBlock.ArticleBase article)
    {
        var xhtml = new BusiBlocks.XHTMLText();

        xhtml.Load(article.Body);

        string[] attachments = BusiBlocks.DocoBlock.DocoManager.GetFileAttachments(latestArticle, BusiBlocks.DocoBlock.EnabledStatus.Enabled);
        Array.Sort <string>(attachments);

        xhtml.ReplaceLinks(delegate(string oldUrl, out string newUrl)
                           { ReplaceLink(latestArticle.Name, attachments, oldUrl, out newUrl); }
                           );

        return(xhtml.Xhtml);
    }
Beispiel #2
0
    protected void btSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            BusiBlocks.CommsBlock.Forums.Category forum = GetForum();

            var sb = new StringBuilder();

            var xhtml = new BusiBlocks.XHTMLText();
            xhtml.Load(newMessage.MessageBodyHtml);

            Exception validateError;
            if (xhtml.IsValid(forum.XHtmlMode, out validateError) == false)
            {
                throw new BusiBlocks.TextNotValidException(validateError);
            }

            BusiBlocks.Attachment.FileInfo attachment = null;
            //Create attachmentAccess.Access
            if (newMessage.AttachmentFile.HasFile)
            {
                attachment = new BusiBlocks.Attachment.FileInfo(newMessage.AttachmentFile.FileName,
                                                                newMessage.AttachmentFile.PostedFile.ContentType,
                                                                newMessage.AttachmentFile.FileBytes);
            }

            //Insert the topic
            BusiBlocks.CommsBlock.Forums.ForumsManager.CreateTopic(forum, Page.User.Identity.Name,
                                                                   newMessage.MessageSubject,
                                                                   xhtml.Xhtml,
                                                                   attachment, sb.ToString());

            Navigation.Communication_ForumView(forum.Name).Redirect(this);
        }
        catch (Exception ex)
        {
            throw ex;
            ((IFeedback)Page.Master).SetException(GetType(), ex);
        }
    }