mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 02:14:45 +01:00
Import/Export fixes from trunk
This commit is contained in:
parent
1b61cc04bb
commit
25f4984ab4
@ -100,8 +100,8 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Custom fields & listed are not filtered with contact_ prefix
|
||||
if(strpos($field, '#') !== 0 && !in_array($field, array('tid')))
|
||||
// Custom fields & listed exceptions are not filtered with contact_ prefix
|
||||
if(strpos($field, '#') !== 0 && !in_array($field, array('tid','owner')))
|
||||
{
|
||||
$field = 'contact_'.$field;
|
||||
}
|
||||
@ -119,6 +119,10 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
||||
{
|
||||
$selection = explode(',',$options['selection']);
|
||||
}
|
||||
if(!is_array($selection))
|
||||
{
|
||||
$selection = array();
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app;
|
||||
|
||||
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
|
||||
|
@ -59,6 +59,23 @@ class importexport_definitions_bo {
|
||||
$query['col_filter'][] = $sql;
|
||||
}
|
||||
|
||||
// Handle allowed filter
|
||||
if($query['col_filter']['allowed_users'])
|
||||
{
|
||||
$allowed = array();
|
||||
foreach((array)$query['col_filter']['allowed_users'] as $id)
|
||||
{
|
||||
$allowed[] = 'allowed_users '.
|
||||
$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.
|
||||
$GLOBALS['egw']->db->quote('%,'.str_replace('_','\\_',$id) .',%');
|
||||
}
|
||||
if($allowed)
|
||||
{
|
||||
unset($query['col_filter']['allowed_users']);
|
||||
$query['col_filter'][] = '('.implode(' OR ', $allowed) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
$total = $this->so_sql->get_rows($query, $rows, $readonlys);
|
||||
$ro_count = 0;
|
||||
foreach($rows as &$row) {
|
||||
|
@ -174,7 +174,8 @@ class importexport_definitions_ui
|
||||
);
|
||||
if($_GET['application']) $content['nm']['col_filter']['application'] = $_GET['application'];
|
||||
}
|
||||
if(egw_session::appsession('index', 'importexport')) {
|
||||
if(egw_session::appsession('index', 'importexport'))
|
||||
{
|
||||
$content['nm'] = array_merge($content['nm'], egw_session::appsession('index', 'importexport'));
|
||||
}
|
||||
$content['nm']['actions'] = $this->get_actions();
|
||||
@ -183,7 +184,10 @@ class importexport_definitions_ui
|
||||
'import' => lang('import'),
|
||||
'export' => lang('export'),
|
||||
),
|
||||
'allowed_users' => array(null => lang('Private'), 'all' => lang('all'))
|
||||
'allowed_users' => array(
|
||||
array('value' => 'private', 'label' => lang('Private')),
|
||||
array('value' => 'all', 'label' => lang('all'))
|
||||
)
|
||||
);
|
||||
foreach ($this->plugins as $appname => $options)
|
||||
{
|
||||
@ -435,6 +439,13 @@ class importexport_definitions_ui
|
||||
public function get_rows(&$query, &$rows, &$readonlys) {
|
||||
$rows = array();
|
||||
egw_session::appsession('index','importexport',$query);
|
||||
|
||||
// Special handling for allowed users 'private'
|
||||
if($query['col_filter']['allowed_users'] == 'private')
|
||||
{
|
||||
unset($query['col_filter']['allowed_users']);
|
||||
$query['col_filter'][] = 'allowed_users = ' . $GLOBALS['egw']->db->quote(',,');
|
||||
}
|
||||
$bodefinitions = new importexport_definitions_bo($query['col_filter'], true);
|
||||
// We don't care about readonlys for the UI
|
||||
return $bodefinitions->get_rows($query, $rows, $discard);
|
||||
@ -852,6 +863,12 @@ class importexport_definitions_ui
|
||||
$content['just_me'] = true;
|
||||
}
|
||||
|
||||
$sel_options = array(
|
||||
'allowed_users' => array(
|
||||
array('value' => null, 'label' => lang('Just me')),
|
||||
array('value' => 'all', 'label' => lang('all users'))
|
||||
)
|
||||
);
|
||||
// Hide 'just me' checkbox, users get confused by read-only
|
||||
if($readonlys['just_me'] || !$this->can_edit($content))
|
||||
{
|
||||
|
@ -224,6 +224,8 @@ class importexport_export_ui {
|
||||
$content['filter'][$field] = importexport_helper_functions::date_rel2abs($content['filter'][$field]);
|
||||
}
|
||||
}
|
||||
// Filter is used twice in template, but can't have the same ID
|
||||
$content['filter_html'] = $content['filter_tpl'] = $content['filter'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,6 +288,7 @@ class importexport_export_ui {
|
||||
// Set filter
|
||||
// Note that because not all dates are DB dates, the plugin has to handle them
|
||||
$filter = array();
|
||||
$_content['filter'] = $_content['filter_html'] ? $_content['filter_html'] : $_content['filter_tpl'];
|
||||
if(is_array($_content['filter']))
|
||||
{
|
||||
foreach($_content['filter'] as $key => $value)
|
||||
|
@ -54,7 +54,7 @@ class importexport_widget_filter extends etemplate_widget_transformer
|
||||
error_log("$this has no fields");
|
||||
self::$transformation = array(
|
||||
'type' => 'label',
|
||||
'label' => 'No fields'
|
||||
'value' => 'No fields'
|
||||
);
|
||||
return parent::beforeSendToClient($cname);
|
||||
}
|
||||
|
@ -114,5 +114,48 @@ app.classes.importexport = AppJS.extend(
|
||||
appname: data.application,
|
||||
definition: data.definition_id
|
||||
}), false, '850x440', app);
|
||||
},
|
||||
|
||||
/**
|
||||
* Allowed users widget has been changed, if 'All users' or 'Just me'
|
||||
* was selected, turn off any other options.
|
||||
*/
|
||||
allowed_users_change: function(node, widget)
|
||||
{
|
||||
var value = widget.getValue();
|
||||
|
||||
// Only 1 selected, no checking needed
|
||||
if(value.length <= 1) return;
|
||||
|
||||
// Don't jump it to the top, it's weird
|
||||
widget.selected_first = false;
|
||||
|
||||
var index = null;
|
||||
var specials = ['','all']
|
||||
for(var i = 0; i < specials.length; i++)
|
||||
{
|
||||
var special = specials[i];
|
||||
if((index = value.indexOf(special)) >= 0)
|
||||
{
|
||||
if(window.event.target.value == special)
|
||||
{
|
||||
// Just clicked all/private, clear the others
|
||||
value = [special];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just added another, clear special
|
||||
value.splice(index,1);
|
||||
}
|
||||
|
||||
// A little highlight to call attention to the change
|
||||
$j('input[value="'+special+'"]',node).parent().parent().effect('highlight',{},500);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index >= 0)
|
||||
{
|
||||
widget.set_value(value);
|
||||
}
|
||||
}
|
||||
});
|
@ -17,14 +17,14 @@
|
||||
<nextmatch-filterheader id="type" options="importexport" class="lr_padding"/>
|
||||
<nextmatch-sortheader label="Name" id="name" class="lr_padding"/>
|
||||
<nextmatch-filterheader id="application" options="Application" class="lr_padding"/>
|
||||
<nextmatch-accountfilter align="center" label="Allowed users" id="allowed_users" options="All,groups" class="lr_padding"/>
|
||||
<nextmatch-accountfilter label="Owner" id="owner"/>
|
||||
<nextmatch-accountfilter align="center" id="allowed_users" options="Allowed users,groups" class="lr_padding"/>
|
||||
<nextmatch-accountfilter empty_label="Owner" id="owner"/>
|
||||
</row>
|
||||
<row class="row $row_cont[class]">
|
||||
<image src="${row}[type]" no_lang="1" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_${row_cont[type]}_ui.{$row_cont[type]}_dialog&appname=${row_cont[application]}&definition=${row_cont[name]}'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;" class="lr_padding button"/>
|
||||
<description id="${row}[name]" no_lang="1" class="lr_padding"/>
|
||||
<description id="${row}[application]" class="lr_padding"/>
|
||||
<listbox type="select-account" id="${row}[allowed_users]" no_lang="1" readonly="true" rows="5" options="both" class="lr_padding"/>
|
||||
<listbox type="select-account" id="${row}[allowed_users]" no_lang="1" readonly="true" rows="5" empty_label='Private' class="lr_padding"/>
|
||||
<menulist>
|
||||
<menupopup type="select-account" id="${row}[owner]" readonly="true"/>
|
||||
</menulist>
|
||||
|
@ -65,7 +65,7 @@
|
||||
<row valign="top" disabled="@plugin_selectors_template">
|
||||
<html id="plugin_selectors_html" no_lang="1"/>
|
||||
<box class="filters">
|
||||
<filter id="filter"/>
|
||||
<filter id="filter_html"/>
|
||||
</box>
|
||||
</row>
|
||||
<row class="th" height="20" disabled="!@plugin_selectors_template">
|
||||
@ -75,7 +75,7 @@
|
||||
<row valign="top" disabled="!@plugin_selectors_template">
|
||||
<template id="@plugin_selectors_template"/>
|
||||
<box onclick="jQuery('input[value=\'filter\']').not(':checked').attr('checked',true).parent().effect('highlight',{},2000);" class="filters">
|
||||
<filter id="filter"/>
|
||||
<filter id="filter_tpl"/>
|
||||
</box>
|
||||
</row>
|
||||
</rows>
|
||||
|
@ -10,14 +10,8 @@
|
||||
<row>
|
||||
<description id="msg" no_lang="1"/>
|
||||
</row>
|
||||
<row disabled="@no_just_me">
|
||||
<checkbox label="%s Just me" id="just_me"/>
|
||||
</row>
|
||||
<row disabled="@no_all_users">
|
||||
<checkbox label="%s All users" id="all_users"/>
|
||||
</row>
|
||||
<row>
|
||||
<listbox type="select-account" id="allowed_users" rows="5" account_type="groups"/>
|
||||
<listbox type="select-account" id="allowed_users" rows="5" account_type="groups" onchange="app.importexport.allowed_users_change"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
Loading…
Reference in New Issue
Block a user