File select fixes:

- some layout issues
- selecting a single file
- missing mime options
- file uploads
This commit is contained in:
Nathan Gray 2013-10-04 09:28:10 +00:00
parent f8cb87e5a4
commit 8c94a4fd19
4 changed files with 19 additions and 12 deletions

View File

@ -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'],
);

View File

@ -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)

View File

@ -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; }*/

View File

@ -3,7 +3,7 @@
<overlay>
<template id="filemanager.select" template="" lang="" group="0" version="1.9.002">
<description align="center" id="msg" class="error"/>
<grid width="600">
<grid width="100%">
<columns>
<column width="32"/>
<column/>
@ -64,7 +64,7 @@
</menulist>
</row>
<row disabled="@no_upload">
<groupbox id="upload_groupbox">
<groupbox>
<caption label="File upload"/>
<description value="Choose a file for uploading"/>
<file id="file_upload"/>