Personal tools
User Handbook/Admin Panel/Content/kfm
From CMSMS
KFM File Manager
KFM File Manager is a module that adds the KFM File Manager ([1]) to the CMS Made Simple system. You can do a number of settings. The main settings panel applies to all KFM windows, the WYSIWYG settings apply only to the KFM window when used for WYSIWYG editors in the CMSms system. Here you can specify the rights that site editors have when having the File Manager.
Contents |
Add KFM to TinyMCE
Here is my implementation described. Not tested very well yet.
edit the modules/TinyMCE/tinyconfig.php
add somewhere at the top of the document:
$usekfm = false;
if(isset($modules['kfm'])){ // && parameters['file_manager']=='kfm'
print $modules['kfm']['object']->GetTinyMCEcallback();
$usekfm = true;
}
Change the $plugins parameter to:
$plugins="cmsmslink,fullscreen,advimage,paste,advlink"; if(!$usekfm)$plugins.=',simplebrowser';
and replace file_browser_callback: with:
file_browser_callback : '<?php print $usekfm?$modules['kfm']['object']->TinyMCEcallback:'TinyMCE_SimpleBrowserPlugin_browse'; ?>',
I hope this works, and maybe is implemented in the TinyMCE modules in some way.
Good luck with it.
Add to Dojo editor
This is a bit ugly fix, I hope it will be improved by me or people that know more about some functions but here the steps. 1) replace the content of the action.browsepictures.php with a redirect to the kfm browser. example:
<?php
global $gCms;
$config =& $gCms->GetConfig();
header("Location: ".$config['root_url'].'/modules/kfm/kfm/index.php?environment=wysiwyg');
?>
2) Add the callback to the action.defaultadmin.php file somewhere at the top (not required):
if(isset($gCms->modules['kfm'])){ // && parameters['file_manager']=='kfm'
print $gCms->modules['kfm']['object']->GetDojoCallback();
}
3) Add the callback to the DojoEditor.module.php file at the end of the WYSIWYGGenerateHeader function. example:
function WYSIWYGGenerateHeader()
...
...
if(isset($gCms->modules['kfm'])){ // && parameters['file_manager']=='kfm'
$output.=$gCms->modules['kfm']['object']->GetDojoCallback();
}
return $output;
}
Suggestions for improvement are most welcome, but don't claim it can't be done :) ps. The DojoCallback function is present in the first kfm release after version 0.2.3. Do not try this with this version or before. If you want to implement it now ask me.
Use KFM ad file selector for your own module
Adding KFM as file selector for your own module requires you to do two steps.
- Creating a SetUrl function on the page where the selected url should be returned.
- Open a window with the url to KFM and give as parameter environment=wysiwyg
An example I used for implementation with tinyMCE is:
window.SetUrl=function(url){
document.getElementById('id_of_url_field').value = url;
}
window.open("/modules/kfm/kfm/index.php?environment=wysiwyg","kfm","modal,width=800,height=600");
I think this is a clear example. I recommend to add $gCms->config['root_url'] in front of the url.
