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>

No comments: