diff --git a/scripts/filemanager.js b/scripts/filemanager.js index 99a0e864..bc381b54 100644 --- a/scripts/filemanager.js +++ b/scripts/filemanager.js @@ -122,6 +122,8 @@ var setDimensions = function(){ var bheight = 20; if(config.options.searchBox === true) bheight +=33; + + if($.urlParam('CKEditorCleanUpFuncNum')) bheight +=60; var newH = $(window).height() - $('#uploader').height() - bheight; $('#splitter, #filetree, #fileinfo, .vsplitbar').height(newH); @@ -557,7 +559,7 @@ var selectItem = function(data) { var url = relPath + data['Path']; } - if(window.opener || window.tinyMCEPopup || $.urlParam('field_name')){ + if(window.opener || window.tinyMCEPopup || $.urlParam('CKEditorCleanUpFuncNum') || $.urlParam('CKEditor')) { if(window.tinyMCEPopup){ // use TinyMCE > 3.0 integration method var win = tinyMCEPopup.getWindowArg("window"); @@ -587,8 +589,15 @@ var selectItem = function(data) { } else if($.urlParam('CKEditor')){ - // use CKEditor 3.0 integration method - window.opener.CKEDITOR.tools.callFunction($.urlParam('CKEditorFuncNum'), url); + // use CKEditor 3.0 + integration method + if (window.opener) { + // Popup + window.opener.CKEDITOR.tools.callFunction($.urlParam('CKEditorFuncNum'), url); + } else { + // Modal (in iframe) + parent.CKEDITOR.tools.callFunction($.urlParam('CKEditorFuncNum'), url); + parent.CKEDITOR.tools.callFunction($.urlParam('CKEditorCleanUpFuncNum')); + } } else { // use FCKEditor 2.0 integration method if(data['Properties']['Width'] != ''){ @@ -601,7 +610,9 @@ var selectItem = function(data) { } } - window.close(); + if (window.opener) { + window.close(); + } } else { $.prompt(lg.fck_select_integration); } @@ -1183,7 +1194,7 @@ var getFileInfo = function(file) { var template = '

'; template += '
'; template += ''; - if($.inArray('select', capabilities) != -1 && (window.opener || window.tinyMCEPopup || $.urlParam('field_name'))) template += ''; + if($.inArray('select', capabilities) != -1 && ($.urlParam('CKEditor') || window.opener || window.tinyMCEPopup || $.urlParam('field_name'))) template += ''; if($.inArray('download', capabilities) != -1) template += ''; if($.inArray('rename', capabilities) != -1 && config.options.browseOnly != true) template += ''; if($.inArray('move', capabilities) != -1 && config.options.browseOnly != true) template += ''; @@ -1497,6 +1508,15 @@ $(function(){ $('#itemOptions a[href$="#delete"]').append(lg.del); } + /** Adding a close button triggering callback function if CKEditorCleanUpFuncNum passed */ + if($.urlParam('CKEditorCleanUpFuncNum')) { + $("body").append(''); + + $('#close-btn').click(function () { + parent.CKEDITOR.tools.callFunction($.urlParam('CKEditorCleanUpFuncNum')); + }); + } + /** Input file Replacement */ $('#browse').append('+'); $('#browse').attr('title', lg.browse); diff --git a/scripts/filemanager.min.js b/scripts/filemanager.min.js index 1040a2e8..e1121182 100644 --- a/scripts/filemanager.min.js +++ b/scripts/filemanager.min.js @@ -8,8 +8,8 @@ e);b.hasClass("cap_select")||a(".select",c).remove();b.hasClass("cap_download")||a(".download",c).remove();b.hasClass("cap_rename")||a(".rename",c).remove();b.hasClass("cap_move")||a(".move",c).remove();a(".replace",c).remove();b.hasClass("cap_delete")||a(".delete",c).remove();a("#itemOptions").after(c)}return e}a.urlParam=function(a){return(a=RegExp("[\\?&]"+a+"=([^&#]*)").exec(window.location.href))?a[1]:0};var D=function(b){var e=null;a.ajax({async:!1,url:"user"==("undefined"===typeof b?"user": b)?"./scripts/filemanager.config.js":"./scripts/filemanager.config.js.default",dataType:"json",cache:!1,success:function(a){e=a}});return e},O=D("default"),g=D(),g=a.extend({},O,g);HEAD_included_files=[];loadCSS=function(b){if(-1==a.inArray(b,HEAD_included_files)){var e=a("");a("head").append(e);HEAD_included_files.push(b)}};loadJS=function(b){if(-1==a.inArray(b,HEAD_included_files)){var e=a("