From 8c94a4fd199546567989370495888dd7ab531cd7 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 4 Oct 2013 09:28:10 +0000 Subject: [PATCH] File select fixes: - some layout issues - selecting a single file - missing mime options - file uploads --- filemanager/inc/class.filemanager_select.inc.php | 16 ++++++++++------ filemanager/js/app.js | 7 +++++-- filemanager/templates/default/app.css | 4 ++-- filemanager/templates/default/select.xet | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/filemanager/inc/class.filemanager_select.inc.php b/filemanager/inc/class.filemanager_select.inc.php index 32ad4c02ca..b2b1fff465 100644 --- a/filemanager/inc/class.filemanager_select.inc.php +++ b/filemanager/inc/class.filemanager_select.inc.php @@ -99,19 +99,21 @@ class filemanager_select $content['label'] = isset($_GET['label']) ? $_GET['label'] : lang('Open'); if (($content['options-mime'] = isset($_GET['mime']))) { - $content['options-mime'] = array(); + $sel_options['mime'] = array(); foreach((array)$_GET['mime'] as $key => $value) { if (is_numeric($key)) { - $content['options-mime'][$value] = lang('%1 files',strtoupper(mime_magic::mime2ext($value))).' ('.$value.')'; + $sel_options['mime'][$value] = lang('%1 files',strtoupper(mime_magic::mime2ext($value))).' ('.$value.')'; } else { - $content['options-mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')'; + $sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')'; } } - list($content['mime']) = each($content['options-mime']); + + list($content['mime']) = each($sel_options['mime']); + error_log(array2string($content['options-mime'])); } } elseif(isset($content['button'])) @@ -136,7 +138,7 @@ class filemanager_select break; case 'ok': $copy_result = null; - if (isset($content['file_upload']['name']) && is_uploaded_file($content['file_upload']['tmp_name'])) + if (isset($content['file_upload']['name']) && file_exists($content['file_upload']['tmp_name'])) { //Set the "content" name filed accordingly to the uploaded file // encode chars which special meaning in url/vfs (some like / get removed!) @@ -214,6 +216,8 @@ class filemanager_select } common::egw_exit(); } + + $sel_options['mime'] = $content['options-mime']; } elseif(isset($content['apps'])) { @@ -298,7 +302,7 @@ class filemanager_select 'id' => $content['id'], 'label' => $content['label'], 'mime' => $content['mime'], - 'options-mime' => $content['options-mime'], + 'options-mime' => $sel_options['mime'], 'old_path' => $content['path'], ); diff --git a/filemanager/js/app.js b/filemanager/js/app.js index a801e4b70e..211fbe29f3 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -669,8 +669,11 @@ app.filemanager = AppJS.extend( select_show: function(file) { - var editfield = document.getElementById("exec[name]"); - editfield.value = file; + var editfield = this.et2.getWidgetById('name'); + if(editfield) + { + editfield.set_value(file); + } return false; }, select_toggle: function(file,widget) diff --git a/filemanager/templates/default/app.css b/filemanager/templates/default/app.css index 8b317eb654..bae4fddd74 100644 --- a/filemanager/templates/default/app.css +++ b/filemanager/templates/default/app.css @@ -15,8 +15,8 @@ /** * Select file dialog */ -.selectPath { font-weight: bold; } -.selectPathContainer { width: 480px; overflow: auto; } +.selectPath { font-weight: bold; width: 98% } +.selectPathContainer { width: 470px; overflow: auto; } .selectName input { width: 100%; } .selectMime select { width: 100%; } /*.selectIcon img { height: 16px; }*/ diff --git a/filemanager/templates/default/select.xet b/filemanager/templates/default/select.xet index 00e50bda6b..92b89d8376 100644 --- a/filemanager/templates/default/select.xet +++ b/filemanager/templates/default/select.xet @@ -3,7 +3,7 @@