Skip to content

Commit

Permalink
Ability to open FM in modal window (closing issue #205)
Browse files Browse the repository at this point in the history
  • Loading branch information
simogeo committed Apr 23, 2014
1 parent c8629c1 commit e0bf089
Show file tree
Hide file tree
Showing 24 changed files with 90 additions and 47 deletions.
30 changes: 25 additions & 5 deletions scripts/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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'] != ''){
Expand All @@ -601,7 +610,9 @@ var selectItem = function(data) {
}
}

window.close();
if (window.opener) {
window.close();
}
} else {
$.prompt(lg.fck_select_integration);
}
Expand Down Expand Up @@ -1183,7 +1194,7 @@ var getFileInfo = function(file) {
var template = '<div id="preview"><img /><h1></h1><dl></dl></div>';
template += '<form id="toolbar">';
template += '<button id="parentfolder">' + lg.parentfolder + '</button>';
if($.inArray('select', capabilities) != -1 && (window.opener || window.tinyMCEPopup || $.urlParam('field_name'))) template += '<button id="select" name="select" type="button" value="Select">' + lg.select + '</button>';
if($.inArray('select', capabilities) != -1 && ($.urlParam('CKEditor') || window.opener || window.tinyMCEPopup || $.urlParam('field_name'))) template += '<button id="select" name="select" type="button" value="Select">' + lg.select + '</button>';
if($.inArray('download', capabilities) != -1) template += '<button id="download" name="download" type="button" value="Download">' + lg.download + '</button>';
if($.inArray('rename', capabilities) != -1 && config.options.browseOnly != true) template += '<button id="rename" name="rename" type="button" value="Rename">' + lg.rename + '</button>';
if($.inArray('move', capabilities) != -1 && config.options.browseOnly != true) template += '<button id="move" name="move" type="button" value="Move">' + lg.move + '</button>';
Expand Down Expand Up @@ -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('<button id="close-btn" type="button">' + lg.close + '</button>');

$('#close-btn').click(function () {
parent.CKEDITOR.tools.callFunction($.urlParam('CKEditorCleanUpFuncNum'));
});
}

