Friday, September 28, 2012

CKFinder for Domino. First step.

I am trying to get CKFinder to work with Domino.

I saw the post "ckeditor 3.2, ckfinder 1.4.3 and Domino" but it is unavailable 2nd day, so I am looking himself in to this point.

First problem

CKFinder add some command to the end of it's URL, that domino server do not like:
 "?t=XYZ".  

Just remove it:
open ckfinder.js, look for something like "f={jY:'C7OA1WG',_:{}," and replace it on "f={_:{}," (delete jY:'C7OA1WG')

CKFinder also use command syntax like "?command=..". It's also a little trouble for domino.

Replace "?command=.." to "?Open&command=.." in the ckfinder.js

Second problem

I am trying to create server side command handlers for CKFinder.
"INIT" command example"

<?xml version="1.0" encoding="utf-8"?>
<Connector>
<Error number="0" />
<ConnectorInfo enabled="true" s="" c="" thumbsEnabled="true"  
thumbsUrl="/userfiles/_thumbs/" thumbsDirectAccess="false" />
<ResourceTypes>
<ResourceType name="Files" url="/userfiles/files/" 
allowedExtensions="7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif" 
deniedExtensions="" defaultView="Thumbnails" hash="654e8f3600949355"  
hasChildren="true" acl="17" />
<ResourceType name="Images" url="/userfiles/images/"  
allowedExtensions="bmp,gif,jpeg,jpg,png" 
deniedExtensions="" defaultView="Thumbnails" hash="4d8ddfd385d0952b" 
hasChildren="true" acl="17" />
<ResourceType name="Flash" url="/userfiles/flash/"  
allowedExtensions="swf,flv" 
deniedExtensions="" defaultView="Thumbnails" hash="a2d473ff04429cc5" 
hasChildren="true" acl="17" />
</ResourceTypes>
</Connector>

This example born errors in real life:

Error:
TypeError: t.selectSingleNode(v + "@imgWidth") is null

Fix:
"Connector/ConnectorInfo" node must have "imgWidth" attribute (as well as "imgHeight") in the command "init" resonse

Error:
TypeError: t.getNamedItem("maxSize") is null

Reason:
"Connector/ResourceTypes/ResourceType" node must have "maxSize" attribute in the command "init" resonse

So the correct "INIT" response must be like

<?xml version="1.0" encoding="utf-8"?>
<Connector>
<Error number="0" />
<ConnectorInfo imgHeight="100" imgWidth="100" enabled="true" s="" c=""  
thumbsEnabled="true" thumbsUrl="/userfiles/_thumbs/" 
thumbsDirectAccess="false" />
<ResourceTypes>
<ResourceType name="Files" url="/userfiles/files/"  
allowedExtensions="7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif" 
deniedExtensions="" defaultView="Thumbnails" hash="654e8f3600949355"  
hasChildren="true" acl="17"  maxSize="100"/>
<ResourceType name="Images" url="/userfiles/images/"  
allowedExtensions="bmp,gif,jpeg,jpg,png" 
deniedExtensions="" defaultView="Thumbnails" hash="4d8ddfd385d0952b" 
hasChildren="true" acl="17" maxSize="100"/>
<ResourceType name="Flash" url="/userfiles/flash/" 
allowedExtensions="swf,flv" 
deniedExtensions="" defaultView="Thumbnails" hash="a2d473ff04429cc5"  
hasChildren="true" acl="17" maxSize="100"/>
</ResourceTypes>
</Connector>

Thursday, September 27, 2012

CKFinder in Domino

I need to add some image library to use it with CKEditor in domino.

The best I found is CKFinder (it is not free). I did not find a good media library for build it up on the Domino.

CKFinder also have some troubles in the case of  work with Domino.

Do someone know a good media library?  I would prefer some client side library that communicate with server through  JSON or XML (like CKFinder).

Maybe some one have a nice experience with CKFinder on Domino ?

Tuesday, September 25, 2012

xPage in DXL

Domino export xPage's (java area, libs, xPages actually) in to DXL as base64 with some pre header.  This does not allow to change DXL and import it back. More of then, extracting real base64 become hard task because there is no any information about that "pre-header" in DXL.

I found similar question on the stackoverflow: http://stackoverflow.com/questions/9929325/encoding-scheme-for-ssjs-library-when-exported-via-dxl

Sunday, September 23, 2012

Export Design DXL

Export design DXL feature has been added to the DominoJavaSyncer:

https://github.com/andriykuba/DominoJavaSyncer/wiki/Export-design-DXL

Orphaned agent data in Notes 8.5

I have export of DXL from my database and found many orphaned agent data. It's "agentdata" tag that does not follow "agent" tag.

First of all I check help: Note also that the agentdata element immediately follows the agent element, but is not contained by it.

Second - look for a possible problem and solution. Take attention, "In order for the utility to clean up orphaned Agent Data Notes, you must have at least one LotusScript agent in the database.". I spend half of our until detect this. 


Friday, September 21, 2012

How to print any data in XPage output

I was looking for a solution for output clean data in xPage without any tags.

Nice solution is present in the first comment to this post. In the case you need few xPage with output special data, better to create special base class and then just extend it.

More under cut.

Accessing XPages global objects in Java (extended)

There is nice post "Accessing XPages global objects in Java". There is a little more information about returned objects.

It's a good idea to create some base class to extend it for all classes that need access to global xPage objects.

So I take variables from that articles and add Request and Response objects also.

Look more for the source.

Monday, September 17, 2012

Synchronize database resources with folders

The task I have was to update CKEditor that we have in our app.

And yes - there is not possible to use server file system for me, only nsf.

A long time ago (1 year) I was upload CKEditor using WebDAV. There is only way that store folder structure in the file names of resources in .nsf. This days configuration of WebDAV was not allowed for me (yes, I have very strict access to the server) . So I need to install local (development) domino server, configure WebDAV, upload files, do copy of database with uploaded files on the main server .....

To much work, and what if I would need it again in few month ?

So I decide to wide my Domino Java Syncer utility to do image\css\file synchronization.

You could use it if you have similar task.

In a short:


  

Friday, September 7, 2012

How to use Velocity in xPages

We are using velocity in our project for build some HTML fro some templates.

There was a problem with using it in the Java libraries. Look at this post to find problem description and solution.

Now we want to use velocity in the xPage context. There is also a little trouble:

at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at java.lang.Thread.getContextClassLoader(Thread.java:456)
at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:68)


This problem could be resolved  by adding next string in to the java.policy:

permission java.lang.RuntimePermission "getClassLoader";

We could not edit java.policy unfortunately. So we resolve it in the next way.

1. Download velocity source

2. Find place of error (at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:68)):
ClassLoader loader = Thread.currentThread().getContextClassLoader();

3. Replace this string with the xPage classloader initialization:
ClassLoader cl = com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent().getModule().getModuleClassLoader();

4. Add appropriate library for compile velocity source with this new class.  You will need
Domino\osgi\shared\eclipse\plugins\com.ibm.xsp.domino_8.5.3.20110915-2025\lwpd.xsp.domino.jar
or similar

5. Compile new velocity jar from modified source.

Well done! You could upload velocity jar in to the WebContent\WEB-INF\lib and use it in the xPage context.

Domino Java Syncer Documentation

I moved documentation from the document format in to the wiki. So you could find actual documentation on the git hub wiki


Thursday, September 6, 2012

xPage CKEdior: how to remove language direction attribute?

in-build CKEditor in xPage (Domino 8.5.3) always add dir attribute to the text container's tags, like P or H2.  

For example:
<p dir="ltr">test</p>

I could change direction "ltr" or "rtl" from the Rich Text Element settings or CKEditor custom config, but I could not remove this attribute at all.

If I use trivial CKEditor, the this attribute absent until I special set up contentsLangDirection property.

So It looks like xPage force this attribute to be set in any case.

Does some one know how to remove it from the in-build CKEditor in xPage ?

Domino Java Syncer on the Github


I was commite source of Domino Java Syncer to the Github:
https://github.com/andriykuba/DominoJavaSyncer

There is also new functionality - import\export JavaScrip libraries as projects in to the Eclipse.

So version is up to 3 now. New documentation would be published later