11078-Remove Create files and directories buttons from MIB Uploader

This commit is contained in:
Pablo Aragon 2023-05-04 09:55:32 +02:00
parent 151358190c
commit aeeae1a2b3
2 changed files with 69 additions and 52 deletions

View File

@ -485,6 +485,7 @@ function filemanager_file_explorer(
// Options.
$allowZipFiles = (isset($options['all']) === true) || ((isset($options['allowZipFiles']) === true) && ($options['allowZipFiles'] === true));
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
$allowCreateFolder = (isset($options['allowCreateFolder'])) ? false : true;
if ($homedir_filemanager === false) {
$homedir_filemanager = $config['homedir'];
@ -494,11 +495,14 @@ function filemanager_file_explorer(
?>
<script type="text/javascript">
<?php if ($allowCreateFolder === true) : ?>
function show_form_create_folder() {
actions_dialog('create_folder');
$("#create_folder").css("display", "block");
check_opened_dialog('create_folder');
}
<?php endif ?>
<?php if ($allowCreateText === true) : ?>
function show_create_text_file() {
actions_dialog('create_text_file');
@ -514,11 +518,14 @@ function filemanager_file_explorer(
}
function check_opened_dialog(check_opened) {
if (check_opened !== 'create_folder') {
if (($("#create_folder").hasClass("ui-dialog-content") && $('#create_folder').dialog('isOpen') === true)) {
$('#create_folder').dialog('close');
<?php if ($allowCreateFolder === true) : ?>
if (check_opened !== 'create_folder') {
if (($("#create_folder").hasClass("ui-dialog-content") && $('#create_folder').dialog('isOpen') === true)) {
$('#create_folder').dialog('close');
}
}
}
<?php endif ?>
<?php if ($allowCreateText === true) : ?>
if (check_opened !== 'create_text_file') {
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
@ -537,14 +544,18 @@ function filemanager_file_explorer(
$('.' + action).addClass('file_table_modal_active');
var title_action = '';
switch (action) {
case 'create_folder':
title_action = "<?php echo __('Create a Directory'); ?>";
break;
<?php if ($allowCreateText === true) : ?>
case 'create_text_file':
title_action = "<?php echo __('Create File'); ?>";
<?php if ($allowCreateFolder === true) : ?>
case 'create_folder':
title_action = "<?php echo __('Create a Directory'); ?>";
break;
<?php endif ?>
<?php endif ?>
<?php if ($allowCreateText === true) : ?>
case 'create_text_file':
title_action = "<?php echo __('Create File'); ?>";
break;
<?php endif ?>
case 'upload_file':
title_action = "<?php echo __('Upload Files'); ?>";
break;
@ -809,18 +820,20 @@ function filemanager_file_explorer(
if ($readOnly === false) {
if (is_writable($real_directory) === true) {
// The buttons to make actions.
$tabs_dialog = '<ul id="file_table_modal">
<li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image(
'images/create_directory.png',
true,
[
'title' => __('Create directory'),
'class' => 'invert_filter',
]
).'<span>'.__('Create a Directory').'</span>
</a>
</li>';
if ($allowCreateFolder === true) {
$tabs_dialog = '<ul id="file_table_modal">
<li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image(
'images/create_directory.png',
true,
[
'title' => __('Create directory'),
'class' => 'invert_filter',
]
).'<span>'.__('Create a Directory').'</span>
</a>
</li>';
}
if ($allowCreateText === true) {
$tabs_dialog .= '
@ -853,23 +866,25 @@ function filemanager_file_explorer(
$tabs_dialog .= '</ul>';
// Create folder section.
$createFolderElements = $tabs_dialog;
$createFolderElements .= sprintf('<form method="POST" action="%s">', $url);
$createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true);
$createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true);
$createFolderElements .= html_print_input_hidden('directory', $relative_directory, true);
$createFolderElements .= html_print_input_hidden('create_dir', 1, true);
$createFolderElements .= html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true);
$createFolderElements .= html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true);
$createFolderElements .= '</form>';
if ($allowCreateFolder === true) {
$createFolderElements = $tabs_dialog;
$createFolderElements .= sprintf('<form method="POST" action="%s">', $url);
$createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true);
$createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true);
$createFolderElements .= html_print_input_hidden('directory', $relative_directory, true);
$createFolderElements .= html_print_input_hidden('create_dir', 1, true);
$createFolderElements .= html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true);
$createFolderElements .= html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true);
$createFolderElements .= '</form>';
html_print_div(
[
'id' => 'create_folder',
'class' => 'invisible',
'content' => $createFolderElements,
]
);
html_print_div(
[
'id' => 'create_folder',
'class' => 'invisible',
'content' => $createFolderElements,
]
);
}
// Upload file section.
$uploadFileElements = $tabs_dialog;
@ -936,18 +951,20 @@ function filemanager_file_explorer(
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
$buttons[] = html_print_button(
__('Create directory'),
'create_directory',
false,
'show_form_create_folder()',
[
'class' => 'margin-right-2 invert_filter secondary',
'icon' => 'create_directory',
],
true,
false
);
if ($allowCreateFolder === true) {
$buttons[] = html_print_button(
__('Create directory'),
'create_directory',
false,
'show_form_create_folder()',
[
'class' => 'margin-right-2 invert_filter secondary',
'icon' => 'create_directory',
],
true,
false
);
}
if ($allowCreateText === true) {
$buttons[] = html_print_button(

View File

@ -109,5 +109,5 @@ filemanager_file_explorer(
false,
'',
false,
['all' => true]
['allowCreateFolder' => true]
);