Merge branch 'ent-11078-quitar-las-opciones-de-crear-ficheros-y-directorios-en-el-mib-uploader' into 'develop'

Ent 11078 quitar las opciones de crear ficheros y directorios en el mib uploader

See merge request artica/pandorafms!5826
This commit is contained in:
Rafael Ameijeiras 2023-05-31 11:23:50 +00:00
commit d44eb102e7
2 changed files with 78 additions and 52 deletions

View File

@ -485,6 +485,11 @@ 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 ($options['denyCreateText'] === true) {
$allowCreateText = false;
}
if ($homedir_filemanager === false) {
$homedir_filemanager = $config['homedir'];
@ -494,11 +499,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 +522,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 +548,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 +824,21 @@ 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>';
$tabs_dialog = '<ul id="file_table_modal">';
if ($allowCreateFolder === true) {
$tabs_dialog .= '
<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 +871,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 +956,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,9 @@ filemanager_file_explorer(
false,
'',
false,
['all' => true]
[
'all' => true,
'denyCreateText' => true,
'allowCreateFolder' => true,
]
);