Work on direct download links
This commit is contained in:
parent
0eb416d4af
commit
beac7a7439
@ -1537,7 +1537,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
$ecmfile=new EcmFiles($db);
|
$ecmfile=new EcmFiles($db);
|
||||||
$ecmfile->filepath = $rel_dir;
|
$ecmfile->filepath = $rel_dir;
|
||||||
$ecmfile->filename = $filename;
|
$ecmfile->filename = $filename;
|
||||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
$ecmfile->label = md5_file(dol_osencode($destfull)); // MD5 of file content
|
||||||
$ecmfile->fullpath_orig = $TFile['name'][$i];
|
$ecmfile->fullpath_orig = $TFile['name'][$i];
|
||||||
$ecmfile->gen_or_uploaded = 'uploaded';
|
$ecmfile->gen_or_uploaded = 'uploaded';
|
||||||
$ecmfile->description = ''; // indexed content
|
$ecmfile->description = ''; // indexed content
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class EcmFiles //extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public $label;
|
public $label; // hash of file md5_file(dol_osencode($destfull)), so MD5 of file content
|
||||||
public $entity;
|
public $entity;
|
||||||
public $filename;
|
public $filename;
|
||||||
public $filepath;
|
public $filepath;
|
||||||
|
|||||||
@ -249,11 +249,23 @@ print dol_print_size($totalsize);
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$relativetodocument = 'ecm/'.$relativepath; // $relativepath is relative to ECM dir, we need relative to document
|
||||||
$filepath=$relativepath.$file->label;
|
$filepath=$relativepath.$file->label;
|
||||||
|
$filepathtodocument=$relativetodocument.$file->label;
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("HashSaved").'</td><td>';
|
print '<tr><td>'.$langs->trans("HashSaved").'</td><td>';
|
||||||
$ecmfile = new EcmFiles($db);
|
$ecmfile = new EcmFiles($db);
|
||||||
print $filepath;
|
//$filenametosearch=basename($filepath);
|
||||||
|
//$filedirtosearch=basedir($filepath);
|
||||||
|
$ecmfile->fetch(0, '', $filepathtodocument);
|
||||||
|
if (! empty($ecmfile->label))
|
||||||
|
{
|
||||||
|
print $ecmfile->label;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_warning().' '.$langs->trans("FileNotYetIndexedInDatabase");
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Define $urlwithroot
|
// Define $urlwithroot
|
||||||
@ -261,6 +273,19 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
|
|||||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("DirectDownloadInternalLink").'</td><td>';
|
||||||
|
$modulepart='ecm';
|
||||||
|
$forcedownload=1;
|
||||||
|
$rellink='/document.php?modulepart='.$modulepart;
|
||||||
|
if ($forcedownload) $rellink.='&attachment=1';
|
||||||
|
if (! empty($object->entity)) $rellink.='&entity='.$object->entity;
|
||||||
|
$rellink.='&file='.urlencode($filepath);
|
||||||
|
$fulllink=$urlwithroot.$rellink;
|
||||||
|
print img_picto('','object_globe.png').' ';
|
||||||
|
print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||||
|
print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("DirectDownloadLink").'</td><td>';
|
print '<tr><td>'.$langs->trans("DirectDownloadLink").'</td><td>';
|
||||||
$modulepart='ecm';
|
$modulepart='ecm';
|
||||||
$forcedownload=1;
|
$forcedownload=1;
|
||||||
@ -269,12 +294,15 @@ if ($forcedownload) $rellink.='&attachment=1';
|
|||||||
if (! empty($object->entity)) $rellink.='&entity='.$object->entity;
|
if (! empty($object->entity)) $rellink.='&entity='.$object->entity;
|
||||||
$rellink.='&file='.urlencode($filepath);
|
$rellink.='&file='.urlencode($filepath);
|
||||||
$fulllink=$urlwithroot.$rellink;
|
$fulllink=$urlwithroot.$rellink;
|
||||||
print img_picto('','object_globe.png').' ';
|
// TODO
|
||||||
print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadlink" value="'.dol_escape_htmltag($fulllink).'">';
|
//print img_picto('','object_globe.png').' ';
|
||||||
print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
//print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||||
|
//print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
print ajax_autoselect('downloadinternallink');
|
||||||
print ajax_autoselect('downloadlink');
|
print ajax_autoselect('downloadlink');
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
@ -43,3 +43,5 @@ ECMFileManager=File manager
|
|||||||
ECMSelectASection=Select a directory on left tree...
|
ECMSelectASection=Select a directory on left tree...
|
||||||
DirNotSynchronizedSyncFirst=This directory seems to be created or modified outside ECM module. You must click on "Resync" button first to synchronize disk and database to get content of this directory.
|
DirNotSynchronizedSyncFirst=This directory seems to be created or modified outside ECM module. You must click on "Resync" button first to synchronize disk and database to get content of this directory.
|
||||||
ReSyncListOfDir=Resync list of directories
|
ReSyncListOfDir=Resync list of directories
|
||||||
|
HashSaved=Hash of file
|
||||||
|
FileNotYetIndexedInDatabase=File not yet indexed into database (try to re-upload it)
|
||||||
@ -792,7 +792,8 @@ GroupBy=Group by...
|
|||||||
ViewFlatList=View flat list
|
ViewFlatList=View flat list
|
||||||
RemoveString=Remove string '%s'
|
RemoveString=Remove string '%s'
|
||||||
SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">https://transifex.com/projects/p/dolibarr/</a>.
|
SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">https://transifex.com/projects/p/dolibarr/</a>.
|
||||||
DirectDownloadLink=Direct download link
|
DirectDownloadLink=Direct download link (public/external)
|
||||||
|
DirectDownloadInternalLink=Direct download link (need to be logged and permissions)
|
||||||
Download=Download
|
Download=Download
|
||||||
ActualizeCurrency=Update currency rate
|
ActualizeCurrency=Update currency rate
|
||||||
Fiscalyear=Fiscal year
|
Fiscalyear=Fiscal year
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user