Merge pull request #24872 from MaximilienR-easya/dev_New_linked_file_shared_public_side
New access to msg linked files via public interface
This commit is contained in:
commit
8488c05b6a
1 changed files with 56 additions and 0 deletions
|
|
@ -328,6 +328,62 @@ class ActionsTicket extends CommonHookActions
|
|||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">';
|
||||
print $arraymsgs['message'];
|
||||
|
||||
//attachment
|
||||
|
||||
$documents = array();
|
||||
|
||||
$sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id';
|
||||
$sql .= ', ecm.filepath, ecm.filename, ecm.share';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
|
||||
$sql .= " WHERE ecm.filepath = 'agenda/".$arraymsgs['id']."'";
|
||||
$sql .= ' ORDER BY ecm.position ASC';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$documents[$obj->id] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($documents)) {
|
||||
$isshared = 0;
|
||||
$footer = '<div class="timeline-documents-container">';
|
||||
foreach ($documents as $doc) {
|
||||
if (!empty($doc->share)) {
|
||||
$isshared = 1;
|
||||
$footer .= '<span id="document_'.$doc->id.'" class="timeline-documents" ';
|
||||
$footer .= ' data-id="'.$doc->id.'" ';
|
||||
$footer .= ' data-path="'.$doc->filepath.'"';
|
||||
$footer .= ' data-filename="'.dol_escape_htmltag($doc->filename).'" ';
|
||||
$footer .= '>';
|
||||
|
||||
$filePath = DOL_DATA_ROOT.'/'.$doc->filepath.'/'.$doc->filename;
|
||||
$mime = dol_mimetype($filePath);
|
||||
$thumb = $arraymsgs['id'].'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename, '.')).'_mini'.substr($doc->filename, strrpos($doc->filename, '.'));
|
||||
$doclink = DOL_URL_ROOT.'/document.php?hashp='.urlencode($doc->share);
|
||||
|
||||
$mimeAttr = ' mime="'.$mime.'" ';
|
||||
$class = '';
|
||||
if (in_array($mime, array('image/png', 'image/jpeg', 'application/pdf'))) {
|
||||
$class .= ' documentpreview';
|
||||
}
|
||||
|
||||
$footer .= '<a href="'.$doclink.'" class="btn-link '.$class.'" target="_blank" '.$mimeAttr.' >';
|
||||
$footer .= img_mime($filePath).' '.$doc->filename;
|
||||
$footer .= '</a>';
|
||||
|
||||
$footer .= '</span>';
|
||||
}
|
||||
}
|
||||
$footer .= '</div>';
|
||||
if ($isshared == 1) {
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print $footer;
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue