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. // Options.
$allowZipFiles = (isset($options['all']) === true) || ((isset($options['allowZipFiles']) === true) && ($options['allowZipFiles'] === true)); $allowZipFiles = (isset($options['all']) === true) || ((isset($options['allowZipFiles']) === true) && ($options['allowZipFiles'] === true));
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === 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) { if ($homedir_filemanager === false) {
$homedir_filemanager = $config['homedir']; $homedir_filemanager = $config['homedir'];
@ -494,11 +499,14 @@ function filemanager_file_explorer(
?> ?>
<script type="text/javascript"> <script type="text/javascript">
<?php if ($allowCreateFolder === true) : ?>
function show_form_create_folder() { function show_form_create_folder() {
actions_dialog('create_folder'); actions_dialog('create_folder');
$("#create_folder").css("display", "block"); $("#create_folder").css("display", "block");
check_opened_dialog('create_folder'); check_opened_dialog('create_folder');
} }
<?php endif ?>
<?php if ($allowCreateText === true) : ?> <?php if ($allowCreateText === true) : ?>
function show_create_text_file() { function show_create_text_file() {
actions_dialog('create_text_file'); actions_dialog('create_text_file');
@ -514,11 +522,14 @@ function filemanager_file_explorer(
} }
function check_opened_dialog(check_opened) { function check_opened_dialog(check_opened) {
<?php if ($allowCreateFolder === true) : ?>
if (check_opened !== 'create_folder') { if (check_opened !== 'create_folder') {
if (($("#create_folder").hasClass("ui-dialog-content") && $('#create_folder').dialog('isOpen') === true)) { if (($("#create_folder").hasClass("ui-dialog-content") && $('#create_folder').dialog('isOpen') === true)) {
$('#create_folder').dialog('close'); $('#create_folder').dialog('close');
} }
} }
<?php endif ?>
<?php if ($allowCreateText === true) : ?> <?php if ($allowCreateText === true) : ?>
if (check_opened !== 'create_text_file') { if (check_opened !== 'create_text_file') {
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) { 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'); $('.' + action).addClass('file_table_modal_active');
var title_action = ''; var title_action = '';
switch (action) { switch (action) {
<?php if ($allowCreateFolder === true) : ?>
case 'create_folder': case 'create_folder':
title_action = "<?php echo __('Create a Directory'); ?>"; title_action = "<?php echo __('Create a Directory'); ?>";
break; break;
<?php endif ?>
<?php if ($allowCreateText === true) : ?> <?php if ($allowCreateText === true) : ?>
case 'create_text_file': case 'create_text_file':
title_action = "<?php echo __('Create File'); ?>"; title_action = "<?php echo __('Create File'); ?>";
break; break;
<?php endif ?> <?php endif ?>
case 'upload_file': case 'upload_file':
title_action = "<?php echo __('Upload Files'); ?>"; title_action = "<?php echo __('Upload Files'); ?>";
break; break;
@ -809,7 +824,9 @@ function filemanager_file_explorer(
if ($readOnly === false) { if ($readOnly === false) {
if (is_writable($real_directory) === true) { if (is_writable($real_directory) === true) {
// The buttons to make actions. // The buttons to make actions.
$tabs_dialog = '<ul id="file_table_modal"> $tabs_dialog = '<ul id="file_table_modal">';
if ($allowCreateFolder === true) {
$tabs_dialog .= '
<li class="create_folder"> <li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image( <a href="javascript: show_form_create_folder();">'.html_print_image(
'images/create_directory.png', 'images/create_directory.png',
@ -821,6 +838,7 @@ function filemanager_file_explorer(
).'<span>'.__('Create a Directory').'</span> ).'<span>'.__('Create a Directory').'</span>
</a> </a>
</li>'; </li>';
}
if ($allowCreateText === true) { if ($allowCreateText === true) {
$tabs_dialog .= ' $tabs_dialog .= '
@ -853,6 +871,7 @@ function filemanager_file_explorer(
$tabs_dialog .= '</ul>'; $tabs_dialog .= '</ul>';
// Create folder section. // Create folder section.
if ($allowCreateFolder === true) {
$createFolderElements = $tabs_dialog; $createFolderElements = $tabs_dialog;
$createFolderElements .= sprintf('<form method="POST" action="%s">', $url); $createFolderElements .= sprintf('<form method="POST" action="%s">', $url);
$createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true); $createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true);
@ -870,6 +889,7 @@ function filemanager_file_explorer(
'content' => $createFolderElements, 'content' => $createFolderElements,
] ]
); );
}
// Upload file section. // Upload file section.
$uploadFileElements = $tabs_dialog; $uploadFileElements = $tabs_dialog;
@ -936,6 +956,7 @@ function filemanager_file_explorer(
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>"; echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
if ($allowCreateFolder === true) {
$buttons[] = html_print_button( $buttons[] = html_print_button(
__('Create directory'), __('Create directory'),
'create_directory', 'create_directory',
@ -948,6 +969,7 @@ function filemanager_file_explorer(
true, true,
false false
); );
}
if ($allowCreateText === true) { if ($allowCreateText === true) {
$buttons[] = html_print_button( $buttons[] = html_print_button(

View File

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