For filemanager index, store current view (tile/row) as implicit preference

This commit is contained in:
Nathan Gray 2015-01-16 17:07:18 +00:00
parent 28410fc81b
commit 0f6eeed9ca
2 changed files with 9 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class filemanager_favorite_portlet extends home_favorite_portlet
$ui = new filemanager_ui(); $ui = new filemanager_ui();
$this->nm_settings += array( $this->nm_settings += array(
'get_rows' => 'filemanager.filemanager_ui.get_rows', 'get_rows' => 'filemanager.filemanager_favorite_portlet.get_rows',
'csv_export' => true, 'csv_export' => true,
// Use a different template so it can be accessed from client side // Use a different template so it can be accessed from client side
'template' => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows' ), 'template' => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows' ),

View File

@ -300,6 +300,7 @@ class filemanager_ui
$content['nm']['path'] = static::get_home_dir(); $content['nm']['path'] = static::get_home_dir();
} }
$content['nm']['home_dir'] = static::get_home_dir(); $content['nm']['home_dir'] = static::get_home_dir();
$content['nm']['view'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['nm_view'];
if (isset($_GET['msg'])) $msg = $_GET['msg']; if (isset($_GET['msg'])) $msg = $_GET['msg'];
@ -782,6 +783,13 @@ class filemanager_ui
if($query['view']) if($query['view'])
{ {
$query['template'] = ($query['view'] == 'row' ? 'filemanager.index.rows' : 'filemanager.tile'); $query['template'] = ($query['view'] == 'row' ? 'filemanager.index.rows' : 'filemanager.tile');
// Store as preference but only for index, not home
if($query['get_rows'] == 'filemanager.filemanager_ui.get_rows')
{
$GLOBALS['egw']->preferences->add('filemanager','nm_view',$query['view']);
$GLOBALS['egw']->preferences->save_repository();
}
} }
// 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'])))