Check out the great presentation with Guy Kawasaki

This is the opening session from IBM Connect 2012 but the best part is Guy Kawasaki
So if you don’t want to see everything you should fastforward until 37 minutes into the show

Watch live streaming video from ibmsoftware at livestream.com
There is also another interview with him, great stuff.

ibmsoftware on livestream.com. Broadcast Live Free

Standby Custom control what does it do

I have added my first XSnippet today and it’s the Standby custom control.
If you add the code to a custom control and drag in into an XPage all events done in this XPage will be intercepted and if the event taks more than 200 milli seconds the dojo standby widget will show up and prevent the user from clicking.

 

http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control 

 

Some of the code were originally created by two great XPage guys
Tommy Valand and Serdar Başeğmez 

Lotusphere Live Stream

Watch the Lotusphere 2012 live stream here

Watch live streaming video from ibmsoftware at livestream.com


How to prevent databaseName to change datasource

Sven HasselBach blogged (Link) about that you could change the datasource of any XPage using a url parameter called databaseName. Doesn’t ACL apply you might ask. Yes it does so that isn’t a problem.
OK, isn’t there a setting to ignore url parameters, yes there are but If you use this you will get problems with the built in controls. They use url parameters.

Is this a problem then ACL apply shouldn’t that be enought?
No because there might be some databases where the user should be able to create documents in.
and this could create documents of a certain type in a database were they shouldn’t be.  

To prevent the use of the databaseName parameter I have created this code that you can place in the onClientLoad event in a customcontrol or directly in an XPage

if(context.getUrl().hasParameter("databaseName")){
 var url=context.getUrl()
 url.removeParameter("databaseName")
 context.redirectToPage(url.toString(),true)
} 

New version of TinyMce integration for XPages

Version 1.1 of the TinyMce custom control for XPages is released today.

This version contains a fix so the 64K limit is now fixed and also a new option 

TinyMcePath is added to be able to add a url that is server wide. And to simplify upgrade of the editor.

Url to the control at openntf.org


 

 

 

 

 

 

 

 

TinyMce RichText Editor integration in XPages

I have created a Tinymce integration custom control for XPages.

Why is this a good thing?
Well this means that you can edit richtext in XPages both on the web, the Notes Client and it works with IPhone,IPad with IOS5.
You do not need to rely on when a new version of Domino is released. New versions of Tinymce is released more often than Domino releases.

It has alot of features that the Domino RT editor don’t. The custom control is lacking one thing in this version but I believe that this can be done in the future and that is image upload support. Another thing that is giving me a headache is Backend Richtext support and this 64K. If I add html using Richtextitem.appendtext the help states that it will automatically add a paragraphs if the content is larger than 35K. What happends it cuts the appended text at 64K 🙁
2011 and we have restrictions in Domino that is from 1995, Please IBM build a RichText version 2 and it don’t have to be compatible with version 1 so we can drop all these restrictions. 

It’s released here at openntf.org

Flattr custom control released

Today I have released another custom control on openntf.org

It’s the Flattr control this control makes it simple to add a flattr buttons to your webpages created with XPages. And get micro payments from flattr users that likes what you or your customers do. 

 

 

 

 

 

 

 

QR Code Custom control is released

URL QR Codes for you web applications just got very easy.

Just drag and drop add your URL, and you got a QRCode and they work in the Client too.

Link to the Project at OpenNTF.org

 

 

 

 

 

 

 

 

 

Load once functionality for client js script libs

If you have a custom control and this control can be added more that once on a page.
You will probably get problems if it relies on some clientside libraries.

There is at least three ways to this problem.

1. Don’t add the client lib to the Custom Control add it to the XPage instead
Is  this a good approach, no I don’t think so because you need to remember to add it, and also update it.

2. Add it in a theme globally
If you do it this way your library will always be added to all pages even if you do not need it.

3. Add it inside the Custom Control
This is the best approach in my opinion   

Just add a computed text to your custom control

Add this code to check a requestScope var if it has a value if not add script lib.

if(requestScope.loadonce==null){
requestScope.loadonce="Y"
return "<script type=\"text/javascript\" src=\"clientscript.js\"></script>"
}

 You could evolve this code by inserting it into the head tag but It will work. 

@TextToNumber Decimal Warning

If you run this formula in traditional Domino

@Text(@TextToNumber(“20,40”)*2)

You will get 80,40 back into the field

But if you run this in some XPage Code you will get

0

Why is this you might ask, well probably because javascript do not recognize comma as a decimal delimiter

So you need to change the formula to this.

@Text(@TextToNumber(@ReplaceSubstring(“20,40″,”,”,”.”))*2)

Then you will get 40,8 back. Not that when you do @Text() on the number the comma is back 😉