Converting richtext to MIME / HTML? - xpages

I have a old Notes Database that was designed with tradtional Notes forms for both the client and the web.
I still want to keep the old database in the traditonal Notes client. But display the rich text as HTML in xpages.
I selected the Store contents as HTML and MIME on the rich text field on the form but when I do, it destroys all of the formatting and removes things like collapsable sections. But it does allow the content to be displayed even though it is not pretty.
I found this thread:
XPages RichText Links
Where Steve recommends using that option.
He goes on with a further solution that I am not sure I understand it at all.
We have lots and lots of content, so asking the users to redo it all manaully is not an option. Is there anyway we can either just display this rich text content or at least convert it while keeping all of the formatting and collapsible sections?

When you check that option you destroy the existing content formatting if you don't convert the content. The conversion is not perfect and is what the RichText control does on the fly.
The set of actions you want to take:
get the coexedit plugin or the
add a new RT field with the MIME
run an agent to
optional: remove the old field and rename the new to the old name (make sure mime stays checked)
For read only access (both options get better with the coexedit plugin) :
use the RichText control, no further action is required
use a Dojo panel. It has a href property you point to ... Body?OpenField, no further action is required
Note:the later doesn't work in XPiNC

Related

Is it possible to keep images in configuration document in lotus notes?

I am trying to keep image in configuration document, in order to change the image dynamically i am not able to do like that.or Is there any other way to keep images in forms or pages without entering into code everytime?
If I understand correctly, you want to dynamically change/replace the Image in the form/Page design element without using the notes designer.
In Notes, all Design elements are treated as a document and each design element have a unique UNID. The "$Body" field stores the content of the form or page
You could do this by taking the UNID of the page or form and use db.GetDocumentByUNID() method to get handle to the Page or Form design element. Then modify the content of "$Body" field in lotus script to update image or any other data (table/text) in the Form/page. The changes will reflect in the Form/Page.
The UNID of the Page/form can be found in notes designer.
Let me know if this helps.

How to display and work with tabbed table in XPages?

