Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed thumbnail and file link urls in filebrowser due to path change in ... #40

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/filebrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function buildForm(data)
{
var $ = jQuery;

$("div.right").html('<form method="post" action="' + urlNew + '"></form>');
$("div.right").html('<form method="post" action="' + urlNew + '" enctype="multipart/form-data"></form>');
$("div.field", data).each(function(){
$("div.right form").append('<div class="field">' + $(this).html() + '</div>');
});
Expand Down
13 changes: 9 additions & 4 deletions content/content.filebrowserajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ function build($context)

// Get the field id's:
$fields = $section->fetchFields();

$fieldIDs = array();
foreach($fields as $field)
{
$fieldIDs[] = $field->get('id');
//Get path to file from Section field
$dest = $field->get('destination');
isset($dest)? $destination = $field->get('destination'):null;
}

// Add rows:
Expand All @@ -72,17 +76,18 @@ function build($context)
$name = basename($info['file']);
}

$value = '<a href="'.$symphonySubdir.'/workspace'.$info['file'].'">';
$value = '<a href="'.$symphonySubdir.$destination.'/'.$info['file'].'">';

$value = '<a href="/workspace'.$info['file'].'">';
$a = explode('.', $info['file']);
$ext = trim(strtolower($a[count($a)-1]));

// Check if JIT is enabled:
if($jitEnabled &&
($ext == 'jpeg' || $ext == 'jpg' || $ext == 'png' || $ext == 'gif'))
{
$value .= '<img src="'.$symphonySubdir.'/image/2/100/100/5'.$info['file'].'" alt="thumb" width="100" height="100" />';
{
//Replace '/workspace' with '' for jit transform
$value .= '<img src="'.$symphonySubdir.'/image/2/100/100/5'.preg_replace('/\/workspace/','',$destination,1).'/'.$info['file'].'" alt="thumb" width="100" height="100" />';

} else {
// Show an icon according to it's extension:
$a = explode('.', basename($info['file']));
Expand Down