mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Enhancement in the generic file manager
This commit is contained in:
parent
985ab1efda
commit
696023c1aa
|
|
@ -50,13 +50,17 @@ if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
// Define if we have to generate thumbs or not
|
||||
$generatethumbs = 1;
|
||||
if (GETPOST('section_dir')) $generatethumbs=0;
|
||||
|
||||
if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
|
||||
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs);
|
||||
}
|
||||
elseif (! empty($upload_dir))
|
||||
{
|
||||
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
|
||||
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -69,7 +73,7 @@ elseif (GETPOST('linkit','none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') {
|
||||
$link = 'http://' . $link;
|
||||
}
|
||||
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link);
|
||||
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link, '', 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,13 +215,20 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
|
|||
$result = dol_move($srcpath, $destpath);
|
||||
if ($result)
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$object->addThumbs($destpath);
|
||||
}
|
||||
// Define if we have to generate thumbs or not
|
||||
$generatethumbs = 1;
|
||||
if (GETPOST('section_dir')) $generatethumbs=0;
|
||||
|
||||
// TODO Add revert function of addThumbs to remove for old name
|
||||
//$object->delThumbs($srcpath);
|
||||
if ($generatethumbs)
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$object->addThumbs($destpath);
|
||||
}
|
||||
|
||||
// TODO Add revert function of addThumbs to remove thumbs with old name
|
||||
//$object->delThumbs($srcpath);
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("FileRenamed"), null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ $fullpathselecteddir='<none>';
|
|||
if ($modulepart == 'ecm')
|
||||
{
|
||||
$fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
|
||||
$fullpathopeneddir=$conf->ecm->dir_output.'/'.($openeddir != '/' ? $openeddir : '');
|
||||
$fullpathpreopened=$conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : '');
|
||||
}
|
||||
if ($modulepart == 'medias')
|
||||
{
|
||||
$fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
|
||||
$fullpathopeneddir=$dolibarr_main_data_root.'/medias/'.($openeddir != '/' ? $openeddir : '');
|
||||
$fullpathpreopened=$dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : '');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -132,161 +132,9 @@ foreach($sqltree as $keycursor => $val)
|
|||
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
|
||||
{
|
||||
treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened);
|
||||
|
||||
/**
|
||||
* treeOutputForAbsoluteDir
|
||||
*
|
||||
* @param array $sqltree Sqltree
|
||||
* @param string $selecteddir Selected dir
|
||||
* @param string $fullpathselecteddir Full path of selected dir
|
||||
* @param string $modulepart Modulepart
|
||||
* @param string $websitekey Website key
|
||||
* @param int $pageid Page id
|
||||
* @return void
|
||||
*/
|
||||
function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid)
|
||||
{
|
||||
global $db, $langs, $form;
|
||||
|
||||
$ecmdirstatic = new EcmDirectory($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
if (file_exists($fullpathselecteddir))
|
||||
{
|
||||
$files = @scandir($fullpathselecteddir);
|
||||
|
||||
if ($files)
|
||||
{
|
||||
natcasesort($files);
|
||||
if (count($files) > 2) /* The 2 accounts for . and .. */
|
||||
{
|
||||
echo '<ul class="ecmjqft" style="display: none;">'."\n";
|
||||
|
||||
// All dirs
|
||||
foreach ($files as $file) // $file can be '.', '..', or 'My dir' or 'My file'
|
||||
{
|
||||
if ($file == 'temp') continue;
|
||||
|
||||
$nbofsubdir=0;
|
||||
$nboffilesinsubdir=0;
|
||||
|
||||
$val=array();
|
||||
|
||||
// Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
|
||||
foreach($sqltree as $key => $tmpval)
|
||||
{
|
||||
//print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
|
||||
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database
|
||||
{
|
||||
$val=$tmpval;
|
||||
$resarray=tree_showpad($sqltree,$key,1);
|
||||
|
||||
// Refresh cache for this subdir
|
||||
if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t
|
||||
{
|
||||
$result=$ecmdirstatic->fetch($val['id']);
|
||||
$ecmdirstatic->ref=$ecmdirstatic->label;
|
||||
|
||||
$result=$ecmdirstatic->refreshcachenboffile(0);
|
||||
$val['cachenbofdoc']=$result;
|
||||
}
|
||||
|
||||
$a=$resarray[0];
|
||||
$nbofsubdir=$resarray[1];
|
||||
$nboffilesinsubdir=$resarray[2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
|
||||
if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file)))
|
||||
{
|
||||
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
|
||||
{
|
||||
$val['fullrelativename']=(($selecteddir && $selecteddir != '/')?$selecteddir.'/':'').$file;
|
||||
$val['id']=0;
|
||||
$val['label']=$file;
|
||||
$val['description']='';
|
||||
$nboffilesinsubdir=$langs->trans("Unknown");
|
||||
}
|
||||
|
||||
print '<li class="directory collapsed">'; // collapsed is opposite if expanded
|
||||
|
||||
print "<a class=\"fmdirlia jqft ecmjqft\" href=\"";
|
||||
print "#";
|
||||
print "\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\"";
|
||||
print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")";
|
||||
print "\">";
|
||||
print dol_escape_htmltag($file);
|
||||
print "</a>";
|
||||
|
||||
print '<div class="ecmjqft">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
|
||||
/*print '<td align="left">';
|
||||
print dol_escape_htmltag($file);
|
||||
print '</td>';*/
|
||||
|
||||
// Nb of docs
|
||||
print '<td align="right">';
|
||||
print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' ';
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
|
||||
print '</td>';
|
||||
|
||||
// Edit link
|
||||
print '<td align="right" width="18"><a href="';
|
||||
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'§ion='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
|
||||
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
|
||||
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
|
||||
|
||||
// Add link
|
||||
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
//print '<td align="right" width="14"> </td>';
|
||||
|
||||
// Info
|
||||
if ($modulepart == 'ecm')
|
||||
{
|
||||
print '<td align="right" width="18">';
|
||||
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
|
||||
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
|
||||
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>';
|
||||
if ($nboffilesinsubdir > 0) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
|
||||
else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
|
||||
print $form->textwithpicto('',$htmltooltip,1,"info");
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr></table>\n";
|
||||
print '</div>';
|
||||
|
||||
if (0)
|
||||
{
|
||||
treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid);
|
||||
}
|
||||
|
||||
//print '<div> </div>';
|
||||
print "</li>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</ul>\n";
|
||||
|
||||
}
|
||||
}
|
||||
else print "PermissionDenied";
|
||||
}
|
||||
}
|
||||
|
||||
treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid);
|
||||
|
||||
// TODO Find a solution to not output this code for each leaf we open
|
||||
// Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
|
||||
// Because the content is reloaded by ajax call, we must also reenable some jquery hooks
|
||||
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip (reload into ajaxdirtree) -->\n";
|
||||
|
|
@ -472,3 +320,175 @@ if (empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_ECM_DISABLE
|
|||
|
||||
// Close db if mode is not noajax
|
||||
if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* treeOutputForAbsoluteDir
|
||||
*
|
||||
* @param array $sqltree Sqltree
|
||||
* @param string $selecteddir Selected dir
|
||||
* @param string $fullpathselecteddir Full path of selected dir
|
||||
* @param string $modulepart Modulepart
|
||||
* @param string $websitekey Website key
|
||||
* @param int $pageid Page id
|
||||
* @param string $preopened Current open dir
|
||||
* @param string $fullpathpreopened Full path of current open dir
|
||||
* @param int $depth Depth
|
||||
* @return void
|
||||
*/
|
||||
function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth=0)
|
||||
{
|
||||
global $conf, $db, $langs, $form;
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
$ecmdirstatic = new EcmDirectory($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
if (file_exists($fullpathselecteddir))
|
||||
{
|
||||
$files = @scandir($fullpathselecteddir);
|
||||
|
||||
if ($files)
|
||||
{
|
||||
natcasesort($files);
|
||||
if (count($files) > 2) /* The 2 accounts for . and .. */
|
||||
{
|
||||
echo '<ul class="ecmjqft" style="display: none;">'."\n";
|
||||
|
||||
// All dirs
|
||||
foreach ($files as $file) // $file can be '.', '..', or 'My dir' or 'My file'
|
||||
{
|
||||
if ($file == 'temp') continue;
|
||||
|
||||
$nbofsubdir=0;
|
||||
$nboffilesinsubdir=0;
|
||||
|
||||
$val=array();
|
||||
|
||||
// Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
|
||||
foreach($sqltree as $key => $tmpval)
|
||||
{
|
||||
//print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
|
||||
if ($tmpval['fullrelativename'] == (($selecteddir != '/'?$selecteddir.'/':'').$file)) // We found equivalent record into database
|
||||
{
|
||||
$val=$tmpval;
|
||||
$resarray=tree_showpad($sqltree,$key,1);
|
||||
|
||||
// Refresh cache for this subdir
|
||||
if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) // Cache is not up to date, so we update it for this directory t
|
||||
{
|
||||
$result=$ecmdirstatic->fetch($val['id']);
|
||||
$ecmdirstatic->ref=$ecmdirstatic->label;
|
||||
|
||||
$result=$ecmdirstatic->refreshcachenboffile(0);
|
||||
$val['cachenbofdoc']=$result;
|
||||
}
|
||||
|
||||
$a=$resarray[0];
|
||||
$nbofsubdir=$resarray[1];
|
||||
$nboffilesinsubdir=$resarray[2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
|
||||
if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . (preg_match('/\/$/',$fullpathselecteddir)?'':'/') . $file)))
|
||||
{
|
||||
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
|
||||
{
|
||||
$val['fullrelativename']=(($selecteddir && $selecteddir != '/')?$selecteddir.'/':'').$file;
|
||||
$val['id']=0;
|
||||
$val['label']=$file;
|
||||
$val['description']='';
|
||||
$nboffilesinsubdir=$langs->trans("Unknown");
|
||||
}
|
||||
|
||||
$collapsedorexpanded='collapsed';
|
||||
if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) $collapsedorexpanded='expanded';
|
||||
print '<li class="directory '.$collapsedorexpanded.'">'; // collapsed is opposite if expanded
|
||||
|
||||
print "<a class=\"fmdirlia jqft ecmjqft\" href=\"";
|
||||
print "#";
|
||||
print "\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\"";
|
||||
print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")";
|
||||
print "\">";
|
||||
print dol_escape_htmltag($file);
|
||||
print "</a>";
|
||||
|
||||
print '<div class="ecmjqft">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
|
||||
/*print '<td align="left">';
|
||||
print dol_escape_htmltag($file);
|
||||
print '</td>';*/
|
||||
|
||||
// Nb of docs
|
||||
print '<td align="right">';
|
||||
print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' ';
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
|
||||
print '</td>';
|
||||
|
||||
// Edit link
|
||||
print '<td align="right" width="18"><a href="';
|
||||
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'§ion='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
|
||||
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
|
||||
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
|
||||
|
||||
// Add link
|
||||
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
//print '<td align="right" width="14"> </td>';
|
||||
|
||||
// Info
|
||||
if ($modulepart == 'ecm')
|
||||
{
|
||||
print '<td align="right" width="18">';
|
||||
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
|
||||
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
|
||||
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>';
|
||||
if ($nboffilesinsubdir > 0) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
|
||||
else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
|
||||
print $form->textwithpicto('',$htmltooltip,1,"info");
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr></table>\n";
|
||||
print '</div>';
|
||||
|
||||
//print 'selecteddir='.$selecteddir.' preopened='.$preopened.' $val[\'fullrelativename\']='.$val['fullrelativename']."<br>\n";
|
||||
if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened))
|
||||
{
|
||||
//print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
|
||||
$newselecteddir = $val['fullrelativename'];
|
||||
if ($modulepart == 'ecm')
|
||||
{
|
||||
$newfullpathselecteddir=$conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
|
||||
}
|
||||
if ($modulepart == 'medias')
|
||||
{
|
||||
$newfullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
|
||||
}
|
||||
|
||||
treeOutputForAbsoluteDir($sqltree, $newselecteddir, $newfullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth+1);
|
||||
}
|
||||
|
||||
print "</li>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</ul>\n";
|
||||
|
||||
}
|
||||
}
|
||||
else print "PermissionDenied";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1139,7 +1139,6 @@ class FormFile
|
|||
//var_dump($sortfield.' - '.$sortorder);
|
||||
if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||
{
|
||||
//var_dump($sortfield);
|
||||
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
|
@ -1258,12 +1257,9 @@ class FormFile
|
|||
if ($forcedownload) $paramlink.=($paramlink?'&':'').'attachment=1';
|
||||
|
||||
$fulllink=$urlwithroot.'/document.php'.($paramlink?'?'.$paramlink:'');
|
||||
//if (! empty($object->ref)) $fulllink.='&hashn='.$object->ref; // Hash of file path
|
||||
//elseif (! empty($object->label)) $fulllink.='&hashc='.$object->label; // Hash of file content
|
||||
|
||||
print img_picto($langs->trans("FileSharedViaALink"),'object_globe.png').' ';
|
||||
print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
//print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1299,17 +1295,12 @@ class FormFile
|
|||
|
||||
if ($permtoeditline)
|
||||
{
|
||||
print '<a href="'.(($useinecm == 1)?'#':($url.'?action=editfile&urlfile='.urlencode($filepath).$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
|
||||
$paramsectiondir=(in_array($modulepart, array('medias','ecm'))?'§ion_dir='.urlencode($relativepath):'');
|
||||
print '<a href="'.(($useinecm == 1)?'#':($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default',0,'class="paddingrightonly"').'</a>';
|
||||
}
|
||||
}
|
||||
if ($permonobject)
|
||||
{
|
||||
/*
|
||||
if ($file['level1name'] <> $object->id)
|
||||
$filepath=$file['level1name'].'/'.$file['name'];
|
||||
else
|
||||
$filepath=$file['name'];
|
||||
*/
|
||||
$useajax=1;
|
||||
if (! empty($conf->dol_use_jmobile)) $useajax=0;
|
||||
if (empty($conf->use_javascript_ajax)) $useajax=0;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ if (empty($conf) || ! is_object($conf))
|
|||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE core/tpl/filemanager.tpl.php -->
|
||||
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
|
||||
<!-- Doc of fileTree plugin at https://www.abeautifulsite.net/jquery-file-tree -->
|
||||
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ if (GETPOST("sendit",'none') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', '', '', 0);
|
||||
$generatethumbs = 0;
|
||||
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', null, '', $generatethumbs);
|
||||
if ($res > 0)
|
||||
{
|
||||
$result=$ecmdir->changeNbOfFiles('+');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user