XPages RichText Links - lotus-notes

I have an XPage to display document data. To display RichText data I added a RichText control. What I found out is that database / view / document links are displayed with the appropriate icon but are converted to http-links. I would like to have these links being transformed to notes://-links to make sure that these links are being opened in the user's notes client rather than in the user's browser.
Any suggestions how to accomplish this from a technical point of view?
Many thanks in advance for your help.
Michael

Speak after me:
The web knows no RichText, it is a ghost of Christmas past.
There is only MIME. Now go and live with it!
Unless you build an hybrid application where RichText is used in the client and browser I recommend to select the option [x] Save as MIME in the RichText options. For hybrid applications it depends on the use case.
In your case it seems (?) that the datbase/view/document links are added using a client. It looks like a good idea to use mime in this case. Then is is just a simple string (of HTML) where you can before display (or save) use a DOM operation or a Regex to sort out the content. That works client or server side
You could have a custom control that contains a DIV and a XSP.addOnLoad() script that uses the RichtText url in an Ajax call and a dojo.query("a") to get a handle on all links and then sort out the ones you want to alter.
Let us know how it goes.

Related

Office JS API for OneNote - Missing APIs?

Office JS API for OneNote... Love it, but I am missing some critical things. Can someone comment?
I got a paragraph, type is RichText. But, I could not find in the API the style of the rich text. In my case, I want to know if it is a Header 1,2,3... or Quote, etc.
Same-page linking: In OneNote desktop I can right click any text and copy link to that specific paragraph. Clicking that link later will take me directly to that paragraph. However, I did not find an API that can navigate directly to a paragraph, the only one I could find navigates to a page: navigateToPage(page: Page) and navigateToPageWithClientUrl(url: string)
If that even possible? Also, I noticed these links don't work at all in the web version of OneNote, but that's a different story I guess.
I am building (a free!) TOC add-in, you can put at the top of your page and will potentially show all headers with links to the header in the page. However, the lack of the above capabilities make it impossible for such a simple add-in to work (or, at least I thought it is a very basic and simple one...)
Any help will be greatly appreciated!!! Like I said, if I get these 2 issues resolved - the add-in will be available for free.
https://dev.office.com/reference/add-ins/onenote/paragraph?product=onenote
Sounds like a cool add-in!
You can use the getHtml method on richText to get the style. There is an example in this answer.
OneNote Add in: Getting HTML content
As for creating links to a specific paragraph, OneNote add ins do not expose the capability of doing that. You can add a request in our uservoice. The only supported capability is to navigate to a page.
https://onenote.uservoice.com/forums/245490-onenote-developer-apis
As for links that work in OneNote online, the "webUrl" property in a page will contain a link that works in OneNote online.
https://github.com/OfficeDev/office-js-docs/blob/master/reference/onenote/page.md
Thanks for feedback. We will update the documentations.
There is currently no way to scroll to any region in the page.

XPage not found because database name is in uppercase

We have inherited a web application in Lotus Notes in which we are trying to introduce XPages (we are new to both Lotus Notes and XPages, please forgive our inexperience).
We have a view that we are trying to swap with an XPage. The current view is called like this from the application menu (the view is being called from a form):
<a href="FRVWFACSPROVXEstadoAno?openform" target="ifat">
And we are trying to call the XPage like this:
<a href="Prueba.xsp" target="ifat">
For some reason, the link is expanded at runtime to this:
http://tbsdesa.es.lladro.com/FORMACION/CARLOS/TBS_AGORA_FIN.NSF/Prueba.xsp
The page is not found because the database name is in uppercase (in fact, if we change TBS_AGORA_FIN.NSF to TBS_AGORA_FIN.nsf, it works). It is also strange that the current link is in uppercase, too, but nevertheless it works:
http://tbsdesa.es.lladro.com/FORMACION/CARLOS/TBS_AGORA_FIN.NSF/FRVWFACSPROVXEstadoAno?openform
We would like to know why the database is in uppercase. Could the Domino server be doing this?
I'm going to assume based on your question that you're calling your link from a form or page that's rendering as HTML. Since it's a relative link, you're probably navigating to it through a link that includes uppercase for the .NSF in the title. This can be solved either by fixing all your links so that .nsf is lowercase, or by calculating your XPages links better.
To do the latter, I usually do the following for XPage Links:
Link
Where XPage.xsp is the name of my xpage and the value of the Computed Text is:
"/" + #WebDbName + "/"
This will calculate the link based on what Notes wants to refer to the database as.
Hope this helps.
What OS is the server running on? If the server is running on Linux/Unix then you need to be aware that directories and filenames are case sensitive. The tricky thing, however, is that once they have been opened they are cached by the server - and will work without being case sensitive (for some time...). This can be really tricky to troubleshoot if you are not aware of the cause ;-)
I agree with the possible solution suggested by Aaron, however, it really should not be necessary... It should be better to leave that to the server.
If you are running on a *nix OS then ensuring that all paths and filenames are in the same case (I use lowercase) is a good practice...
/John

MultiLanguage NotesView Content in Xpages

I have realized a full Xpages application width > 200 Notes View..and for translate I use the native option "Localization options" into Xpages settings.
All work very well (can now write the translation into -proprierties)
But...
In some Notes View I have the content of some column with embedded #Formulas string in the original language or the date of my field in the format of Domino enviroment (ex. there are #text(datfield;"S0") that return italian format gg\mm\aaaa)
Can I mix the native Multilanguage Database Notes Option with Locazations Options feature?
With native Notes Multilanguage database, is need duplicate the view setting the correct language... but Xpages support this feature when render the object Notes View?
p.s. For native Notes multi-language read this Redbook from page 65
First of all I would try to eliminate all the #Text(datefield) entries from the views that you are working with. This will allow the both the notes clients and the ViewPanes in your Xpage applications to automatically display the date in the correct format for the viewer of the application.
Unfortunately, from my testing, it appears that you cannot mix the native multilingual database options with the XPages localization options.
You cannot mix up those two options, because Notes-based multilingual database option is a part of Notes Client architecture.
If I were you, I create seperate views for XPages application. It's really waste of resources in the mean time (migration phase) but it's the most optimized way I guess. Instead of conforming old-style views, you may redesign your views according to what you need.
For example, in XPages, you don't need many columns to be calculated within the index.
There is no great answer for that :(
I have found that the only solution is a routine JS client insert into
*AfterPageLoad* event with **view.postScript**(Function JS client)
and *AfterRestoreView* event with the same call **view.postScript**
convert on.fly the content of my view.
I select the content DOM of my Notes view with dojo.query

How to add text to any html element?

I want to add text to body element but I don't know how. Which method will work on the body tag?
Sorry for my english and thanks for replies.
In Watir, you can manipulate a web page (DOM) using JS, just like that:
browser.execute_script("document.getElementById('pageContent').appendChild(document.createTextNode('Great Success!'));")
I assume that the point of the question is:
All users are not just interacting by just clicking buttons and links on the web app, some of them are doing nasty things like altering http requests to make your system do something that it is not supposed to do... or to just have some fun.
To mimic this behavior, you could write a ui-test that alters forms on the web page, so that for example, one could type in anything into any field instead of a limited dropdown.
To do that, ui test has to:
manipulate DOM to set form inputs free of limitations (replace select's with input's, etc.)
ui test has to know, which values to use, in many cases it's pointless to enter random values. Your webapp has to provide some good "unwanted" options.
Why would you want to modify the webpage in Watir? It's for automated testing, not DOM manipulation.
If you want to add something to the DOM element in javascript, you can do it like that:
var txt = document.createTextNode(" This text was added to the DIV.");
document.getElementById('myDiv').appendChild(txt);
Or use some DOM manipulation library, like jQuery.
If you have not worked your way though the watir tutorial, I would suggest you do so. It deals with things like filling in text fields etc.
Learn to use the developer tools for your browser, Firebug for Firefox, or the built in tools for IE and CHrome. They will let you look at things as you interact with the site.
If the element is not a normal HTML input field of some sort, then you are dealing with a custom control. Many exist and they are varied and there is no one set solution for dealing with them. Without knowing which control you are using, and being able ourselves to interact with a sample of it, or at least see the HTML, it is very very difficult to advise you, we basically have to just guess (which is often a waste of everyone's time)
Odds are if you have a place you can enter text, then it is some form of input control, it might not start out that way, you may need to click on some other element, to make the input area appear, but without a sample of HTML all we can do is guess.
If this is a commercial control, see if you can find a demo site that shows the control in action. Try googling things like class names for the elements and often you get lucky

Lotus Notes: RichText Item

Okay, here's the deal. I am using C# with the Domino API. I have some rich text data that I want to insert into a lotus notes rich text field.
NotesDocument.ReplaceItemValue just inserts the text as is with no formatting.
NotesDocument.CreateRichTextItem gives me a NotesRichTextItem object that I can use for manually creating RichText (methods like AddNewLine() AddPageBreak() etc). But it does not have any kind of Parse method to get already formatted rich text data, which is what I need. I want my users to put whatever they want in there - so using the aforementioned methods is useless to me.
The NotesRichTextItem.Values object throws an error when I try to add a rich text formatted string.
So now, what do I do? I guess I'm pretty much screwed here, but hoping some genius will come up with a solution. Any help much appreciated.
Thanks guys!
PS - Inserting notes rich text data or HTML data would be fine. Either one would be just as good as long as it displays proper rich text in the document and not an unformatted string.
Well, I found an answer - it's not pretty, but it works! What I did was
Use the DXL Exporter to grab the xml
edit it (adding the rich text) and then
Delete the original document
Use the DXL importer to import the edited document
Voila! :-D
Thanks anyway for such a quick response :-)
Without knowing the details of your application, I'm not sure this would suffice. But you can store HTML as text within a Notes rich text field, and then in your Notes app display the field as "pass-through HTML". Downside is that you would not be able to do subsequent editing from the Notes client. Also, the HTML rendering engine within the Notes client is pretty poor, so you may not get anywhere near full fidelity.
If that doesn't meet your needs, you can always look into using the Notes C API (rather than the COM/API you are using). The lower level API does allow you to insert anything into a rich text field, but you will need to write the parser / converter yourself. Search for Composite Data (CD) records.
Here is a link to the API site: http://www14.software.ibm.com/webapp/download/nochargesearch.jsp?k=ALL&status=Active&q=Lotus+%22C+API%22
Does the API not provide you with access to the various rich text classes? Perhaps they could help? For example, there are classes for NotesRichTextStyle, NotesRichTextNavigator, NotesRichTextSection, NotesRichText, and so on and so forth.

Resources