Only show spreadsheet link if app has spreadsheets to show

This commit is contained in:
Nathan Gray 2011-05-02 17:21:26 +00:00
parent ba25d07453
commit 87c960b6ea

View File

@ -129,7 +129,7 @@ class importexport_admin_prefs_sidebox_hooks
'text' => 'Export CSV' 'text' => 'Export CSV'
); );
} }
if(self::get_spreadsheet_list($appname)) {
$file['Export Spreadsheet'] = array('link' => egw::link('/index.php',array( $file['Export Spreadsheet'] = array('link' => egw::link('/index.php',array(
'menuaction' => 'importexport.importexport_admin_prefs_sidebox_hooks.spreadsheet_list', 'menuaction' => 'importexport.importexport_admin_prefs_sidebox_hooks.spreadsheet_list',
'app' => $appname 'app' => $appname
@ -138,6 +138,7 @@ class importexport_admin_prefs_sidebox_hooks
'app' => 'importexport', 'app' => 'importexport',
'text' => 'Export Spreadsheet' 'text' => 'Export Spreadsheet'
); );
}
$config = config::read('importexport'); $config = config::read('importexport');
if($appname != 'admin' && ($config['users_create_definitions'] || $GLOBALS['egw_info']['user']['apps']['admin']) && if($appname != 'admin' && ($config['users_create_definitions'] || $GLOBALS['egw_info']['user']['apps']['admin']) &&
@ -151,10 +152,10 @@ class importexport_admin_prefs_sidebox_hooks
if($file) display_sidebox($appname,lang('importexport'),$file); if($file) display_sidebox($appname,lang('importexport'),$file);
} }
public function spreadsheet_list() { protected static function get_spreadsheet_list($app) {
$config = config::read('importexport'); $config = config::read('importexport');
$config_dirs = $config['export_spreadsheet_folder'] ? explode(',',$config['export_spreadsheet_folder']) : array('user','stylite'); $config_dirs = $config['export_spreadsheet_folder'] ? explode(',',$config['export_spreadsheet_folder']) : array('user','stylite');
$appname = $_GET['app']; $appname = $_GET['app'] ? $_GET['app'] : $app;
$stylite_dir = '/stylite/templates/merge'; $stylite_dir = '/stylite/templates/merge';
$dir_list = array(); $dir_list = array();
$file_list = array(); $file_list = array();
@ -192,7 +193,11 @@ class importexport_admin_prefs_sidebox_hooks
} }
} }
} }
return $file_list;
}
public function spreadsheet_list() {
$file_list = self::get_spreadsheet_list();
$GLOBALS['egw_info']['flags']['app_header'] = lang('Export (merge) spreadsheets'); $GLOBALS['egw_info']['flags']['app_header'] = lang('Export (merge) spreadsheets');
$tmpl = new etemplate('importexport.spreadsheet_list'); $tmpl = new etemplate('importexport.spreadsheet_list');
$tmpl->exec('importexport.importexport_admin_hooks.spreadsheet_list', array('files' => $file_list)); $tmpl->exec('importexport.importexport_admin_hooks.spreadsheet_list', array('files' => $file_list));