using bo_merge::get_documents to get export documents

This commit is contained in:
Ralf Becker 2011-06-17 14:07:10 +00:00
parent d13b605db8
commit 8e53f21349
4 changed files with 15 additions and 89 deletions

View File

@ -118,7 +118,7 @@ class importexport_admin_prefs_sidebox_hooks
);
}
$config = config::read('phpgwapi');
if(($GLOBALS['egw_info']['user']['apps']['admin'] || $config['export_limit'] !== 'no') && $cache[$appname]['export'])
if (($GLOBALS['egw_info']['user']['apps']['admin'] || !$config['export_limit'] || $config['export_limit'] > 0) && $cache[$appname]['export'])
{
$file['Export CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php',array(
@ -130,12 +130,11 @@ class importexport_admin_prefs_sidebox_hooks
'text' => in_array($appname, array('calendar', 'sitemgr')) ? 'Export' : 'Export CSV'
);
}
if($list = self::get_spreadsheet_list($appname))
if(($file_list = bo_merge::get_documents($GLOBALS['egw_info']['user']['preferences'][$appname]['document_dir'], '', array(
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
))))
{
$file_list = array();
foreach($list as $_file) {
$file_list[$_file['path']] = egw_vfs::decodePath($_file['name']);
}
$prefix = 'document_';
$options = 'style="max-width:175px;" onchange="var window = egw_appWindow(\''.$appname.'\');
@ -186,52 +185,4 @@ this.value = \'\'"';
}
if($file) display_sidebox($appname,lang('importexport'),$file);
}
/**
* Get a list of spreadsheets, in the user's preference folder, and / or a system provided template folder
*/
public static function get_spreadsheet_list($app) {
$config = config::read('importexport');
$config_dirs = $config['export_spreadsheet_folder'] ? explode(',',$config['export_spreadsheet_folder']) : array('user','stylite');
$appname = $_GET['app'] ? $_GET['app'] : $app;
$stylite_dir = '/stylite/templates/merge';
$dir_list = array();
$file_list = array();
$mimes = array(
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
if(in_array('user', $config_dirs)) {
$dir_list[] = $GLOBALS['egw_info']['user']['preferences'][$appname]['document_dir'];
}
if(in_array('stylite', $config_dirs) && is_dir($stylite_dir)) {
$dir_list[] = $stylite_dir;
}
foreach($dir_list as $dir) {
if ($dir && ($files = egw_vfs::find($dir,array(
'need_mime' => true,
'order' => 'fs_name',
'sort' => 'ASC',
),true)))
{
foreach($files as $file) {
if($dir != $GLOBALS['egw_info']['user']['preferences'][$appname]['document_dir']) {
// Stylite files have a naming convention that must be adhered to
list($export, $application, $name) = explode('-', $file['name'], 3);
}
if(($dir == $GLOBALS['egw_info']['user']['preferences'][$appname]['document_dir'] || ($export == 'export' && $application == $appname)) && in_array($file['mime'], $mimes)) {
$file_list[] = array(
'name' => $name ? $name : $file['name'],
'path' => $file['path'],
'mime' => $file['mime']
);
}
}
}
}
return $file_list;
}
}

View File

@ -859,20 +859,6 @@ class importexport_definitions_ui
$data = config::read(self::_appname);
$data['share_definition'] = $GLOBALS['egw']->acl->get_ids_for_location('share_definition', EGW_ACL_READ, self::_appname);
// Folder stuff should really be part of etemplate (merge base is in there)
// but the sidebox link works best if they're together
if(!array_key_exists('export_spreadsheet_folder', $data)) $data['export_spreadsheet_folder'] = 'user,stylite';
$sel_options = array(
'export_spreadsheet_folder' => array(
'user' => lang('User template folder'),
)
);
if($GLOBALS['egw_info']['apps']['stylite']) {
$sel_options['export_spreadsheet_folder'] += array(
'stylite' => lang('Stylite template folder'),
);
}
if(!$data['update']) $data['update'] = 'request';
$GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname);

File diff suppressed because one or more lines are too long

View File

@ -16,21 +16,10 @@
<description value="Users allowed to share their own definitions"/>
<listbox type="select-account" id="share_definition" rows="5" options="both"/>
</row>
<row valign="top">
<description value="Export Spreadsheet link display folders"/>
<listbox id="export_spreadsheet_folder" rows="3"/>
</row>
<row valign="top">
<description value="Update/insert new default-definitions"/>
<vbox>
<radio label="Never" id="update" options="never"/>
<radio label="Only on request" id="update" options="request"/>
<radio label="On every update" id="update" options="auto"/>
</vbox>
</row>
<row>
<hbox span="all">
<button label="Save" id="save" span="all"/>
<button label="Cancel" id="cancel" span="all"/>
</hbox>
</row>
</rows>