Skip to content
Snippets Groups Projects
Unverified Commit a2017cfa authored by Peter Rotich's avatar Peter Rotich Committed by GitHub
Browse files

Merge pull request #4970 from JediKev/issue/image-attachment-view

issue: Image Attachment View
parents d0b47a02 eb1a4eaf
No related branches found
No related tags found
No related merge requests found
...@@ -240,7 +240,10 @@ class AttachmentFile extends VerySimpleModel { ...@@ -240,7 +240,10 @@ class AttachmentFile extends VerySimpleModel {
} }
function download($disposition=false, $expires=false) { function download($disposition=false, $expires=false) {
$disposition = ($disposition && strcasecmp($disposition, 'inline') == 0 $thisstaff = StaffAuthenticationBackend::getUser();
$inline = ($thisstaff ? ($thisstaff->getImageAttachmentView() === 'inline') : false);
$disposition = ((($disposition && strcasecmp($disposition, 'inline') == 0)
|| $inline)
&& strpos($this->getType(), 'image/') !== false) && strpos($this->getType(), 'image/') !== false)
? 'inline' : 'attachment'; ? 'inline' : 'attachment';
$bk = $this->open(); $bk = $this->open();
......
...@@ -88,6 +88,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { ...@@ -88,6 +88,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
'default_from_name' => '', 'default_from_name' => '',
'datetime_format' => '', 'datetime_format' => '',
'thread_view_order' => '', 'thread_view_order' => '',
'img_att_view' => 'download',
)); ));
$this->_config = $_config->getInfo(); $this->_config = $_config->getInfo();
} }
...@@ -328,6 +329,10 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { ...@@ -328,6 +329,10 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
return $this->default_paper_size; return $this->default_paper_size;
} }
function getImageAttachmentView() {
return $this->img_att_view;
}
function forcePasswdChange() { function forcePasswdChange() {
return $this->change_passwd; return $this->change_passwd;
} }
...@@ -691,6 +696,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { ...@@ -691,6 +696,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
'datetime_format' => $vars['datetime_format'], 'datetime_format' => $vars['datetime_format'],
'default_from_name' => $vars['default_from_name'], 'default_from_name' => $vars['default_from_name'],
'thread_view_order' => $vars['thread_view_order'], 'thread_view_order' => $vars['thread_view_order'],
'img_att_view' => ($vars['img_att_view'] == 'inline') ? 'inline' : 'download',
) )
); );
$this->_config = $_config->getInfo(); $this->_config = $_config->getInfo();
......
...@@ -283,6 +283,23 @@ if ($avatar->isChangeable()) { ?> ...@@ -283,6 +283,23 @@ if ($avatar->isChangeable()) { ?>
<div class="error"><?php echo $errors['default_paper_size']; ?></div> <div class="error"><?php echo $errors['default_paper_size']; ?></div>
</td> </td>
</tr> </tr>
<tr>
<td><?php echo __('Image Attachment View'); ?>:
<div class="faded"><?php echo __('Open image attachments in new tab or directly download. (CTRL + Right Click)');?></div>
</td>
<td>
<select name="img_att_view">
<?php
$options=array('download'=>__('Download'),'inline'=>__('Inline'));
foreach($options as $key=>$opt) {
echo sprintf('<option value="%s" %s>%s</option>',
$key,($staff->img_att_view==$key)?'selected="selected"':'',$opt);
}
?>
</select>
<div class="error"><?php echo $errors['img_att_view']; ?></div>
</td>
</tr>
</tbody> </tbody>
<tbody> <tbody>
<tr class="header"> <tr class="header">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment