Fix : filemanagement in ecm and medias
This commit is contained in:
parent
2e27c40de4
commit
8152a728a8
@ -1328,7 +1328,7 @@ class FormFile
|
||||
if ($file['name'] != '.'
|
||||
&& $file['name'] != '..'
|
||||
&& !preg_match('/\.meta$/i', $file['name'])) {
|
||||
if ($filearray[$key]['rowid'] > 0) {
|
||||
if (!empty($filearray[$key]['rowid']) && $filearray[$key]['rowid'] > 0) {
|
||||
$lastrowid = $filearray[$key]['rowid'];
|
||||
}
|
||||
$filepath = $relativepath.$file['name'];
|
||||
@ -1337,8 +1337,8 @@ class FormFile
|
||||
$nboflines++;
|
||||
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
|
||||
// Do we have entry into database ?
|
||||
print '<!-- In database: position='.$filearray[$key]['position'].' -->'."\n";
|
||||
print '<tr class="oddeven" id="row-'.($filearray[$key]['rowid'] > 0 ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
|
||||
print '<!-- In database: position='.(!empty($filearray[$key]['position']) ? $filearray[$key]['position'] : 0).' -->'."\n";
|
||||
print '<tr class="oddeven" id="row-'.((!empty($filearray[$key]['rowid']) && $filearray[$key]['rowid'] > 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
|
||||
|
||||
// File name
|
||||
print '<td class="minwith200 tdoverflowmax500">';
|
||||
@ -1481,7 +1481,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');
|
||||
|
||||
@ -51,7 +51,7 @@ if ($module == 'medias') {
|
||||
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
|
||||
$showroot = 1;
|
||||
}
|
||||
|
||||
$section = 0;
|
||||
|
||||
|
||||
// Confirm remove file (for non javascript users)
|
||||
@ -102,12 +102,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')+'§ion_dir='+encodeURI(section_dir)+'§ion='+encodeURI(section));
|
||||
$('#acreatedir').attr('href', $('#acreatedir').attr('href')+'%26section_dir%3D'+encodeURI(section_dir)+'%26section%3D'+encodeURI(section)+'§ion_dir='+encodeURI(section_dir)+'§ion='+encodeURI(section)+'&catParent='+encodeURI(catParent));
|
||||
console.log($('#acreatedir').attr('href'));
|
||||
});
|
||||
$('#agenerateimgwebp').on('click', function() {
|
||||
|
||||
@ -80,7 +80,7 @@ class FormEcm
|
||||
$cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$', '^\.'), 'relativename', SORT_ASC);
|
||||
}
|
||||
|
||||
$output = '<select class="flat minwidth100 maxwidth500" id="'.$select_name.'" name="'.$select_name.'">';
|
||||
$output = '<select autocomplete="off" class="flat minwidth100 maxwidth500" id="'.$select_name.'" name="'.$select_name.'">';
|
||||
if (is_array($cate_arbo)) {
|
||||
if (!count($cate_arbo)) {
|
||||
$output .= '<option value="-1" disabled>'.$langs->trans("NoDirectoriesFound").'</option>';
|
||||
@ -100,7 +100,7 @@ class FormEcm
|
||||
}
|
||||
}
|
||||
$output .= '</select>';
|
||||
$output .= ajax_combobox($select_name);
|
||||
//$output .= ajax_combobox($select_name);
|
||||
$output .= "\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
@ -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="" 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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user