From 32b934fe6df1de52e782d309fdd385462498f071 Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Mon, 27 Jul 2009 20:20:19 +0200 Subject: [PATCH] [svn r22389] FS#2867 - The online editor, the simple file manager, the Image manager: Implementing a dialog for ceation of new folders. --- .../browser/default/frmcreatefolder.html | 34 +++++++++- .../plugins/ImageManager/assets/images.js | 9 ++- .../plugins/ImageManager/assets/manager.js | 23 +++++++ .../editor/plugins/prompt/fck_prompt.html | 68 +++++++++++++++++++ .../editor/plugins/prompt/fckplugin.js | 53 +++++++++++++++ main/inc/lib/fckeditor/myconfig.js | 1 + main/inc/lib/fckeditor/myconfig.php | 4 ++ 7 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 main/inc/lib/fckeditor/editor/plugins/prompt/fck_prompt.html create mode 100644 main/inc/lib/fckeditor/editor/plugins/prompt/fckplugin.js diff --git a/main/inc/lib/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html b/main/inc/lib/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html index 804fc2a777..3bd213e971 100644 --- a/main/inc/lib/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html +++ b/main/inc/lib/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html @@ -29,7 +29,9 @@ diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/images.js b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/images.js index dfa3c889e8..d4a7951c79 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/images.js +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/images.js @@ -21,7 +21,14 @@ function newFolder(dir, newDir) { - location.href = "images.php?dir="+dir+"&newDir="+newDir; + if ( !window.parent.opener && window.parent.oEditor ) + { + location.href = window.parent.oEditor.FCKConfig.PluginsPath + 'ImageManager/images.php?dir=' + dir + '&newDir=' + newDir ; + } + else + { + location.href = 'images.php?dir=' + dir + '&newDir=' + newDir ; + } } //update the dir list in the parent window. diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js index b3d173da4f..ed0e8ad70b 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/assets/manager.js @@ -315,6 +315,29 @@ var selection = document.getElementById('dirPath'); var dir = selection.options[selection.selectedIndex].value; + if ( !window.opener && window.parent && oEditor ) + { + if ( oEditor.FCK.Plugins.IsLoaded && oEditor.FCK.Plugins.IsLoaded( 'prompt' ) ) + { + oEditor.FCKDialog.Prompt( i18n( 'Folder Name:' ), '', + function( folder ) + { + if (folder == thumbdir) + { + alert(i18n('Invalid folder name, please choose another folder name.')); + return false; + } + + if (folder && folder != '' && typeof imgManager != 'undefined') + { + imgManager.newFolder(dir, encodeURI(folder)); + } + }, + i18n( 'New Folder' ) ) ; + return ; + } + } + Dialog("newFolder.html", function(param) { if (!param) // user must have pressed Cancel diff --git a/main/inc/lib/fckeditor/editor/plugins/prompt/fck_prompt.html b/main/inc/lib/fckeditor/editor/plugins/prompt/fck_prompt.html new file mode 100644 index 0000000000..2d258d91c6 --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/prompt/fck_prompt.html @@ -0,0 +1,68 @@ + + + + + + + + + + + +
+
+ +
+ + diff --git a/main/inc/lib/fckeditor/editor/plugins/prompt/fckplugin.js b/main/inc/lib/fckeditor/editor/plugins/prompt/fckplugin.js new file mode 100644 index 0000000000..a395fe174a --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/prompt/fckplugin.js @@ -0,0 +1,53 @@ +/* + * Dokeos - elearning and course management software + * + * Copyright (c) 2008-2009 Dokeos SPRL + * Copyright (c) 2009 Ivan Tcholakov + * + * For a full list of contributors, see "credits.txt". + * The full license can be read in "license.txt". + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * See the GNU General Public License for more details. + * + * Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium + * Mail: info@dokeos.com + */ +FCKDialog.Prompt = function( message, default_value, action, title, width, height ) +{ + if ( !message ) + { + message = ' '; + } + + if ( !title ) + { + title = ' '; + } + + if ( !default_value ) + { + default_value = ''; + } + + if ( !width ) + { + width = 500 ; + } + + if ( !height ) + { + height = 235 ; + } + + var custom_value = {} ; + custom_value.default_value = default_value + custom_value.action = action ; + custom_value.message = message ; + + FCKDialog.OpenDialog( 'FCKDialog_Prompt', title, FCKConfig.PluginsPath + 'prompt/fck_prompt.html', width, height, custom_value ) ; +} diff --git a/main/inc/lib/fckeditor/myconfig.js b/main/inc/lib/fckeditor/myconfig.js index 084e416674..abcad2f4e3 100644 --- a/main/inc/lib/fckeditor/myconfig.js +++ b/main/inc/lib/fckeditor/myconfig.js @@ -60,6 +60,7 @@ for ( var i = 0 ; i < FCKConfig.LoadPlugin.length ; i++ ) { case 'dragresizetable': case 'tablecommands': case 'ImageManager': + case 'prompt': FCKConfig.Plugins.Add( FCKConfig.LoadPlugin[i] ) ; break ; default: diff --git a/main/inc/lib/fckeditor/myconfig.php b/main/inc/lib/fckeditor/myconfig.php index 1abf9bd123..d7dcd14532 100644 --- a/main/inc/lib/fckeditor/myconfig.php +++ b/main/inc/lib/fckeditor/myconfig.php @@ -83,6 +83,10 @@ $config['LoadPlugin'][] = 'customizations'; $config['LoadPlugin'][] = 'dragresizetable'; $config['LoadPlugin'][] = 'tablecommands'; +// prompt : This plugin is a dialog implementation as a replacemet of the javascript function prompt(). +// It provides consistent appearance and avoiding activation of browser's blocking features. +$config['LoadPlugin'][] = 'prompt'; + // audio: Adds a dialog for inserting audio files (.mp3). $config['LoadPlugin'][] = 'audio';