CKEditor image upload fails when datasource is passed to custom control

When I use the ckeditor on a XPage the image upload works like a charm. However when I use the ckeditor in a custom control and I pass the datasource-document to it in a custom property then the image upload fails. I pass the datasource-document using the technique described by John Mackey: サッカー ユニフォーム 安い – xpagesblog.com | 安いジャージを買う。 21.99 という安いジャージ。 ファンに最高のコレクションを提供します。 安心してお買い物をしてください。

I tried passing the datasource in a custom property of type ModelDataSource as wel as type DocumentDataSource.

Any suggestions for possible solutions are most welcome!

Subject: CKEditor

Odd. I can’t get the inline image uploader to work at all well. Re you using the standard CKEditor?

Subject: Solution

Hi, I had a similar problem (with RT-Field inside a repeat control).

Create a separate RT-Field, set your datasource, set rendered=“false” to hide it.

Now open the xspCKEditor.js file. You find it here \IBM\Lotus\Domino\data\domino\js\dojo-1.4.3\ibm\xsp\widget\layout.

Your dojo version can differ.

In the code you find these lines or similar.

var url = document.location.href.substring(0, document.location.href.indexOf(‘?’));

if(null != url){

this.filebrowserImageUploadUrl = url +

"?$$axtarget=" + _14.id +

"&$$viewid=" + XSP.findForm(_14.id)["$$viewid"].value +

"&command=QuickUpload&type=Images&SessionID=" + readCookie("SessionID");

}

Here is my solution. It works fine for me. Maybe you have to adjust the code to your case.

var url = document.location.href.substring(0, document.location.href.indexOf(“?”));

var xpage = (url.match(//\w+.xsp/)+“”).substring(1);

var axtarget = _14.id;

if (null != url) {

switch (xpage) {

	case "MyXPage.xsp":

		axtarget = "view:_id1:_id2:_id79:_id106:inputRichTextTEMP";

		break;

}		

this.filebrowserImageUploadUrl = url +

"?$$axtarget=" + axtarget +

"&$$viewid=" + XSP.findForm(_14.id)["$$viewid"].value +

"&command=QuickUpload&type=Images&SessionID=" + readCookie("SessionID");

}

axtarget → var for the parameter comes from the parent function (in my case it is _14).

You have to set it to the (front-end)-id of the RT-Field you created.

Hope I could help you.