I have database where all documents were created by Lotus Notes client. Documents contain Rich text field with tabbed tables with text and attachments on every tab.
Now I want to show documents with XPages. But tabbed tables are not visible in XPages.
How can I display Rich text field with tabbed table in XPages?
The answer isn't as straight forwarded as you would like and involved some wizardry. There are several moving parts. The first is the quality of the RTF-HTML conversion. I superstrongly suggest you give Ben a call. In case he doesn't handle tabbed tables (which are a beast), these are the steps to get a solution (I hope the force Javascript is strong with you):
Familiarize yourself with the Table handling and rendering. To do so, open the RichText field on its own in the browser. The trick is the ?OpenField command as documented by Carl.
In that HTML you can click on the various tabs to show that content, look at the URL and the source to learn about the exact syntax (which AFAIK isn't documented - or the documentation is well hidden)
By now you should have an idea how to identify a tabbed table by its HTML markup. Try to construct a Dojo selector or a JQuery (whatever is your poison).
Now show your page without the RichText field, but place a placeholder <div id="RTPlaceholder" /> where you want to show your content (or place a dijit panel there).
Use an Ajax call to ?OpenField to get the content. With your query expression you check for tabbed tables - if none there, just render the content
If you found a tabbed table, you construct a dijit tabbed table (or a UI framework of your choice equivalent) and make one call per tab to fill them. Some clever queries are needed (you don't want the surrounding table, but only tab-label and content).
That's the general direction. So Step 1: a little chat with Ben. As usual the devil is in the details, so you need to be brave.
Memento bene:
RichText > HTML => false;
HTML > RichText => false;
HMTL != RichText => true;
Let us know how it goes!

Why is my fileDownload control showing the trashcan even in read mode?

This is a rather strange one I think, and I'm sure I made a mistake here myself:
in one of my applications I'm showing a fileDownload control bound to a Richtext field in my underlying NotesDocument. The control's properties a are set to Hide if no attachments, show size, type and created as well as allow delete. The control itself sits inside a custom control, being part of another custom control, similar to this:
Xpage.xsp
- ccContainer
- - ccInnerDoc
Document datasources for both the container and the "inner" doc are defined at the root of ccContainer and passed into the inner doc.
The inner doc's datasource is comnputed based on a document selection, and it's igenoreRequestParams property is set to false so that I can display the contents of the selected datasource in a given panel etc.
The selected doc is first opened in read mode, and I can set it to edit mode using a button.
Problem now is that my file download control always is showing the delete icon (trashcan) no matter which mode the doc is opened in. And it's not only the icon showing, it also pretends to work by asking me whether I really want to delete and then really removes the file attachment. Only that this change of course cannot be stored into the datasource because it's only open in read mode.
I'm sure that this behaviour is some side-effect of something else in my application (to a certain extent I rebuilt this in a plain new db and until now cannot reproduce it), but I'm at the end of my knowledge of what this could be.
Any hint of what could be causing this is more than welcome.
In place of #Frantisek Kossuth I answer this myself: see compute dynamically the allowDelete property of file download xpages
Thanks again, Frantisek!

Xpages File Upload Control does nothing

Background: One xpage bound to document1. On this xpages is a tabbed table contain several tabs. Each tab contains an panel bound to other data sources incl document2. Document2 is created and made a child of document1. In each panel is a table to allow the user to create the new document, as well as two view controls. Everything works beautifully...until...
Problem: I was asked to add a way to upload an attachment to the child document. I first created an rich text field on the bound document called "ScannedInvoice". I then create a File Upload Control from the core controls and bound it to document2/ScannedInvoice. By rule, I only want a single attachment, otherwise I would consider the openNTF upload control.
I cannot figure out why nothing appears on the back end when I upload a file and create a new document. Everything else works, but there is no attachment in the ScannedInvoice field and also no $FILE fields attached to the document either.
Thanks in advance for any tips. I have searched quite a bit and have not found any answers. - Steve
<xp:fileUpload id="fileUpload1"
value="#{document2.ScannedInvoice}" useUploadname="false"
style="font-size:8pt" filename="scannedinvoice.jpg"
mimetype="image/jpeg">
</xp:fileUpload>
Note: The field ScannedInvoice on the Invoice form is rich text.
Code to save button: document2.save()
Document2 has scope=request and ignoreRequestParam=true. Both of these have to be set like this in order to work. parentID=# document1.getNoteID()
a file upload needs a full refresh of the page to be able to upload the file. Make sure that you are doing that.
======================================
Update Domino 9.0.1 supports partial refresh uploads

Default content editor in list form doesn't allow image alignment

I need to be able to adjust the alignment of an image in an "Enhanced Rich Text Field" in an announcements list in MOSS 2007. However, the default content editor in the edit form for the list doesn't provide a way to do that. What's the fastest way for me to make sure users can align images? My first thought was to customize the DispForm.aspx and EditForm.aspx pages, but they just have the ListForm web part in the content region and as far as I know, you can't customize the ListForm web part from the designer.
You can't customize the LisForm web part, but you can add a "custom list form" to create a custom edit form. Maybe you haven't seen this article: http://weblogs.asp.net/jan/archive/2006/11/06/Custom-Edit-Forms-for-SharePoint-2007-Lists.aspx
Then you could do some javascript hackery to insert your own button which then calls something similar to existing RTE_InsertImage function to call a pop-up window and do whatever you need (you'll find this function in 12\template\layouts\1033\form.js)
I fail to see (or understand) your issue. I created a new announcements list, created a new item, inserted an image, aligned it to the right, viewed the item and it worked.
Then I proceeded to create a new custom column, choose multiple lines,enhanced rich text field, edited my list item, added an image, centered it, viewed and it was also working.
The only thing I noticed is that the "rich" control does not appears on non-IE browsers.

Resources