Daniele Grillo
Daniele Grillo

Reputation: 1023

reply-with history Xpages how?

I would create a simple Reply-With-history function that from an XPages with RichText Control (that use CkEDITOR) open another XPages with the history of previous PAGE (richtext + attachments + images etc...)

I think that is possible..but I don't know the correct way for this.

Anyone have any suggestion?

Tnx to all

P.S. Think that you have a inbound email document and you create the button reply-with-history-and-attachments...the Inotes open a new WebPage with CkEditor that into the body there are the inbound mail...and into the attachment utility ( I think DownloadControl) there are the attachments of Inboud document

Upvotes: 3

Views: 378

Answers (2)

Simon McLoughlin
Simon McLoughlin

Reputation: 8465

Something like this would add a parent documents subject to the current one

var content = <richTextControl>.getValue();
if(dominoDoc.isResponse())
{
    var doc = database.getDocumentByUNID(dominoDoc.getParentId());
    content += "\n\n";
    content += "=================== Previous: ==================";
    content += doc.getItemValueString("content");
}

so this would get the current content, add 2 lines space, add a line to show the end and then its parents content. Depending on your use case maybe put this in a scoped variable and on the click of a button add it to the current document.

EDIT:

If you want to deal with attachments to a field you can use code like the below I used in a repeat to iterate through a list of attachments and return links. for your use you may need to change this to use a for loop

var al:java.util.list = dominoDoc.getAttachment("Body");
var eo:NotesEmbeddedObject = "";
if(!al.isEmpty())
{
   eo = al.get(index);
   return eo.getHref();
}
else
{
   return "";
}

Upvotes: 0

stwissel
stwissel

Reputation: 20384

You get the content of the document as MIME (In case you have forgotten, speak after me: There is no RichText in the Internet, it is a ghost of Christmas past. There's only MIME) using the Mime methods of the Notes document. Then you check what you have: HTML or plain text. If it is plain text, then you just do a String concatenation similar to above but with the MIMEPart instead of the itemValueString. When it is HTML (as your question suggests) read it with a parser (e.g. HTMLCleaner can read HTML nicely) and then insert your new stuff after you encountered the body tag. Then read the rest and write the MIME back. Would make a nice bean.

Upvotes: 0

Related Questions