From 3e7cb195e682d615209f8ac83a5751c5b93c611a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 4 Sep 2008 06:44:48 +0000 Subject: [PATCH] - use start dir from prefs only if no path in session - more descriptiv labes in sidebox: + Your home directory + Home directories + Base directory - make some phrases translatable and use placeholders instead of concating partial phrases with the variable content --- .../inc/class.filemanager_hooks.inc.php | 39 ++++++++++++------- filemanager/inc/class.filemanager_ui.inc.php | 31 +++++++-------- filemanager/setup/egw_de.lang | 8 ++-- filemanager/setup/egw_en.lang | 14 +++---- 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php index fe8e3f0b42..3e4a8df6e8 100644 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -16,11 +16,17 @@ class filemanager_hooks { static $appname = 'filemanager'; static $foldercount = 1; + + /** + * Data for Filemanagers sidebox menu + * + * @param array $args + */ static function sidebox_menu($args) { $location = is_array($args) ? $args['location'] : $args; - $basepath = '/'; - $rootpath = '/home'; + $rootpath = '/'; + $basepath = '/home'; $homepath = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; //echo "

admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'

\n"; $config = config::read(self::$appname); @@ -29,20 +35,25 @@ class filemanager_hooks if ($location == 'sidebox_menu') { $title = $GLOBALS['egw_info']['apps'][self::$appname]['title'] . ' '. lang('Menu'); - $file = Array( - 'Home' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$homepath)), - 'Root' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$rootpath)), - # not sure if we want to offer a link to the base directory for default, this way i do that as preference - #'Base' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$basepath)), + $file = array( + 'Your home directory' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$homepath)), + 'Home directories' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$basepath)), ); - if (!empty($file_prefs['showbase']) && $file_prefs['showbase']=='yes') $file['Base']= $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$basepath)); + if (!empty($file_prefs['showbase']) && $file_prefs['showbase']=='yes') + { + $file['Basedirectory'] = $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$rootpath)); + } if (!empty($file_prefs['startfolder'])) $file['Startfolder']= $GLOBALS['egw']->link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$file_prefs['startfolder'])); - for ($i=1; $i<=self::$foldercount;$i++) { - if (!empty($file_prefs['folderlink'.$i])) { - $foldername = array_pop(explode("/",$file_prefs['folderlink'.$i])); - $file['Link '.$i.($foldername?": ($foldername)":'(Base)')]= $GLOBALS['egw']->link('/index.php',array( - 'menuaction'=>self::$appname.'.filemanager_ui.index', - 'path'=>$file_prefs['folderlink'.$i])); + for ($i=1; $i<=self::$foldercount; $i++) + { + if (!empty($file_prefs['folderlink'.$i])) + { + $foldername = array_pop(explode('/',$file_prefs['folderlink'.$i])); + $file[lang('Link %1: %2',$i,$foldername)]= $GLOBALS['egw']->link('/index.php',array( + 'menuaction' => self::$appname.'.filemanager_ui.index', + 'path' => $file_prefs['folderlink'.$i], + 'nolang' => true, + )); } } display_sidebox(self::$appname,$title,$file); diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index a269c6b3c1..e4ce542bec 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -48,7 +48,7 @@ class filemanager_ui 'no_cat' => True, // I disable the cat-selectbox 'lettersearch' => True, // I show a lettersearch 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] - 'start' => 0, // IO position in list + 'start' => 0, // IO position in list 'order' => 'name', // IO name of the column to sort after (optional for the sortheaders) 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' 'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns @@ -56,26 +56,23 @@ class filemanager_ui //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) 'path' => '/home/'.$GLOBALS['egw_info']['user']['account_lid'], ); + // check if user specified a valid startpath in his prefs --> use it + if (($path = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) && + $path[0] == '/' && egw_vfs::is_dir($path) && egw_vfs::check_access($path)) + { + $content['nm']['path'] = $path; + } } if (isset($_GET['msg'])) $msg = $_GET['msg']; - if (isset($_GET['path']) && ($path = $_GET['path']) - && $path[0] == '/' && egw_vfs::is_dir($path) - && egw_vfs::check_access($path,egw_vfs::READABLE)) + if (isset($_GET['path']) && ($path = $_GET['path'])) { - $content['nm']['path'] = $path; - } - else - { - if (isset($_GET['path'])) $msg .= lang('The requested path ').$_GET['path'].lang(' is not available.'); - if (!empty($GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) - && egw_vfs::is_dir($GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) - && egw_vfs::check_access($GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder'],egw_vfs::READABLE)) + if ($path[0] == '/' && egw_vfs::is_dir($path) && egw_vfs::check_access($path,egw_vfs::READABLE)) { - if (isset($_GET['path'])) $msg .= ' '.lang('You will be redirected to your Start Folder.'); - $content['nm']['path'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']; - } else { - if (isset($_GET['path'])) $msg .= ' '.lang('You will be redirected to your Home Directory.'); - $content['nm']['path'] = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; + $content['nm']['path'] = $path; + } + else + { + $msg .= lang('The requested path %1 is not available.',$path); } } } diff --git a/filemanager/setup/egw_de.lang b/filemanager/setup/egw_de.lang index 2b214741a0..946987cf83 100644 --- a/filemanager/setup/egw_de.lang +++ b/filemanager/setup/egw_de.lang @@ -17,6 +17,7 @@ actions filemanager de Befehle all subdirectories filemanager de Alle Unterverzeichnisse allow a maximum of the above configured folderlinks to be configured in settings admin de erlaube das oben eingestellte Maximum an Konfigurationsoptionen im Setting für Links zu Verzeichnissen and all it's childeren filemanager de und alle seine Kinder +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 check all filemanager de Alle auswählen @@ -83,9 +84,10 @@ go home filemanager de Heimatverzeichnis go to filemanager de Gehe zu go to your home directory filemanager de Zu Ihrem Heimverzeichnis wechseln go up filemanager de in das darüber liegende Verzeichnis wechseln +home directories filemanager de Persönliche Verzeichnisse id filemanager de Id inherited filemanager de Geerbt -is not available. filemanager de steht nicht zur Verfügung +link %1: %2 filemanager de %1. Verknüpfung: %2 location filemanager de Ort max folderlinks admin de maximale Anzahl von Links zu Verzeichnissen maximum size for uploads filemanager de Maximale Größe beim Hochladen @@ -119,7 +121,6 @@ renamed %1 to %2 filemanager de %1 nach %2 umbenannt renamed %1 to %2. filemanager de %1 nach %2 umbenannt. replaced %1 filemanager de %1 ersetzt rights filemanager de Rechte -root filemanager de root save %1 filemanager de %1 speichern save %1, and go back to file listing filemanager de %1 speichern, und zurück zur Verzeichnisansicht save changes filemanager de Änderungen speichern @@ -133,7 +134,7 @@ show link to filemanagers basedirectory (/) in side box menu? filemanager de Zei size filemanager de Größe sort folders always to the top? filemanager de Sortiere Verzeichnisse immer an den Anfang der Verzeichnisansicht start search filemanager de Suche starten -the requested path filemanager de Der angeforderte Verzeichnispfad +the requested path %1 is not available. filemanager de Der angeforderte Verzeichnispfad %1 steht nicht zur Verfügung. total files filemanager de Gesamtanzahl Dateien unused space filemanager de Nicht benutzter Platz up filemanager de Nach oben @@ -145,3 +146,4 @@ you need to select some files first! filemanager de Sie müssen zuerst die Datei you will be redirected to your home directory. filemanager de Sie werden zu Ihrem Heimatverzeichnis geleitet you will be redirected to your start folder. filemanager de Sie werden zu Ihrem Anfangs/Startverzeichnis geleitet your home dir did not exist, egroupware created a new one. filemanager de Ihr Heimatverzeichnis hat nicht existiert. eGroupware hat ein neues für Sie angelegt +your home directory filemanager de Ihr persönliches Verzeichnis diff --git a/filemanager/setup/egw_en.lang b/filemanager/setup/egw_en.lang index 17a1b39083..2120b62fe4 100644 --- a/filemanager/setup/egw_en.lang +++ b/filemanager/setup/egw_en.lang @@ -17,11 +17,10 @@ actions filemanager en Actions all subdirectories filemanager en All subdirectories 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 +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 check all filemanager en Check all -choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates filemanager en Choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates -choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date filemanager en Choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date clear search filemanager en clear search comment filemanager en Comment comments cannot contain "%1" filemanager en Comments cannot contain "%1" @@ -68,7 +67,6 @@ executable filemanager en Executable extended access control list filemanager en Extended access control list extended acl filemanager en Extended ACL failed to create directory! filemanager en Failed to create directory! -fake base dir did not exist, egroupware created a new one. filemanager en Fake Base Dir did not exist, eGroupWare created a new one. file filemanager en File file %1 already exists. please edit it or delete it first. filemanager en File %1 already exists. Please edit it or delete it first. file %1 could not be created. filemanager en File %1 could not be created. @@ -86,9 +84,10 @@ go home filemanager en go home go to filemanager en Go to go to your home directory filemanager en Go to your home directory go up filemanager en go up +home directories filemanager en Home directories id filemanager en Id inherited filemanager en Inherited -is not available. filemanager en is not available. +link %1: %2 filemanager en Link %1: %2 location filemanager en Location max folderlinks admin en max folderlinks maximum size for uploads filemanager en Maximum size for uploads @@ -122,7 +121,6 @@ renamed %1 to %2 filemanager en Renamed %1 to %2 renamed %1 to %2. filemanager en Renamed %1 to %2. replaced %1 filemanager en Replaced %1 rights filemanager en Rights -root filemanager en root save %1 filemanager en Save %1 save %1, and go back to file listing filemanager en Save %1, and go back to file listing save changes filemanager en Save changes @@ -136,18 +134,16 @@ show link to filemanagers basedirectory (/) in side box menu? filemanager en Sho size filemanager en Size sort folders always to the top? filemanager en Sort folders always to the top? start search filemanager en start search -the requested path filemanager en The requested path +the requested path %1 is not available. filemanager en The requested path %1 is not available. total files filemanager en Total Files unused space filemanager en Unused space up filemanager en Up updated comment for %1 filemanager en Updated comment for %1 -upload fields filemanager en upload fields -upload files filemanager en Upload files used space filemanager en Used space -who filemanager en Who you do not have access to %1 filemanager en You do not have access to %1 you need to select an owner! filemanager en You need to select an owner! you need to select some files first! filemanager en You need to select some files first! you will be redirected to your home directory. filemanager en You will be redirected to your Home Directory. you will be redirected to your start folder. filemanager en You will be redirected to your Start Folder. your home dir did not exist, egroupware created a new one. filemanager en Your Home Dir did not exist, eGroupWare created a new one. +your home directory filemanager en Your home directory