Using KFM as a standalone file browser

It is not necessary for KFM to be used through an RTE such as FCKeditor. You can attach KFM directly to your own CMS if you want.

A while back, when I was still working on using and expanding FCKeditor's built-in file manager, I wrote an article describing how its file manager could be used on its own, outside the scope of FCKeditor.

The same method can be used to create a standalone version of KFM.

Demo

In the demo, I provide a webpage with just an input box on it. You can populate this input box with the URL of a file on your server simply by clicking on the box.

How it works

Upon loading, a small script is run which finds all elements which have the classname "kfm". Every one of these elements then has an onclick event attached, which replaces the element's value parameter with the URL of a file retrieved from the KFM.

Here is the code which is run upon page load:

function init(){
var els=document.getElementsByTagName('*');
var reg=/(^| )kfm($| )/;
for(i in els){
var el=els[i];
if(reg.test(el.className))el.onclick=function(){
window.SetUrl=(function(id){
return function(value){
value=value.replace(/[a-z]*:\/\/[^\/]*/,'');
document.getElementById(id).value=value;
}
})(this.id);
var kfm_url='/kfm/';
window.open(kfm_url,'kfm','modal,width=600,height=400');
}
}
}

Simple, innit!

If there are any questions about this, please email me. I really must get around to adding the ability to comment on things, to this CMS.

this project maintained by
Kae Verens
net applications developer for
webworks.ie

help keep KFM free