Skip to content

Commit

Permalink
Make non-real file urls open in new window
Browse files Browse the repository at this point in the history
  • Loading branch information
ggppdk committed Sep 14, 2017
1 parent d471a11 commit 9aa1f12
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/flexicontent_fields/file/tmpl/value_InlineBoxes.php
Expand Up @@ -49,6 +49,12 @@
$file_data->size = (int) $_size;
}

// Force new window for URLs that have zero file size
if ($file_data->url && !$file_data->size)
{
$non_file_url = 1;
}


// ***
// *** Check user access on the file
Expand Down Expand Up @@ -303,7 +309,7 @@

// The download button in a mini form ...
$actions_arr[] = ''
.'<form id="form-download-'.$field->id.'-'.($n+1).'" method="post" action="'.$dl_link.'" style="display:inline-block;" >'
.'<form id="form-download-'.$field->id.'-'.($n+1).'" method="post" action="'.$dl_link.'" style="display:inline-block;" ' . ($non_file_url ? 'target="_blank"' : '') . '>'
.$file_data_fields
.'<input type="submit" name="download-'.$field->id.'[]" class="'.$file_classes.' btn-success fcfile_downloadFile" title="'.$downloadsinfo.'" value="'.$downloadstext.'"/>'
.'</form>'."\n";
Expand Down Expand Up @@ -379,7 +385,7 @@
// The download link, if filename/title not shown, then display a 'download' prompt text
$actions_arr[] =
($filename_shown && $link_filename ? $icon.' ' : '')
.'<a href="' . $dl_link . '" class="'.$file_classes.' fcfile_downloadFile" title="'.$downloadsinfo.'" >'
.'<a href="' . $dl_link . '" class="' . $file_classes . ' fcfile_downloadFile" title="' . $downloadsinfo . '" ' . ($non_file_url ? 'target="_blank"' : '') . '>'
.($filename_shown && $link_filename ? $name_str : $downloadstext)
.'</a>';
}
Expand Down

0 comments on commit 9aa1f12

Please sign in to comment.