From 92127bd017bbb49486a9423a7eea1f42d2287877 Mon Sep 17 00:00:00 2001 From: Andrew Minton Date: Sat, 12 Oct 2013 11:08:17 +0100 Subject: [PATCH 1/4] fixed thumbnail and file link urls in filebrowser due to path change in upload fields in 2.3.3 --- content/content.filebrowserajax.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/content/content.filebrowserajax.php b/content/content.filebrowserajax.php index 77e540d..c89ce8f 100755 --- a/content/content.filebrowserajax.php +++ b/content/content.filebrowserajax.php @@ -44,10 +44,15 @@ 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 + $type=$field->get('type'); + $type=='upload'? $destination = $field->get('destination'):null; + } // Add rows: @@ -71,18 +76,20 @@ function build($context) if($name == false) { $name = basename($info['file']); } + //var_export($symphonySubdir); - $value = ''; + $value = ''; - $value = ''; $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 .= 'thumb'; + { + //Replace '/workspace' with '' for jit transform + $value .= 'thumb'; + } else { // Show an icon according to it's extension: $a = explode('.', basename($info['file'])); From 710644e6f344dcf0d959ff53960b75e72267d0f3 Mon Sep 17 00:00:00 2001 From: Andrew Minton Date: Sat, 12 Oct 2013 19:36:38 +0100 Subject: [PATCH 2/4] Altered retrieval of destination path to include other upload field types. --- content/content.filebrowserajax.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/content/content.filebrowserajax.php b/content/content.filebrowserajax.php index c89ce8f..eceb784 100755 --- a/content/content.filebrowserajax.php +++ b/content/content.filebrowserajax.php @@ -50,9 +50,8 @@ function build($context) { $fieldIDs[] = $field->get('id'); //Get path to file from Section field - $type=$field->get('type'); - $type=='upload'? $destination = $field->get('destination'):null; - + $dest = $field->get('destination'); + isset($dest)? $destination = $field->get('destination'):null; } // Add rows: @@ -76,7 +75,6 @@ function build($context) if($name == false) { $name = basename($info['file']); } - //var_export($symphonySubdir); $value = ''; From efa3502e579fd64be03cd3463a5bb218e4eeafe3 Mon Sep 17 00:00:00 2001 From: Andrew Minton Date: Sun, 13 Oct 2013 16:11:50 +0100 Subject: [PATCH 3/4] Added enctype multipart form-data in order to send the data correctly --- assets/filebrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/filebrowser.js b/assets/filebrowser.js index d0508f0..486db14 100755 --- a/assets/filebrowser.js +++ b/assets/filebrowser.js @@ -64,7 +64,7 @@ function buildForm(data) { var $ = jQuery; - $("div.right").html('
'); + $("div.right").html('
'); $("div.field", data).each(function(){ $("div.right form").append('
' + $(this).html() + '
'); }); From 532db7c69238e1355cdaaa80c9fc33d75ce6eb49 Mon Sep 17 00:00:00 2001 From: Andrew Minton Date: Sun, 13 Oct 2013 16:33:29 +0100 Subject: [PATCH 4/4] Changed to using preg_replace for finding first instance of workspace in destination path when JIT is enabled... this way, if a folder deeper in the chain has workspace as it's name it wont get replaced as it would with str_replace. --- content/content.filebrowserajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/content.filebrowserajax.php b/content/content.filebrowserajax.php index eceb784..3c6a4af 100755 --- a/content/content.filebrowserajax.php +++ b/content/content.filebrowserajax.php @@ -86,7 +86,7 @@ function build($context) ($ext == 'jpeg' || $ext == 'jpg' || $ext == 'png' || $ext == 'gif')) { //Replace '/workspace' with '' for jit transform - $value .= 'thumb'; + $value .= 'thumb'; } else { // Show an icon according to it's extension: