Tag Archives: Custom Control

XSnippet Standby Dialog updated on openntf.org

My xSnippet component on openntf.org Standby Dialog Custom control is updated

After some reports about that the previous version of standby dialog didn’t work with older browsers like IE8

I had some time today and investigated and fixed the problem.

This release 3.2 is tested in IE8, IE10 with and without compability mode, Chrome 29, Chrome Canary 31, Firefox 22 and 23

So I hope this is the most tested and working version of the standby dialog control.

And with the fixes between version 3.1 and 3.2 with checks for previous inits for the hijack functionallity it will be more compatible with other customcontrols.

The new version is available thru xSnippets –> Link

Also available as an database download with a test page –> Link

Hide the XPage name in the url, get better web urls.

There is a simple way of hiding the XPage name. Autolaunch an XPage using the database properties.

Notes Autolaunch Tab

But there is a catch, it will only work for the first XPage so if you navigate way to another xpage the magic is gone. there is also another catch the relative path is broken so you need to add a trailing slash. Prev post about that

But that isn’t a problem when you are using XPages so If you build your main XPage and open it using auto launch options, and load the different sub pages / custom controls using partial refresh and the rendered property, the switch control or another control that can load content using a partial refresh.

Also you need to add a trailing slah at the end of the url otherwise you will get problem with dead images and resources not loading.

Your page should work as expected anyway, enjoy.

Some minor updates to SmallTalk and TinyMce editor

I have today released some small updates to SmallTalk and the tinyMce editor custom control.

SmallTalk needed some polishing to the attachment upload working in the client.

And for the tinyMce control I did some changes in the init scripts because they gave some strange js
errors in older internet explorer browsers so now it should work in IE7 also.

Enjoy 

Standby Widget v2 is now on XSnippet – openntf.org

I’ve updated the standby widget on openntf.org after seeing some problems after upgading to 8.5.3

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

Creds goes to Serdar Başeğmez and Tim Tripcony who found a solution, thanks!!

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 

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


 

 

 

 

 

 

 

 

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. 

 

 

 

 

 

 

 

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.