From 3c18478f866a1a297dd7a4bf187e5935b8751928 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 17 Apr 2009 06:28:19 +0000 Subject: [PATCH] - more docu for file selection dialog - added mime type filter - added more user friendly mime type names: application/pdf --> PDF file (application/pdf) --- etemplate/inc/class.vfs_widget.inc.php | 9 ++- .../inc/class.filemanager_select.inc.php | 55 +++++++++++++++---- filemanager/setup/egw_de.lang | 3 + filemanager/setup/egw_en.lang | 3 + filemanager/setup/etemplates.inc.php | 4 +- filemanager/templates/default/select.xet | 4 +- 6 files changed, 62 insertions(+), 16 deletions(-) diff --git a/etemplate/inc/class.vfs_widget.inc.php b/etemplate/inc/class.vfs_widget.inc.php index be8583d371..f5d71c3506 100644 --- a/etemplate/inc/class.vfs_widget.inc.php +++ b/etemplate/inc/class.vfs_widget.inc.php @@ -212,7 +212,14 @@ class vfs_widget } //error_log(__METHOD__."() type=vfs-mime: value=".array2string($value).": mime=$mime, path=$path"); $cell['type'] = 'image'; - $cell['label'] = $mime; + if ($mime == egw_vfs::DIR_MIME_TYPE) + { + $cell['label'] = lang('Directory'); + } + else + { + $cell['label'] = lang('%1 file',strtoupper(mime_magic::mime2ext($mime))).' ('.$mime.')'; + } list($mime_main,$mime_sub) = explode('/',$mime); if ($mime_main == 'egw') { diff --git a/filemanager/inc/class.filemanager_select.inc.php b/filemanager/inc/class.filemanager_select.inc.php index 8cdfac311e..78f12a97d9 100644 --- a/filemanager/inc/class.filemanager_select.inc.php +++ b/filemanager/inc/class.filemanager_select.inc.php @@ -1,6 +1,6 @@ $value) + { + if (is_numeric($key)) + { + $content['options-mime'][$value] = lang('%1 files',strtoupper(mime_magic::mime2ext($value))).' ('.$value.')'; + } + else + { + $content['options-mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')'; + } + } + list($content['mime']) = each($content['options-mime']); + } } else { @@ -112,6 +139,10 @@ class filemanager_select { $path = egw_vfs::concat($content['path'],$name); $is_dir = egw_vfs::is_dir($path); + if ($content['mime'] && !$is_dir && egw_vfs::mime_content_type($path) != $content['mime']) + { + continue; // does not match mime-filter --> ignore + } $content['dir'][$n] = array( 'name' => $name, 'path' => $path, @@ -159,6 +190,8 @@ function select_toggle(file) 'method' => $content['method'], 'id' => $content['id'], 'label' => $content['label'], + 'mime' => $content['mime'], + 'options-mime' => $content['options-mime'], ),2); } } diff --git a/filemanager/setup/egw_de.lang b/filemanager/setup/egw_de.lang index cd9219ed6a..03a5cfb146 100644 --- a/filemanager/setup/egw_de.lang +++ b/filemanager/setup/egw_de.lang @@ -7,6 +7,7 @@ %1 errors linking (%2)! filemanager de %1 Fehler beim Verküpfen (%2)! %1 errors moving (%2 files moved)! filemanager de %1 Fehler beim Verschieben (%2 Dateien verschoben)! %1 failed, %2 succeded filemanager de %1 fehlgeschlagen, %2 erfolgreich +%1 files common de %1 Dateien %1 files copied. filemanager de %1 Dateien kopiert. %1 files deleted. filemanager de %1 Dateien gelöscht. %1 files moved. filemanager de %1 Dateien verschoben. @@ -18,8 +19,10 @@ accessrights filemanager de Zugangsberechtigungen acl added. filemanager de Zugrifsrecht hinzugefügt. acl deleted. filemanager de Zugrifsrecht gelöscht. actions filemanager de Befehle +all files common de Alle Dateien allow a maximum of the above configured folderlinks to be configured in settings admin de erlaube das oben eingestellte Maximum an Einstellunge für Verzeichnisverweise and all it's childeren filemanager de und alle seine Kinder +applications common de Anwendungen basedirectory filemanager de Basisverzeichnis cancel editing %1 without saving filemanager de Beende das Bearbeiten von %1 ohne zu Speichern cannot create directory because it begins or ends in a space filemanager de Die Erstellung des Verzeichnisses schlug fehl, da es mit einem Leerzeichen beginnt oder endet diff --git a/filemanager/setup/egw_en.lang b/filemanager/setup/egw_en.lang index c92de12fc0..5d9410a622 100644 --- a/filemanager/setup/egw_en.lang +++ b/filemanager/setup/egw_en.lang @@ -7,6 +7,7 @@ %1 errors linking (%2)! filemanager en %1 errors linking (%2)! %1 errors moving (%2 files moved)! filemanager en %1 errors moving (%2 files moved)! %1 failed, %2 succeded filemanager en %1 failed, %2 succeded +%1 files common en %1 files %1 files copied. filemanager en %1 files copied. %1 files deleted. filemanager en %1 files deleted. %1 files moved. filemanager en %1 files moved. @@ -18,8 +19,10 @@ accessrights filemanager en Accessrights acl added. filemanager en ACL added. acl deleted. filemanager en ACL deleted. actions filemanager en Actions +all files common en All files allow a maximum of the above configured folderlinks to be configured in settings admin en allow a maximum of the above configured folderlinks to be configured in settings and all it's childeren filemanager en and all it's childeren +applications common en Applications basedirectory filemanager en Basedirectory cancel editing %1 without saving filemanager en Cancel editing %1 without saving cannot create directory because it begins or ends in a space filemanager en Cannot create directory because it begins or ends in a space diff --git a/filemanager/setup/etemplates.inc.php b/filemanager/setup/etemplates.inc.php index bb54c5efa8..8ed79fa676 100644 --- a/filemanager/setup/etemplates.inc.php +++ b/filemanager/setup/etemplates.inc.php @@ -2,7 +2,7 @@ /** * eGroupWare - eTemplates for Application filemanager * http://www.egroupware.org - * generated by soetemplate::dump4setup() 2009-04-15 23:14 + * generated by soetemplate::dump4setup() 2009-04-17 08:26 * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package filemanager @@ -56,5 +56,5 @@ $templ_data[] = array('name' => 'filemanager.index.rows','template' => '','lang' $templ_data[] = array('name' => 'filemanager.index.rows','template' => '','lang' => '','group' => '0','version' => '1.5.002','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:6:{s:2:"c1";s:2:"th";s:2:"c2";s:3:"row";s:1:"B";s:3:"30%";s:1:"D";s:3:"120";s:1:"E";s:3:"120";s:1:"K";s:2:"70";}i:1;a:11:{s:1:"A";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"Type";s:4:"name";s:4:"mime";s:5:"align";s:6:"center";}s:1:"B";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"Name";s:4:"name";s:4:"name";}s:1:"C";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"Size";s:4:"name";s:4:"size";}s:1:"D";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:8:"Modified";s:4:"name";s:5:"mtime";}s:1:"E";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:7:"Created";s:4:"name";s:5:"ctime";}s:1:"F";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:11:"Permissions";s:4:"name";s:4:"mode";}s:1:"G";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:3:"uid";s:5:"label";s:5:"Owner";}s:1:"H";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:3:"gid";s:5:"label";s:5:"Group";}s:1:"I";a:3:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:7:"Comment";s:4:"name";s:7:"comment";}s:1:"J";a:3:{s:4:"type";s:22:"nextmatch-customfields";s:8:"readonly";s:1:"1";s:4:"name";s:12:"customfields";}s:1:"K";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}i:2;a:8:{s:4:"type";s:6:"button";s:4:"size";s:5:"check";s:5:"label";s:9:"Check all";s:4:"name";s:9:"check_all";s:4:"help";s:9:"Check all";s:7:"onclick";s:60:"toggle_all(this.form,form::name(\'checked[]\')); return false;";s:6:"needed";s:1:"1";s:5:"align";s:5:"right";}}}i:2;a:11:{s:1:"A";a:3:{s:4:"type";s:8:"vfs-mime";s:4:"name";s:12:"${row}[path]";s:5:"align";s:6:"center";}s:1:"B";a:3:{s:4:"type";s:3:"vfs";s:4:"name";s:4:"$row";s:7:"no_lang";s:1:"1";}s:1:"C";a:3:{s:4:"type";s:8:"vfs-size";s:4:"name";s:12:"${row}[size]";s:5:"align";s:5:"right";}s:1:"D";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:13:"${row}[mtime]";s:8:"readonly";s:1:"1";}s:1:"E";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:13:"${row}[ctime]";s:8:"readonly";s:1:"1";}s:1:"F";a:2:{s:4:"type";s:8:"vfs-mode";s:4:"name";s:12:"${row}[mode]";}s:1:"G";a:3:{s:4:"type";s:7:"vfs-uid";s:4:"name";s:11:"${row}[uid]";s:7:"no_lang";s:1:"1";}s:1:"H";a:3:{s:4:"type";s:7:"vfs-gid";s:4:"name";s:11:"${row}[gid]";s:7:"no_lang";s:1:"1";}s:1:"I";a:2:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[comment]";}s:1:"J";a:3:{s:4:"type";s:17:"customfields-list";s:8:"readonly";s:1:"1";s:4:"name";s:4:"$row";}s:1:"K";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"edit";s:5:"label";s:13:"Edit settings";s:4:"name";s:21:"edit[$row_cont[path]]";s:4:"help";s:39:"Rename, change permissions or ownership";s:7:"onclick";s:192:"window.open(egw::link(\'/index.php\',\'menuaction=filemanager.filemanager_ui.file&path=$row_cont[path]\'),\'fileprefs\',\'dependent=yes,width=495,height=425,scrollbars=yes,status=yes\'); return false;";}i:2;a:7:{s:4:"type";s:6:"button";s:4:"name";s:23:"delete[$row_cont[path]]";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:4:"help";s:29:"Delete this file or directory";s:7:"onclick";s:48:"return confirm(\'Delete this file or directory\');";s:5:"align";s:6:"center";}i:3;a:4:{s:4:"type";s:8:"checkbox";s:4:"name";s:9:"checked[]";s:5:"align";s:5:"right";s:4:"size";s:17:""$row_cont[path]"";}s:5:"align";s:5:"right";}}}s:4:"rows";i:2;s:4:"cols";i:11;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '','modified' => '1204370567',); -$templ_data[] = array('name' => 'filemanager.select','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:2:{s:2:"c1";s:4:",top";s:1:"A";s:2:"32";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:4:"size";s:4:"home";s:4:"name";s:12:"button[home]";s:5:"align";s:6:"center";}s:1:"B";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:2:{s:2:"c2";s:11:"selectFiles";s:2:"h3";s:20:",@mode=open-multiple";}i:1;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:2:"js";}i:2;a:3:{s:4:"type";s:6:"button";s:4:"name";s:10:"button[up]";s:4:"size";s:4:"goup";}i:3;a:4:{s:4:"type";s:3:"vfs";s:4:"name";s:4:"path";s:7:"onclick";s:87:"path=document.getElementById(form::name(\'path\')); path.value=$path; path.form.submit();";s:4:"span";s:11:",selectPath";}i:4;a:3:{s:4:"type";s:4:"text";s:4:"name";s:4:"path";s:4:"span";s:12:",displayNone";}}}i:2;a:1:{s:1:"A";a:7:{s:4:"type";s:4:"grid";s:4:"size";s:17:"100%,400,,,,,auto";s:4:"name";s:3:"dir";s:4:"data";a:2:{i:0;a:3:{s:2:"c1";s:3:"row";s:1:"A";s:2:"20";s:1:"C";s:23:"1%,!@mode=open-multiple";}i:1;a:3:{s:1:"A";a:4:{s:4:"type";s:8:"vfs-mime";s:4:"name";s:12:"${row}[path]";s:4:"span";s:11:",selectIcon";s:5:"align";s:6:"center";}s:1:"B";a:3:{s:4:"type";s:3:"vfs";s:4:"name";s:4:"$row";s:7:"onclick";s:18:"$row_cont[onclick]";}s:1:"C";a:4:{s:4:"type";s:8:"checkbox";s:4:"size";s:17:""$row_cont[name]"";s:4:"name";s:10:"selected[]";s:5:"align";s:5:"right";}}}s:4:"rows";i:1;s:4:"cols";i:3;s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"400";i:6;s:4:"auto";}}}i:3;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";s:4:"span";s:11:",selectName";s:6:"needed";s:1:"1";}}i:4;a:1:{s:1:"A";a:4:{s:4:"type";s:6:"select";s:4:"size";s:3:"All";s:4:"name";s:4:"mime";s:4:"span";s:11:",selectMime";}}i:5;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"@label";s:4:"name";s:10:"button[ok]";}i:2;a:4:{s:4:"type";s:10:"buttononly";s:4:"name";s:14:"button[cancel]";s:5:"label";s:6:"Cancel";s:7:"onclick";s:15:"window.close();";}s:5:"align";s:5:"right";}}}s:4:"rows";i:5;s:4:"cols";i:1;s:7:"options";a:1:{i:0;s:4:"100%";}s:4:"size";s:4:"100%";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"size";s:3:"600";s:7:"options";a:1:{i:0;s:3:"600";}}}','size' => '600','style' => '','modified' => '1239794780',); +$templ_data[] = array('name' => 'filemanager.select','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:2:{s:2:"c1";s:4:",top";s:1:"A";s:2:"32";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:4:"size";s:4:"home";s:4:"name";s:12:"button[home]";s:5:"align";s:6:"center";}s:1:"B";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:3:{s:2:"c2";s:11:"selectFiles";s:2:"h3";s:20:",@mode=open-multiple";s:2:"h4";s:15:",!@options-mime";}i:1;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:2:"js";}i:2;a:3:{s:4:"type";s:6:"button";s:4:"name";s:10:"button[up]";s:4:"size";s:4:"goup";}i:3;a:4:{s:4:"type";s:3:"vfs";s:4:"name";s:4:"path";s:7:"onclick";s:87:"path=document.getElementById(form::name(\'path\')); path.value=$path; path.form.submit();";s:4:"span";s:11:",selectPath";}i:4;a:3:{s:4:"type";s:4:"text";s:4:"name";s:4:"path";s:4:"span";s:12:",displayNone";}}}i:2;a:1:{s:1:"A";a:7:{s:4:"type";s:4:"grid";s:4:"size";s:17:"100%,400,,,,,auto";s:4:"name";s:3:"dir";s:4:"data";a:2:{i:0;a:3:{s:2:"c1";s:3:"row";s:1:"A";s:2:"20";s:1:"C";s:23:"1%,!@mode=open-multiple";}i:1;a:3:{s:1:"A";a:4:{s:4:"type";s:8:"vfs-mime";s:4:"name";s:12:"${row}[path]";s:4:"span";s:11:",selectIcon";s:5:"align";s:6:"center";}s:1:"B";a:3:{s:4:"type";s:3:"vfs";s:4:"name";s:4:"$row";s:7:"onclick";s:18:"$row_cont[onclick]";}s:1:"C";a:4:{s:4:"type";s:8:"checkbox";s:4:"size";s:17:""$row_cont[name]"";s:4:"name";s:10:"selected[]";s:5:"align";s:5:"right";}}}s:4:"rows";i:1;s:4:"cols";i:3;s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"400";i:6;s:4:"auto";}}}i:3;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";s:4:"span";s:11:",selectName";s:6:"needed";s:1:"1";}}i:4;a:1:{s:1:"A";a:5:{s:4:"type";s:6:"select";s:4:"size";s:9:"All files";s:4:"name";s:4:"mime";s:4:"span";s:11:",selectMime";s:8:"onchange";i:1;}}i:5;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"@label";s:4:"name";s:10:"button[ok]";}i:2;a:4:{s:4:"type";s:10:"buttononly";s:4:"name";s:14:"button[cancel]";s:5:"label";s:6:"Cancel";s:7:"onclick";s:15:"window.close();";}s:5:"align";s:5:"right";}}}s:4:"rows";i:5;s:4:"cols";i:1;s:7:"options";a:1:{i:0;s:4:"100%";}s:4:"size";s:4:"100%";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"size";s:3:"600";s:7:"options";a:1:{i:0;s:3:"600";}}}','size' => '600','style' => '','modified' => '1239794780',); diff --git a/filemanager/templates/default/select.xet b/filemanager/templates/default/select.xet index afabb9c04f..b3778a13df 100644 --- a/filemanager/templates/default/select.xet +++ b/filemanager/templates/default/select.xet @@ -42,9 +42,9 @@ - + - +