mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-12 17:08:34 +01:00
using bo_merge::get_documents to get export documents
This commit is contained in:
parent
d13b605db8
commit
8e53f21349
@ -105,7 +105,7 @@ class importexport_admin_prefs_sidebox_hooks
|
|||||||
|
|
||||||
// Add in import / export, if available
|
// Add in import / export, if available
|
||||||
$file = array();
|
$file = array();
|
||||||
if($cache[$appname]['import'])
|
if($cache[$appname]['import'])
|
||||||
{
|
{
|
||||||
$file['Import CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
|
$file['Import CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
|
||||||
egw::link('/index.php',array(
|
egw::link('/index.php',array(
|
||||||
@ -118,7 +118,7 @@ class importexport_admin_prefs_sidebox_hooks
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$config = config::read('phpgwapi');
|
$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('".
|
$file['Export CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
|
||||||
egw::link('/index.php',array(
|
egw::link('/index.php',array(
|
||||||
@ -130,15 +130,14 @@ class importexport_admin_prefs_sidebox_hooks
|
|||||||
'text' => in_array($appname, array('calendar', 'sitemgr')) ? 'Export' : 'Export CSV'
|
'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_';
|
$prefix = 'document_';
|
||||||
|
|
||||||
$options = 'style="max-width:175px;" onchange="var window = egw_appWindow(\''.$appname.'\');
|
$options = 'style="max-width:175px;" onchange="var window = egw_appWindow(\''.$appname.'\');
|
||||||
if(window.egw_getActionManager) {
|
if(window.egw_getActionManager) {
|
||||||
var actionMgrs = window.egw_getActionManager(\''.$appname.'\').getActionsByAttr(\'type\', \'actionManager\');
|
var actionMgrs = window.egw_getActionManager(\''.$appname.'\').getActionsByAttr(\'type\', \'actionManager\');
|
||||||
var actionMgr = null;
|
var actionMgr = null;
|
||||||
@ -157,7 +156,7 @@ if(actionMgr && objectMgr && window.egwAction) {
|
|||||||
actionMgr.getActionById(\'select_all\').set_checked(true);
|
actionMgr.getActionById(\'select_all\').set_checked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.nm_action(action, objectMgr.selectedChildren);
|
window.nm_action(action, objectMgr.selectedChildren);
|
||||||
}
|
}
|
||||||
} else {';
|
} else {';
|
||||||
if($appname == 'calendar')
|
if($appname == 'calendar')
|
||||||
@ -174,7 +173,7 @@ this.value = \'\'"';
|
|||||||
'link' => false,
|
'link' => false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$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']) &&
|
||||||
count(importexport_helper_functions::get_plugins($appname)) > 0
|
count(importexport_helper_functions::get_plugins($appname)) > 0
|
||||||
@ -186,52 +185,4 @@ this.value = \'\'"';
|
|||||||
}
|
}
|
||||||
if($file) display_sidebox($appname,lang('importexport'),$file);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ class importexport_definitions_ui
|
|||||||
$bodefinitions->delete($selected);
|
$bodefinitions->delete($selected);
|
||||||
$action_msg = lang('deleted');
|
$action_msg = lang('deleted');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'export' :
|
case 'export' :
|
||||||
$action_msg = lang('exported');
|
$action_msg = lang('exported');
|
||||||
$mime_type = ($GLOBALS['egw']->html->user_agent == 'msie' || $GLOBALS['egw']->html->user_agent == 'opera') ?
|
$mime_type = ($GLOBALS['egw']->html->user_agent == 'msie' || $GLOBALS['egw']->html->user_agent == 'opera') ?
|
||||||
@ -681,7 +681,7 @@ class importexport_definitions_ui
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// throw new Exception('Already exists');
|
// throw new Exception('Already exists');
|
||||||
$content['duplicate_error'] = lang('Duplicate name, please choose another.');
|
$content['duplicate_error'] = lang('Duplicate name, please choose another.');
|
||||||
|
|
||||||
// Try some suggestions
|
// Try some suggestions
|
||||||
$suggestions = array(
|
$suggestions = array(
|
||||||
$content['name'] .'-'. $GLOBALS['egw_info']['user']['account_lid'],
|
$content['name'] .'-'. $GLOBALS['egw_info']['user']['account_lid'],
|
||||||
@ -859,20 +859,6 @@ class importexport_definitions_ui
|
|||||||
$data = config::read(self::_appname);
|
$data = config::read(self::_appname);
|
||||||
$data['share_definition'] = $GLOBALS['egw']->acl->get_ids_for_location('share_definition', EGW_ACL_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';
|
if(!$data['update']) $data['update'] = 'request';
|
||||||
|
|
||||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname);
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -16,21 +16,10 @@
|
|||||||
<description value="Users allowed to share their own definitions"/>
|
<description value="Users allowed to share their own definitions"/>
|
||||||
<listbox type="select-account" id="share_definition" rows="5" options="both"/>
|
<listbox type="select-account" id="share_definition" rows="5" options="both"/>
|
||||||
</row>
|
</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>
|
<row>
|
||||||
<hbox span="all">
|
<hbox span="all">
|
||||||
<button label="Save" id="save" span="all"/>
|
<button label="Save" id="save" span="all"/>
|
||||||
|
<button label="Cancel" id="cancel" span="all"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
|
Loading…
Reference in New Issue
Block a user