DFM for PHP
Product: Drupella File Manager for PHP
CKEditor Integration
Custom Input Integration
Source for CKEditor Integration:
<script type="text/javascript" src="//cdn.ckeditor.com/4.5.2/standard/ckeditor.js"></script>
<textarea id="ck-demo"></textarea>
<script type="text/javascript">
// Load dfm plugin.
CKEDITOR.plugins.addExternal('dfm', '/dfm_php/wysiwyg_plugins/ckeditor/', 'plugin.js');
// Settle
CKEDITOR.replace('ck-demo', {
extraPlugins: 'dfm',
toolbar: [['Image', 'Link', '-', 'Bold', 'Italic', 'Underline', '-', 'DfmImage', 'DfmFile']],
// Also integrate into image/link dialogs.
filebrowserBrowseUrl: '/dfm_php?fileHandler=dfmCkeHandler'
});
// Define the url handler
window.dfmCkeHandler = function(File, dfmWindow) {
CKEDITOR.tools.callFunction(dfmWindow.dfm.urlParam('CKEditorFuncNum'), File.getUrl());
dfmWindow.close();
};
</script>
Source for Input integration:
<input type="text" id="my-url-input" size="32" style="line-height: 1.6em; width: 100%;"/> <a href="/dfm_php?fileHandler=myDfmFileHandler" onclick="window.open('/dfm_php?fileHandler=myDfmFileHandler', '', 'width=800,height=520,resizable=1'); return false;">Select File</a>
<script type="text/javascript">
// Custom input handler
window.myDfmFileHandler = function(File, dfmWindow) {
document.getElementById('my-url-input').value = File.getUrl();
dfmWindow.close();
};
</script>