mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Special fiddling so No filters favorite gives default results
- switch filter values so '' => Current directory - Add check for missing path, set to home directory if missing
This commit is contained in:
parent
8ca9f9a469
commit
ad57f6cc5e
@ -253,7 +253,7 @@ class filemanager_ui
|
|||||||
{
|
{
|
||||||
$content['nm'] = array(
|
$content['nm'] = array(
|
||||||
'get_rows' => 'filemanager.filemanager_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows'
|
'get_rows' => 'filemanager.filemanager_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows'
|
||||||
'filter' => '1', // current dir only
|
'filter' => '', // current dir only
|
||||||
'no_filter2' => True, // I disable the 2. filter (params are the same as for filter)
|
'no_filter2' => True, // I disable the 2. filter (params are the same as for filter)
|
||||||
'no_cat' => True, // I disable the cat-selectbox
|
'no_cat' => True, // I disable the cat-selectbox
|
||||||
'lettersearch' => True, // I show a lettersearch
|
'lettersearch' => True, // I show a lettersearch
|
||||||
@ -306,7 +306,7 @@ class filemanager_ui
|
|||||||
// reset lettersearch as it confuses users (they think the dir is empty)
|
// reset lettersearch as it confuses users (they think the dir is empty)
|
||||||
$content['nm']['searchletter'] = false;
|
$content['nm']['searchletter'] = false;
|
||||||
// switch recusive display off
|
// switch recusive display off
|
||||||
if (!$content['nm']['filter']) $content['nm']['filter'] = '1';
|
if (!$content['nm']['filter']) $content['nm']['filter'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$view = self::get_view();
|
$view = self::get_view();
|
||||||
@ -447,10 +447,10 @@ class filemanager_ui
|
|||||||
$readonlys['button[mailpaste]'] = !isset($GLOBALS['egw_info']['user']['apps']['felamimail']);
|
$readonlys['button[mailpaste]'] = !isset($GLOBALS['egw_info']['user']['apps']['felamimail']);
|
||||||
|
|
||||||
$sel_options['filter'] = array(
|
$sel_options['filter'] = array(
|
||||||
'1' => 'Current directory',
|
'' => 'Current directory',
|
||||||
'2' => 'Directories sorted in',
|
'2' => 'Directories sorted in',
|
||||||
'3' => 'Show hidden files',
|
'3' => 'Show hidden files',
|
||||||
'' => 'Files from subdirectories',
|
'0' => 'Files from subdirectories',
|
||||||
);
|
);
|
||||||
$tpl->setElementAttribute('nm', 'onfiledrop', 'app.filemanager.filedrop');
|
$tpl->setElementAttribute('nm', 'onfiledrop', 'app.filemanager.filedrop');
|
||||||
|
|
||||||
@ -711,6 +711,8 @@ class filemanager_ui
|
|||||||
{
|
{
|
||||||
egw_session::appsession('index','filemanager',$query);
|
egw_session::appsession('index','filemanager',$query);
|
||||||
}
|
}
|
||||||
|
if(!$query['path']) $query['path'] = self::get_home_dir();
|
||||||
|
|
||||||
// be tolerant with (in previous versions) not correct urlencoded pathes
|
// be tolerant with (in previous versions) not correct urlencoded pathes
|
||||||
if (!egw_vfs::stat($query['path'],true) && egw_vfs::stat(urldecode($query['path'])))
|
if (!egw_vfs::stat($query['path'],true) && egw_vfs::stat(urldecode($query['path'])))
|
||||||
{
|
{
|
||||||
@ -743,16 +745,19 @@ class filemanager_ui
|
|||||||
{
|
{
|
||||||
$namefilter = '/'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i';
|
$namefilter = '/'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-map so 'No filters' favorite ('') is depth 1
|
||||||
|
$filter = $query['filter'] === '' ? 1 : $query['filter'];
|
||||||
foreach(egw_vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'],array(
|
foreach(egw_vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'],array(
|
||||||
'mindepth' => 1,
|
'mindepth' => 1,
|
||||||
'maxdepth' => $query['filter'] ? (int)(boolean)$query['filter'] : null,
|
'maxdepth' => $filter ? (int)(boolean)$filter : null,
|
||||||
'dirsontop' => $query['filter'] <= 1,
|
'dirsontop' => $filter <= 1,
|
||||||
'type' => $query['filter'] ? null : 'f',
|
'type' => $filter ? null : 'f',
|
||||||
'order' => $query['order'], 'sort' => $query['sort'],
|
'order' => $query['order'], 'sort' => $query['sort'],
|
||||||
'limit' => (int)$query['num_rows'].','.(int)$query['start'],
|
'limit' => (int)$query['num_rows'].','.(int)$query['start'],
|
||||||
'need_mime' => true,
|
'need_mime' => true,
|
||||||
'name_preg' => $namefilter,
|
'name_preg' => $namefilter,
|
||||||
'hidden' => $query['filter'] == 3,
|
'hidden' => $filter == 3,
|
||||||
),true) as $path => $row)
|
),true) as $path => $row)
|
||||||
{
|
{
|
||||||
//echo $path; _debug_array($row);
|
//echo $path; _debug_array($row);
|
||||||
|
Loading…
Reference in New Issue
Block a user