Merge pull request #20429 from Hystepik/develop#4

Fix : filemanagement in ecm and medias
This commit is contained in:
Laurent Destailleur 2022-07-07 23:04:32 +02:00 committed by GitHub
commit 7f7b5fa92e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View File

@ -1291,6 +1291,7 @@ class FormFile
$nboflines++;
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
// Do we have entry into database ?
print '<!-- In database: position='.(array_key_exists('position', $filearray[$key]) ? $filearray[$key]['position'] : 0).' -->'."\n";
print '<tr class="oddeven" id="row-'.((array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
@ -1436,7 +1437,7 @@ class FormFile
if ($permtoeditline) {
// Link to resize
$moreparaminurl = '';
if ($object->id > 0) {
if (!empty($object->id) && $object->id > 0) {
$moreparaminurl = '&id='.$object->id;
} elseif (GETPOST('website', 'alpha')) {
$moreparaminurl = '&website='.GETPOST('website', 'alpha');

View File

@ -54,7 +54,9 @@ if ($module == 'medias') {
$showroot = 1;
}
if (!isset($section)) {
$section = 0;
}
// Confirm remove file (for non javascript users)
if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax)) {
@ -106,12 +108,26 @@ $('#acreatedir').on('click', function() {
try{
section_dir = $('.directory.expanded')[$('.directory.expanded').length-1].children[0].rel;
section = $('.directory.expanded')[$('.directory.expanded').length-1].children[0].id.split('_')[2];
catParent = ";
if ($module == 'ecm') {
print "section;";
} else {
print "section_dir.substring(0, section_dir.length - 1);";
}
print "
} catch{
section_dir = '/';
section = 0;
catParent = ";
if ($module == 'ecm') {
print "section;";
} else {
print "section_dir;";
}
print "
}
console.log('We click to create a new directory, we set current section_dir='+section_dir+' into href url of button acreatedir');
$('#acreatedir').attr('href', $('#acreatedir').attr('href')+'&section_dir='+encodeURI(section_dir)+'&section='+encodeURI(section));
$('#acreatedir').attr('href', $('#acreatedir').attr('href')+'%26section_dir%3D'+encodeURI(section_dir)+'%26section%3D'+encodeURI(section)+'&section_dir='+encodeURI(section_dir)+'&section='+encodeURI(section)+'&catParent='+encodeURI(catParent));
console.log($('#acreatedir').attr('href'));
});
$('#agenerateimgwebp').on('click', function() {

View File

@ -230,7 +230,7 @@ if ($action == 'create') {
print '<table class="border centpercent">';
// Label
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth100" maxlength="32" value="'.$ecmdir->label.'" autofocus></td></tr>'."\n";
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth100" maxlength="32" value="'.(GETPOST("label", 'alpha') ? GETPOST("label", 'alpha') : $ecmdir->label).'" autofocus></td></tr>'."\n";
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $formecm->selectAllSections((GETPOST("catParent", 'alpha') ? GETPOST("catParent", 'alpha') : $ecmdir->fk_parent), 'catParent', $module);