W.I.P vfsSelect Widget:

- Fix mime types not being shown
- Fix name being displayed encoded in save2vfs mail
This commit is contained in:
Hadi Nategh 2017-10-12 17:45:46 +02:00
parent 9154392163
commit 5b76210218
4 changed files with 29 additions and 29 deletions

View File

@ -280,6 +280,7 @@ app.classes.vfsSelectUI = (function(){ "use strict"; return AppJS.extend(
case 'path': field = 'path'; value = widget.getValue(); break;
case 'home': field = 'action'; value = 'home'; break;
case 'app': field = 'app'; value = widget.getValue(); break;
case 'mime': field = 'mime'; value = widget.getValue(); break;
}
this.submit(field, value);
},
@ -295,7 +296,6 @@ app.classes.vfsSelectUI = (function(){ "use strict"; return AppJS.extend(
{
var arrMgrs = this.et2.getArrayMgrs();
arrMgrs.content.data[_field] = _val;
if (_field == 'dir') arrMgrs.content.data['button'] = 'ok';
jQuery.extend(arrMgrs.content.data, arrMgrs.modifications.data);
this.et2.setArrayMgrs(arrMgrs);
this.vfsSelectWidget._content(arrMgrs.content.data, _callback);

View File

@ -392,21 +392,9 @@ class Vfs extends File
{
$response = Json\Response::get();
$readonlys = $sel_options = array();
if (!is_array($content))
{
$content = array_merge($params, array(
'name' => (string)$params['name'],
'path' => empty($params['path']) ?
Api\Cache::getSession('filemanger', 'select_path'): $params['path'],
));
if (!in_array($content['mode'],array('open','open-multiple','saveas','select-dir')))
if (isset($params['mime']))
{
throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!");
}
if (isset($content['options-mime']))
{
$sel_options['mime'] = array();
foreach((array)$params['mime'] as $key => $value)
{
if (is_numeric($key))
@ -418,6 +406,23 @@ class Vfs extends File
$sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')';
}
}
}
if (!is_array($content))
{
$content = array_merge($params, array(
'name' => (string)$params['name'],
'path' => empty($params['path']) ?
Api\Cache::getSession('filemanger', 'select_path'): $params['path']
));
unset($content['mime']);
if (!in_array($content['mode'],array('open','open-multiple','saveas','select-dir')))
{
throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!");
}
if (isset($params['mime']))
{
$content['showmime'] = true;
list($content['mime']) = each($sel_options['mime']);
}
}
@ -528,8 +533,7 @@ class Vfs extends File
'method' => $content['method'],
'id' => $content['id'],
'label' => $content['label'],
'mime' => $content['mime'],
'options-mime' => $sel_options['mime'],
'showmime' => $content['showmime'],
'old_path' => $content['path'],
'old_app' => $content['app']
)

View File

@ -5,13 +5,11 @@
<template id="api.vfsSelectUI" template="" lang="" group="0" version="1.9.002">
<grid width="100%" class="vfs-select-container" resize_ratio="0">
<columns>
<column width="80"/>
<column width="200"/>
<column width="280"/>
</columns>
<rows >
<row class="et2_toolbar" disabled="@mode=/(open-multiple|select-dir)/">
<description value="File Name" label="%s:"/>
<textbox id="name" width="200"/>
<textbox id="name" class="et2_fullWidth" blur="enter your file name"/>
</row>
<row class="nextmatch_header_row">
<box class="et2_toolbar">
@ -41,10 +39,8 @@
</grid>
</hbox>
</row>
<row disabled="!@options-mime">
<menulist class="selectMime">
<menupopup id="mime" onchange="1" options="All files"/>
</menulist>
<row disabled="!@showmime">
<select id="mime" onchange="app.vfsSelectUI.do_action('mime', widget)" options="All files" class="et2_fullWidth"/>
</row>
</rows>
</grid>

View File

@ -3034,11 +3034,11 @@ app.classes.mail = AppJS.extend(
var subject = dataElem? dataElem.data.subject: _elems[i].subject;
var filename = subject.replace(/[\f\n\t\v]/g,"_")|| 'unknown';
ids.push(_id);
names.push(encodeURIComponent(filename+'.eml'));
names.push(filename+'.eml');
}
var vfs_select = et2_createWidget('vfs-select', {
mode: _elems.length > 1 ? 'select-dir' : 'saveas',
mime: 'message'+encodeURIComponent('/')+'rfc822',
mime: 'message/rfc822',
method: 'mail.mail_ui.ajax_vfsSaveMessage',
button_label: _elems.length>1 ? egw.lang('Save all') : egw.lang('save'),
dialog_title: "Save email",