/** Input file Replacement */
$('#browse').append('+');
$('#browse').attr('title', lg.browse);
Expand Down
85 changes: 43 additions & 42 deletions scripts/filemanager.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions scripts/languages/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Cancel·lar",
"close": "Close",
"confirmation_delete": "Estàs segur de voler eliminar aquest arxiu?",
"could_not_retrieve_folder": "No s'ha pogut recuperar el contingut de la carpeta.",
"create_folder": "Crear una carpeta",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Procházet...",
"bytes": " bajtů",
"cancel": "Zrušit",
"close": "Close",
"confirmation_delete": "Jste si opravdu jistí, že chcete smazat tuto položku?",
"could_not_retrieve_folder": "Došlo k chybě při načítání obsahu adresáře.",
"create_folder": "Vytvořit adresář",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/da.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Annullér",
"close": "Close",
"confirmation_delete": "Er du sikker på du ønsker at slette filen?",
"could_not_retrieve_folder": "Var ude af stand til at modtage mappens indhold.",
"create_folder": "Opret mappe",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Abbruch",
"close": "Close",
"confirmation_delete": "Möchtest Du wirklich diese Datei löschen?",
"could_not_retrieve_folder": "Konnte Ordnerinhalt nicht lesen.",
"create_folder": "Ordner erstellen",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/en-gb.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Cancel",
"close": "Close",
"confirmation_delete": "Are you sure you wish to delete this file?",
"could_not_retrieve_folder": "Could not retrieve folder contents.",
"create_folder": "Create Folder",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"current_folder": "Current folder: ",
"default_foldername": "My folder",
"del": "Delete",
"close": "Close",
"dimensions": "Dimensions",
"download": "Download",
"fck_select_integration": "The 'Select' function is only used for integration with FCKEditor.",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Cancelar",
"close": "Close",
"confirmation_delete": "¿Estás seguro de eliminar este archivo?",
"could_not_retrieve_folder": "No se ha podido recuperar el contenido de la carpeta.",
"create_folder": "Crear carpeta",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " tavua",
"cancel": "Peruuta",
"close": "Close",
"confirmation_delete": "Oletko varma, että haluat poistaa kyseisen tiedoston?",
"could_not_retrieve_folder": "Ei voitu lukea hakemiston sisältöä.",
"create_folder": "Luo hakemisto",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Parcourir...",
"bytes": " octets",
"cancel": "Annuler",
"close": "Fermer",
"confirmation_delete": "Etes-vous sûr de vouloir supprimer ce fichier?",
"could_not_retrieve_folder": "Le contenu du dossier est inaccessible.",
"create_folder": "Créer un dossier",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/he.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "ביטול",
"close": "Close",
"confirmation_delete": "?האם אתה בטוח שברצונך למחוק קובץ זה",
"could_not_retrieve_folder": "לא ניתן לקרוא את תוכן התיקייה",
"create_folder": "צור תיקייה",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " byte",
"cancel": "Mégse",
"close": "Close",
"confirmation_delete": "Biztosan törölni szeretné a kijelölt fájlt?",
"could_not_retrieve_folder": "A mappa tartalmát nem lehet megjeleníteni.",
"create_folder": "Új mappa",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Sfoglia...",
"bytes": " bytes",
"cancel": "Annulla",
"close": "Close",
"confirmation_delete": "Sei sicuro di voler eliminare il file?",
"could_not_retrieve_folder": "Impossibile visualizzare il contenuto della cartella.",
"create_folder": "Crea cartella",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": "バイト",
"cancel": "キャンセル",
"close": "Close",
"confirmation_delete": "本当にこのファイルを削除してもいいですか?",
"could_not_retrieve_folder": "フォルダーの内容を検索できませんできた.",
"create_folder": "フォルダーを作成",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Bladeren...",
"bytes": " bytes",
"cancel": "Annuleren",
"close": "Close",
"confirmation_delete": "Weet je zeker dat je dit bestand wilt verwijderen?",
"could_not_retrieve_folder": "Kon map-inhoud niet ophalen.",
"create_folder": "Nieuwe Map",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Anuluj",
"close": "Close",
"confirmation_delete": "Czy na pewno chcesz usunąć wybrany plik?",
"could_not_retrieve_folder": "Nie udało się otworzyć folderu.",
"create_folder": "Utwórz folder",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Cancelar",
"close": "Close",
"confirmation_delete": "Tem certeza que deseja excluir este arquivo?",
"could_not_retrieve_folder": "Não foi possivel ler o conteúdo da pasta.",
"create_folder": "Criar Pasta",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "...",
"bytes": " байт",
"cancel": "Отмена",
"close": "Close",
"confirmation_delete": "Вы уверены, что хотите удалить этот файл?",
"could_not_retrieve_folder": "Не могу получить содержимое папки.",
"create_folder": "Создать папку",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Avbryt",
"close": "Close",
"confirmation_delete": "Är du säker på att du vill radera filen?",
"could_not_retrieve_folder": "Kan ej läsa mappens innehåll.",
"create_folder": "Skapa mapp",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bayt",
"cancel": "İptal",
"close": "Close",
"confirmation_delete": "Dosyayı silmek istediğnizden emin misiniz?",
"could_not_retrieve_folder": "Klasör içerikleri getirilemiyor.",
"create_folder": "Klasör Oluştur",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/vn.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "Hủy bỏ",
"close": "Close",
"confirmation_delete": "Bạn chắc chắn muốn xóa tập tin này?",
"could_not_retrieve_folder": "Không lấy được nội dung thư mục.",
"create_folder": "Tạo thư mục",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/zh-cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "取消",
"close": "Close",
"confirmation_delete": "你确定要删除这个文件吗?",
"could_not_retrieve_folder": "无法取得文件夹的内容。",
"create_folder": "创建文件夹",
Expand Down
1 change: 1 addition & 0 deletions scripts/languages/zh-tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"browse": "Browse...",
"bytes": " bytes",
"cancel": "取消",
"close": "Close",
"confirmation_delete": "確定刪除檔案?",
"could_not_retrieve_folder": "無法取得目錄內容",
"create_folder": "建立目錄",
Expand Down

0 comments on commit e0bf089

Please sign in to comment.