* calendar/addressbook/importexport/merge-print: introduction of a static function to fetch the export limit, and normalize the possible output: bo_merge::getExportLimit; apply new function to bo_mergen, nextmatch_widget, addressbook, calendar and importexport; introduction of an calendar export limit; introduction of hook to provide appspecific export_limit

This commit is contained in:
Klaus Leithoff 2011-09-16 13:23:15 +00:00
parent 8f9c8732e9
commit 55dbf20c33
30 changed files with 241 additions and 126 deletions

View File

@ -40,7 +40,8 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
// Addressbook defines its own export imits
$limit_exception = bo_merge::is_export_limit_excepted();
if($GLOBALS['egw_info']['server']['contact_export_limit'] == 'no' && !$limit_exception) {
$export_limit = $export_object->export_limit = bo_merge::getExportLimit($app='addressbook');
if($export_limit == 'no' && !$limit_exception) {
return;
}
@ -65,8 +66,8 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
}
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app;
if($GLOBALS['egw_info']['server']['contact_export_limit'] && !$limit_exception) {
$selection = array_slice($selection, 0, $GLOBALS['egw_info']['server']['contact_export_limit']);
if(bo_merge::hasExportLimit($export_limit,'ISALLOWED') && !$limit_exception) {
$selection = array_slice($selection, 0, $export_limit);
}
if($options['explode_multiselects']) {
$customfields = config::get_customfields('addressbook');

View File

@ -374,6 +374,17 @@ class addressbook_hooks
);
}
/**
* Hook called to retrieve a app specific exportLimit
*
* @param array/string $location location and other parameters (not used)
* @return the export_limit to be applied for the app, may be empty, int or string
*/
static function getAppExportLimit($location)
{
return $GLOBALS['egw_info']['server']['contact_export_limit'];
}
/**
* Register contacts as calendar resources (items which can be sheduled by the calendar)
*

View File

@ -32,10 +32,7 @@ class addressbook_merge extends bo_merge
parent::__construct();
// overwrite global export-limit, if an addressbook one is set
if ($GLOBALS['egw_info']['server']['contact_export_limit'])
{
$this->export_limit = $GLOBALS['egw_info']['server']['contact_export_limit'];
}
$this->export_limit = bo_merge::getExportLimit('addressbook');
}
/**

View File

@ -82,17 +82,15 @@ class addressbook_ui extends addressbook_bo
{
$GLOBALS['egw_info']['flags']['java_script'].= $this->js();
}
// make sure the hook for export_limit is registered
if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','addressbook')) $GLOBALS['egw']->hooks->register_single_app_hook('addressbook','export_limit');
$this->config =& $GLOBALS['egw_info']['server'];
// check if a contact specific export limit is set, if yes use it also for etemplate's csv export
if ($this->config['contact_export_limit'])
{
$this->config['export_limit'] = $this->config['contact_export_limit'];
}
else // if not use the global one
{
$this->config['contact_export_limit'] = $this->config['export_limit'];
}
$this->config['export_limit'] = $this->config['contact_export_limit'] = bo_merge::getExportLimit($app='addressbook');
if ($this->config['copy_fields'] && ($fields = unserialize($this->config['copy_fields'])))
{
// Set country code if country name is selected

View File

@ -45,6 +45,8 @@ $setup_info['addressbook']['hooks']['edit_user'] = 'addressbook_hooks::edit_u
$setup_info['addressbook']['hooks'][] = 'config';
$setup_info['addressbook']['hooks']['group_acl'] = 'addressbook_hooks::group_acl';
$setup_info['addressbook']['hooks']['not_enum_group_acls'] = 'addressbook_hooks::not_enum_group_acls';
$setup_info['addressbook']['hooks']['export_limit'] = 'addressbook_hooks::getAppExportLimit';
/* Dependencies for this app to work */
$setup_info['addressbook']['depends'][] = array(

View File

@ -1491,7 +1491,7 @@ class calendar_bo
{
//_debug_array($event);
$names = array();
foreach($event['participants'] as $id => $status)
foreach((array)$event['participants'] as $id => $status)
{
calendar_so::split_status($status,$quantity,$role);

View File

@ -24,10 +24,9 @@ class calendar_export_csv implements importexport_iface_export_plugin {
public function export( $_stream, importexport_definition $_definition) {
$options = $_definition->plugin_options;
$this->bo = new calendar_bo();
$config = config::read('phpgwapi');
$limit_exception = bo_merge::is_export_limit_excepted();
if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar');
// Custom fields need to be specifically requested
$cfs = array();
foreach($options['mapping'] as $key => $label) {
@ -39,14 +38,14 @@ class calendar_export_csv implements importexport_iface_export_plugin {
'start' => $options['selection']['start'],
'end' => $options['selection']['end'],
'categories' => $options['categories'] ? $options['categories'] : $options['selection']['categories'],
'enum_recuring' => false,
//'enum_recuring' => false, // we want the recurring events enumerated for csv export
'daywise' => false,
'users' => $options['selection']['owner'],
'cfs' => $cfs // Otherwise we shouldn't get any custom fields
);
if($config['export_limit'] && !$limit_exception) {
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
$query['offset'] = 0;
$query['num_rows'] = (int)$config['export_limit'];
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
}
$events =& $this->bo->search($query);
} elseif ($options['selection']['select'] == 'search_results') {
@ -57,8 +56,8 @@ class calendar_export_csv implements importexport_iface_export_plugin {
$query['start'] = 0;
$query['cfs'] = $cfs;
if($config['export_limit'] && !$limit_exception) {
$query['num_rows'] = (int)$config['export_limit'];
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
}
$ui = new calendar_uilist();
$ui->get_rows($query, $events, $unused);
@ -66,8 +65,8 @@ class calendar_export_csv implements importexport_iface_export_plugin {
$query = $GLOBALS['egw']->session->appsession('session_data','calendar');
$query['users'] = explode(',', $query['owner']);
$query['num_rows'] = -1;
if($config['export_limit'] && !$limit_exception) {
$query['num_rows'] = (int)$config['export_limit'];
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
}
$events = array();
@ -89,8 +88,8 @@ class calendar_export_csv implements importexport_iface_export_plugin {
);
}
$bo = new calendar_boupdate();
$events = $bo->search($query + array(
$boupdate = new calendar_boupdate();
$events = $boupdate->search($query + array(
'offset' => 0,
'order' => 'cal_start',
));
@ -98,6 +97,7 @@ class calendar_export_csv implements importexport_iface_export_plugin {
}
$export_object = new importexport_export_csv($_stream, (array)$options);
if (!$limit_exception) $export_object->export_limit = $export_limit;
$export_object->set_mapping($options['mapping']);
$convert_fields = calendar_egw_record::$types;
@ -111,33 +111,34 @@ class calendar_export_csv implements importexport_iface_export_plugin {
3 => lang('High')
),
);
$record = new calendar_egw_record();
foreach ($events as $event) {
// Get rid of yearly recurring events that don't belong
if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue;
// the condition below (2 lines) may only work on enum_recuring=false and using the iterator to test an recurring event on the given timerange
// Get rid of yearly recurring events that don't belong
//if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue;
// Add in participants
if($options['mapping']['participants']) {
$event['participants'] = implode(", ",$this->bo->participants($event,true));
}
$record->set_record($event);
if($options['mapping']['recurrence']) {
$record->recurrence = $recurrence[$record->recur_type];
if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval;
}
// Standard stuff
if($options['convert']) {
importexport_export_csv::convert($record, $convert_fields, 'calendar', $lookups);
} else {
// Implode arrays, so they don't say 'Array'
foreach($record->get_record_array() as $key => $value) {
if(is_array($value)) $record->$key = implode(',', $value);
if (is_array($event))
{
$record->set_record($event);
if($options['mapping']['recurrence']) {
$record->recurrence = $recurrence[$record->recur_type];
if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval;
}
}
$export_object->export_record($record);
// Standard stuff
if($options['convert']) {
importexport_export_csv::convert($record, $convert_fields, 'calendar', $lookups);
} else {
// Implode arrays, so they don't say 'Array'
foreach($record->get_record_array() as $key => $value) {
if(is_array($value)) $record->$key = implode(',', $value);
}
}
$export_object->export_record($record);
}
}
unset($record);
}

View File

@ -33,6 +33,7 @@ class calendar_export_ical extends calendar_export_csv {
}
$limit_exception = bo_merge::is_export_limit_excepted();
if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar');
if($options['selection']['select'] == 'criteria') {
$query = array(
@ -44,9 +45,9 @@ class calendar_export_ical extends calendar_export_csv {
'users' => $options['selection']['owner'],
'cfs' => $cfs // Otherwise we shouldn't get any custom fields
);
if($config['export_limit'] && !$limit_exception) {
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
$query['offset'] = 0;
$query['num_rows'] = (int)$config['export_limit'];
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
}
$events =& $this->bo->search($query);
} elseif ($options['selection']['select'] == 'search_results') {
@ -57,8 +58,8 @@ class calendar_export_ical extends calendar_export_csv {
$query['start'] = 0;
$query['cfs'] = $cfs;
if($config['export_limit'] && !$limit_exception) {
$query['num_rows'] = (int)$config['export_limit'];
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
}
$ui = new calendar_uilist();
$ui->get_rows($query, $events, $unused);
@ -66,8 +67,8 @@ class calendar_export_ical extends calendar_export_csv {
$query = $GLOBALS['egw']->session->appsession('session_data','calendar');
$query['users'] = explode(',', $query['owner']);
$query['num_rows'] = -1;
if($config['export_limit'] && !$limit_exception) {
$query['num_rows'] = (int)$config['export_limit'];
if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) {
$query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0
}
$events = array();
@ -89,8 +90,8 @@ class calendar_export_ical extends calendar_export_csv {
);
}
$bo = new calendar_boupdate();
$events = $bo->search($query + array(
$boupdate = new calendar_boupdate();
$events = $boupdate->search($query + array(
'offset' => 0,
'order' => 'cal_start',
));

View File

@ -43,6 +43,17 @@ class calendar_hooks
);
}
/**
* Hook called to retrieve a app specific exportLimit
*
* @param array/string $location location and other parameters (not used)
* @return the export_limit to be applied for the app, may be empty, int or string
*/
static function getAppExportLimit($location)
{
return $GLOBALS['egw_info']['server']['calendar_export_limit'];
}
/**
* Draw calendar part of home
*/

View File

@ -68,6 +68,9 @@ class calendar_merge extends bo_merge
{
parent::__construct();
// overwrite global export-limit, if one is set for calendar/appointments
$this->export_limit = bo_merge::getExportLimit('calendar');
$this->bo = new calendar_boupdate();
self::$range_tags['start'] = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'];
@ -132,7 +135,12 @@ class calendar_merge extends bo_merge
$events = array($id);
$this->ids = $events;
}
// as this function allows to pass query- parameters, we need to check the result of the query against export_limit restrictions
if (bo_merge::hasExportLimit($this->export_limit) && !bo_merge::is_export_limit_excepted() && count($events) > (int)$this->export_limit)
{
$err = lang('No rights to export more than %1 entries!',(int)$this->export_limit);
throw new egw_exception_wrong_userinput($err);
}
$replacements = array();
$n = 0;
foreach($events as $event)

View File

@ -163,6 +163,9 @@ class calendar_ui
// calendar does not work with hidden sidebox atm.
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
// make sure the hook for export_limit is registered
if (!$GLOBALS['egw']->hooks->hook_exists('export_limit','calendar')) $GLOBALS['egw']->hooks->register_single_app_hook('calendar','export_limit');
}
/**
@ -820,7 +823,7 @@ function load_cal(url,id) {
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
}
$documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', $mime_filter);
$documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', $mime_filter,'calendar');
foreach($documents as $key => $value)
{
$options .= '<option value="'.html::htmlspecialchars($key).'">'.html::htmlspecialchars($value)."</option>\n";

View File

@ -799,9 +799,9 @@ class calendar_uilist extends calendar_ui
'hint' => 'Download this event as iCal',
'disableClass' => 'rowNoView',
);
$actions['documents'] = addressbook_merge::document_action(
$actions['documents'] = calendar_merge::document_action(
$this->bo->cal_prefs['document_dir'], ++$group, 'Insert in document', 'document_',
$this->bo->cal_prefs['default_document']
$this->bo->cal_prefs['default_document'],bo_merge::getExportLimit('calendar')
);
++$group;
$actions['delete'] = array(

View File

@ -237,6 +237,7 @@ holidays calendar de Feiertage
holidays only calendar de Nur Feiertage
hours calendar de Stunden
how far to search (from startdate) calendar de wie weit suchen (vom Startdatum)
how many appointments should non-admins be able to export admin de Wieviele Termine sollen Nicht-Adminstratoren exportieren können?
how many describtion lines should be directly visible. further lines are available via a scrollbar. calendar de Wieviele Zeilen der Beschreibung sollen direkt sichtbar sein (Rest über die Scrollbar)?
how many minutes should each interval last? calendar de Wie viele Minuten soll jedes Intervall dauern?
how many weeks should the multiple week view show? calendar de Wie viele Wochen soll die Mehrwochenansicht zeigen?

View File

@ -232,6 +232,7 @@ holidays calendar en Holidays
holidays only calendar en Holidays only
hours calendar en hours
how far to search (from startdate) calendar en How far to search (from start date)
how many appointments should non-admins be able to export admin en How many appointments should non-admins be able to export.
how many describtion lines should be directly visible. further lines are available via a scrollbar. calendar en How many description lines should be directly visible. Further lines are available via a scroll bar.
how many minutes should each interval last? calendar en How many minutes should each interval last?
how many weeks should the multiple week view show? calendar en How many weeks should the multiple week view show?

View File

@ -43,6 +43,7 @@ $setup_info['calendar']['hooks']['sidebox_menu'] = 'calendar.calendar_ui.sidebox
$setup_info['calendar']['hooks']['search_link'] = 'calendar_hooks::search_link';
$setup_info['calendar']['hooks']['config_validate'] = 'calendar_hooks::config_validate';
$setup_info['calendar']['hooks']['timesheet_set'] = 'calendar.calendar_bo.timesheet_set';
$setup_info['calendar']['hooks']['export_limit'] = 'calendar_hooks::getAppExportLimit';
/* Dependencies for this app to work */
$setup_info['calendar']['depends'][] = array(

View File

@ -12,10 +12,10 @@
</tr>
<tr class="row_off">
<td colspan="2"><b>{lang_Calendar} {lang_site_configuration}</b></td>
<td colspan="2">&nbsp;<b>{lang_Calendar} {lang_site_configuration}</b></td>
</tr>
<tr class="row_on">
<td>{lang_Do_you_wish_to_autoload_calendar_holidays_files_dynamically?}</td>
<td>&nbsp;{lang_Do_you_wish_to_autoload_calendar_holidays_files_dynamically?}</td>
<td>
<select name="newsettings[auto_load_holidays]">
<option value=""{selected_auto_load_holidays_False}>{lang_No}</option>
@ -24,7 +24,7 @@
</td>
</tr>
<tr class="row_off">
<td>{lang_Location_to_autoload_from}:</td>
<td>&nbsp;{lang_Location_to_autoload_from}:</td>
<td>
<select name="newsettings[holidays_url_path]">
<option value="localhost"{selected_holidays_url_path_localhost}>localhost</option>
@ -34,11 +34,11 @@
</tr>
<!-- lock setting -->
<tr class="row_on">
<td>{lang_setting_lock_time_calender}:</td>
<td>&nbsp;{lang_setting_lock_time_calender}:</td>
<td><input name="newsettings[Lock_Time_Calender]" value="{value_Lock_Time_Calender}" size="40"></td>
</tr>
<tr class="row_off">
<td>{lang_Deny_Ressources_reservation_for_private_events}:</td>
<td>&nbsp;{lang_Deny_Ressources_reservation_for_private_events}:</td>
<td>
<select name="newsettings[no_ressources_private]">
<option value="">{lang_No}</option>
@ -47,7 +47,7 @@
</td>
</tr>
<tr class="row_on">
<td>{lang_Require_an_ACL_grant_to_invite_other_users_and_groups}:</td>
<td>&nbsp;{lang_Require_an_ACL_grant_to_invite_other_users_and_groups}:</td>
<td>
<select name="newsettings[require_acl_invite]">
<option value="">{lang_No}: {lang_Every_user_can_invite_other_users_and_groups}</option>
@ -57,11 +57,11 @@
</td>
</tr>
<tr class="row_off">
<td>{lang_While_selecting_up_to_X_users_day-_and_weekview_is_not_consolidated_(5_is_used_when_not_set)}:</td>
<td>&nbsp;{lang_While_selecting_up_to_X_users_day-_and_weekview_is_not_consolidated_(5_is_used_when_not_set)}:</td>
<td><input name="newsettings[calview_no_consolidate]" value="{value_calview_no_consolidate}" size="10"></td>
</tr>
<tr class="row_on">
<td>{lang_Allow_users_to_prevent_change_notifications_('Do_not_notify')}:</td>
<td>&nbsp;{lang_Allow_users_to_prevent_change_notifications_('Do_not_notify')}:</td>
<td>
<select name="newsettings[calendar_allow_no_notification]">
<option value=""{selected_calendar_allow_no_notification_False}>{lang_No}</option>
@ -69,6 +69,11 @@
</select>
</td>
</tr>
<tr class="row_off">
<td>&nbsp;<b>{lang_Security}</b>: {lang_How_many_appointments_should_non-admins_be_able_to_export}
{lang_(empty_=_use_global_limit,_no_=_no_export_at_all)}:</td>
<td><input name="newsettings[calendar_export_limit]" value="{value_calendar_export_limit}" size="5"></td>
</tr>
<tr class="th">
<td colspan="2">&nbsp;<b>{lang_History_logging}</b></td>
</tr>
@ -98,10 +103,10 @@
</td>
</tr>
<tr class="th">
<td colspan="2"><b>{lang_Birthdays}</b></td>
<td colspan="2">&nbsp;<b>{lang_Birthdays}</b></td>
</tr>
<tr class="row_off">
<td>{lang_Show_birthdays_from_addressbook}:</td>
<td>&nbsp;{lang_Show_birthdays_from_addressbook}:</td>
<td>
<select name="newsettings[hide_birthdays]">
<option value="">{lang_Yes}</option>
@ -111,7 +116,7 @@
</td>
</tr>
<tr class="row_on">
<td>{lang_Calendar_recurrence_horizont_in_days_(default_1000)}:</td>
<td>&nbsp;{lang_Calendar_recurrence_horizont_in_days_(default_1000)}:</td>
<td><input size="5" name="newsettings[calendar_horizont]" value="{value_calendar_horizont}"></td>
</tr>

View File

@ -89,7 +89,7 @@ abstract class bo_merge
$this->datetime_format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' '.
($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12 ? 'h:i a' : 'H:i');
$this->export_limit = $GLOBALS['egw_info']['server']['export_limit'];
$this->export_limit = self::getExportLimit();
}
/**
@ -338,6 +338,66 @@ abstract class bo_merge
return $is_excepted;
}
/**
* getExportLimit
* checks if there is an exportlimit set, and returns
* @param mixed $app_limit checks and validates app_limit, if not set returns the global limit
*
* @return mixed - no if no export is allowed, false if there is no restriction and int as there is a valid restriction
* you may have to cast the returned value to int, if you want to use it as number
*/
public static function getExportLimit($app='common')
{
static $exportLimitStore;
if (is_null($exportLimitStore)) $exportLimitStore=array();
if (empty($app)) $app='common';
//error_log(__METHOD__.__LINE__.' called with app:'.$app);
if (!array_key_exists($app,$exportLimitStore))
{
//error_log(__METHOD__.__LINE__.' -> '.$app_limit.' '.function_backtrace());
$exportLimitStore[$app] = $GLOBALS['egw_info']['server']['export_limit'];
if ($app !='common')
{
$app_limit = $GLOBALS['egw']->hooks->single('export_limit',$app);
if ($app_limit) $exportLimitStore[$app] = $app_limit;
}
//error_log(__METHOD__.__LINE__.' building cache for app:'.$app.' -> '.$exportLimitStore[$app]);
if (empty($exportLimitStore[$app]))
{
$exportLimitStore[$app] = false;
return false;
}
if (is_numeric($exportLimitStore[$app]))
{
$exportLimitStore[$app] = (int)$exportLimitStore[$app];
}
else
{
$exportLimitStore[$app] = 'no';
}
//error_log(__METHOD__.__LINE__.' -> '.$exportLimit);
}
//error_log(__METHOD__.__LINE__.' app:'.$app.' -> '.$exportLimitStore[$app]);
return $exportLimitStore[$app];
}
/**
* hasExportLimit
* checks wether there is an exportlimit set, and returns true or false
* @param mixed $app_limit app_limit, if not set checks the global limit
* @param string $checkas [AND|ISALLOWED], AND default; if set to ISALLOWED it is checked if Export is allowed
*
* @return bool - true if no export is allowed or a limit is set, false if there is no restriction
*/
public static function hasExportLimit($app_limit,$checkas='AND')
{
if (strtoupper($checkas) == 'ISALLOWED') return (empty($app_limit) || ($app_limit !='no' && $app_limit > 0) );
if (empty($app_limit)) return false;
if ($app_limit == 'no') return true;
if ($app_limit > 0) return true;
}
/**
* Merges a given document with contact data
*
@ -356,9 +416,9 @@ abstract class bo_merge
return false;
}
if ($this->export_limit && !self::is_export_limit_excepted() && count($ids) > (int)$this->export_limit)
if (self::hasExportLimit($this->export_limit) && !self::is_export_limit_excepted() && count($ids) > (int)$this->export_limit)
{
$err = lang('No rights to export more then %1 entries!',(int)$this->export_limit);
$err = lang('No rights to export more than %1 entries!',(int)$this->export_limit);
return false;
}
@ -541,7 +601,7 @@ abstract class bo_merge
if ($countlables > 1) $lableprint = true;
if (count($ids) > 1 && !$contentrepeat)
{
$err = lang('for more then one contact in a document use the tag pagerepeat!');
$err = lang('for more than one contact in a document use the tag pagerepeat!');
return false;
}
foreach ((array)$ids as $id)
@ -549,12 +609,22 @@ abstract class bo_merge
if ($contentrepeat) $content = $contentrepeat; //content to repeat
if ($lableprint) $content = $Labelrepeat;
// generate replacements
if(!($replacements = $this->get_replacements($id,$content)))
// generate replacements; if exeption is thrown, catch it set error message and return false
try
{
$err = lang('Entry not found!');
if(!($replacements = $this->get_replacements($id,$content)))
{
$err = lang('Entry not found!');
return false;
}
}
catch (egw_exception_wrong_userinput $e)
{
// if this returns with an exeption, something failed big time
$err = $e->getMessage();
return false;
}
// some general replacements: current user, date and time
if (strpos($content,'$$user/') !== null && ($user = $GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')))
{
@ -1107,9 +1177,10 @@ abstract class bo_merge
* @param array|string $mime_filter=null allowed mime type(s), default all, negative filter if $mime_filter[0] === '!'
* @return array List of documents, suitable for a selectbox. The key is document_<filename>.
*/
public static function get_documents($dirs, $prefix='document_', $mime_filter=null)
public static function get_documents($dirs, $prefix='document_', $mime_filter=null, $app='')
{
if (!$dirs) return array();
$export_limit=self::getExportLimit($app);
if (!$dirs || (!self::hasExportLimit($export_limit,'ISALLOWED') && !self::is_export_limit_excepted())) return array();
// split multiple comma or whitespace separated directories
// to still allow space or comma in dirnames, we also use the trailing slash of all pathes to split
@ -1153,7 +1224,7 @@ abstract class bo_merge
/**
* Get insert-in-document action with optional default document on top
*
* If more then SHOW_DOCS_BY_MIME_LIMIT=10 documents found, they are displayed in submenus by mime type.
* If more than SHOW_DOCS_BY_MIME_LIMIT=10 documents found, they are displayed in submenus by mime type.
*
* @param string $dirs Directory(s comma or space separated) to search
* @param int $group see nextmatch_widget::egw_actions
@ -1166,10 +1237,8 @@ abstract class bo_merge
public static function document_action($dirs, $group=0, $caption='Insert in document', $prefix='document_', $default_doc='',
$export_limit=null)
{
if (is_null($export_limit)) $export_limit = $GLOBALS['egw_info']['server']['export_limit'];
$documents = array();
if ($export_limit == null) $export_limit = self::getExportLimit(); // check if there is a globalsetting
if ($default_doc && ($file = egw_vfs::stat($default_doc))) // put default document on top
{
$documents['document'] = array(
@ -1250,7 +1319,7 @@ abstract class bo_merge
'caption' => $caption,
'children' => $documents,
// disable action if no document or export completly forbidden for non-admins
'enabled' => (boolean)$documents && (empty($export_limit) || (int)$export_limit > 0 || self::is_export_limit_excepted()),
'enabled' => (boolean)$documents && (self::hasExportLimit($export_limit,'ISALLOWED') || self::is_export_limit_excepted()),
'hideOnDisabled' => true, // do not show 'Insert in document', if no documents defined or no export allowed
'group' => $group,
);

View File

@ -275,9 +275,10 @@ class nextmatch_widget
// save values in persistent extension_data to be able use it in post_process
unset($value['rows']);
$extension_data += $value;
list($app) = explode('.',$tmpl->name);
$export_limit = bo_merge::getExportLimit($app);
$value['no_csv_export'] = $value['csv_fields'] === false ||
$GLOBALS['egw_info']['server']['export_limit'] && !is_numeric($GLOBALS['egw_info']['server']['export_limit']) &&
!bo_merge::hasExportLimit($export_limit,'ISALLOWED') &&
!bo_merge::is_export_limit_excepted();
if (!$value['filter_onchange']) $value['filter_onchange'] = 'this.form.submit();';
@ -760,7 +761,7 @@ class nextmatch_widget
/**
* Action with submenu for categories
*
* Automatic switch to hierarchical display, if more then $max_cats_flat=14 cats found.
* Automatic switch to hierarchical display, if more than $max_cats_flat=14 cats found.
*
* @param string $app
* @param int $group=0 see self::egw_actions
@ -777,7 +778,7 @@ class nextmatch_widget
$cat = new categories(null,$app);
$cats = $cat->return_sorted_array($start=0, $limit=false, $query='', $sort='ASC', $order='cat_name', $globals, $parent_id, $unserialize_data=true);
// if more then max_length cats, switch automatically to hierarchical display
// if more than max_length cats, switch automatically to hierarchical display
if (count($cats) > $max_cats_flat)
{
$cat_actions = self::category_hierarchy($cats, $prefix, $parent_id);
@ -1069,7 +1070,7 @@ class nextmatch_widget
unset($header);
}
}
// do we have more then 5 cf's to display --> limit header height to 5 lines plus vertical scrollbar
// do we have more than 5 cf's to display --> limit header height to 5 lines plus vertical scrollbar
$num = !$allowed ? count($this->cfs) : count($allowed);
if ($num > 5)
{
@ -1447,9 +1448,12 @@ class nextmatch_widget
*/
static public function csv_export(&$value,$separator=';')
{
if (!bo_merge::is_export_limit_excepted())
$exportLimitExempted = bo_merge::is_export_limit_excepted();
if (!$exportLimitExempted)
{
$export_limit = $GLOBALS['egw_info']['server']['export_limit'];
$name = is_object($value['template']) ? $value['template']->name : $value['template'];
list($app) = explode('.',$name);
$export_limit = bo_merge::getExportLimit($app);
//if (isset($value['export_limit'])) $export_limit = $value['export_limit'];
}
$charset = $charset_out = translation::charset();
@ -1473,9 +1477,9 @@ class nextmatch_widget
{
break; // nothing to export
}
if ($export_limit && (!is_numeric($export_limit) || $export_limit < $total))
if (!$exportLimitExempted && (!bo_merge::hasExportLimit($export_limit,'ISALLOWED') || (int)$export_limit < $total))
{
etemplate::set_validation_error($name,lang('You are not allowed to export more then %1 entries!',$export_limit));
etemplate::set_validation_error($name,lang('You are not allowed to export more than %1 entries!',(int)$export_limit));
return false;
}
if (!isset($value['no_csv_support'])) $value['no_csv_support'] = !is_array($value['csv_fields']);

View File

@ -420,6 +420,6 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate cs XML soubor pro import
xslt template etemplate cs XSLT šablona
year etemplate cs Rok
you are not allowed to export more then %1 entries! etemplate cs Nemáte oprávnění exportovat více než %1 záznamů!
you are not allowed to export more than %1 entries! common cs Nemáte oprávnění exportovat více než %1 záznamů!
you can respond by visiting: etemplate cs Můžete odpovědět navštívením:
you need to select a file first! etemplate cs Nejprve musíte vybrat soubor!

View File

@ -187,7 +187,7 @@ file writen etemplate de Datei geschrieben
fileupload etemplate de DateiUpload
first etemplate de Zuerst
floating point etemplate de Gleitkommawert
for more then one contact in a document use the tag pagerepeat! preferences de Für mehr als einen Kontakt verwenden Sie bitte den Platzhalter pagerepeat. Damit können Sie dann Seriendokumente erstellen.
for more than one contact in a document use the tag pagerepeat! preferences de Für mehr als einen Kontakt verwenden Sie bitte den Platzhalter pagerepeat. Damit können Sie dann Seriendokumente erstellen.
foreign key etemplate de Foreign Key
formatted text (html) etemplate de Formatierter Text (HTML)
general fields: preferences de General fields:
@ -281,7 +281,7 @@ no column to swap with !!! etemplate de Keine Spalte um damit zu tauschen !!!
no file etemplate de keine Datei
no filename given or selected via browse... etemplate de kein Dateiname angegeben oder mit [Browse...] ausgewählt
no matches found etemplate de Keine Treffer gefunden
no rights to export more then %1 entries! etemplate de Sie haben keine Rechte mehr als %1 Einträge zu exportieren!
no rights to export more than %1 entries! common de Sie haben keine Rechte mehr als %1 Einträge zu exportieren!
no row to swap with !!! etemplate de Keine Zeile um damit zu tauschen !!!
not null etemplate de NOT NULL
nothing etemplate de nichts
@ -443,7 +443,7 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate de XML Datei zum Importieren
xslt template etemplate de XSLT Template
year etemplate de Jahr
you are not allowed to export more then %1 entries! etemplate de Sie sind nicht berechtigt mehr als %1 Datensätze zu exportieren!
you are not allowed to export more than %1 entries! common de Sie sind nicht berechtigt mehr als %1 Datensätze zu exportieren!
you can respond by visiting: etemplate de Sie können unter dem folgenden Verweis antworten:
you need to select a file first! etemplate de Sie müssen zuerst eine Datei auswählen!
your code is incorrect !!! etemplate de Ihr Code ist nicht richtig!!!

View File

@ -189,7 +189,7 @@ file writen etemplate en File written.
fileupload etemplate en File upload
first etemplate en First
floating point etemplate en Floating point
for more then one contact in a document use the tag pagerepeat! preferences en Use the tag page repeat for more than one contact in a document!
for more than one contact in a document use the tag pagerepeat! preferences en Use the tag page repeat for more than one contact in a document!
foreign key etemplate en Foreign key
formatted text (html) etemplate en Formatted text (HTML)
general fields: preferences en General fields:
@ -284,7 +284,7 @@ no column to swap with !!! etemplate en No column to swap with!
no file etemplate en No file
no filename given or selected via browse... etemplate en No filename
no matches found etemplate en No matches found.
no rights to export more then %1 entries! etemplate en No rights to export more then %1 entries!
no rights to export more than %1 entries! common en No rights to export more than %1 entries!
no row to swap with !!! etemplate en No row to swap with!
not null etemplate en NOT NULL
nothing etemplate en Nothing
@ -446,7 +446,7 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate en Xml file to import
xslt template etemplate en XSLT Template
year etemplate en Year
you are not allowed to export more then %1 entries! etemplate en You are not allowed to export more than %1 entries!
you are not allowed to export more than %1 entries! common en You are not allowed to export more than %1 entries!
you can respond by visiting: etemplate en You can respond by visiting
you need to select a file first! etemplate en Select a file first!
your code is incorrect !!! etemplate en Code is incorrect!

View File

@ -410,7 +410,7 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate es-es fichero xml a importar
xslt template etemplate es-es Plantilla XSLT
year etemplate es-es Año
you are not allowed to export more then %1 entries! etemplate es-es ¡No se le permite exportar más de %1 entradas!
you are not allowed to export more than %1 entries! common es-es ¡No se le permite exportar más de %1 entradas!
you can respond by visiting: etemplate es-es Puede responder visitando:
error uploading file! filemanager es-es ¡Error al subir el fichero!
maximum size for uploads filemanager es-es Tamaño máximo para subida de ficheros

View File

@ -178,7 +178,7 @@ file writen etemplate fi Tiedostoa kirjoitetaan
fileupload etemplate fi Tiedostoa ladataan
first etemplate fi Ensimmäinen
floating point etemplate fi Liukuva pilkku
for more then one contact in a document use the tag pagerepeat! etemplate fi Käytä sivuntoisto -komentoa useammalle kuin yhdelle yhteystiedolle!
for more than one contact in a document use the tag pagerepeat! etemplate fi Käytä sivuntoisto -komentoa useammalle kuin yhdelle yhteystiedolle!
foreign key etemplate fi Viiteavain
formatted text (html) etemplate fi Muotoiltu teksti (HTML)
go to the first entry etemplate fi Mene ensimmäiseen merkintään
@ -403,7 +403,7 @@ write tables etemplate fi Kirjoita taulukko
xml-file to import etemplate fi tuotava xml-tiedosto
xslt template etemplate fi XSLT -mallipohja
year etemplate fi Vuosi
you are not allowed to export more then %1 entries! etemplate fi Sinulla ei ole riittäviä oikeuksia viedä enemmän kuin %1 tietuetta!!!
you are not allowed to export more than %1 entries! common fi Sinulla ei ole riittäviä oikeuksia viedä enemmän kuin %1 tietuetta!!!
you can respond by visiting: etemplate fi Voit vastata vierailemalla:
you need to select a file first! etemplate fi Valitse tiedosto!
your code is incorrect !!! etemplate fi Virheellinen koodi!

View File

@ -410,7 +410,7 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate nl XML-bestand om te importeren
xslt template etemplate nl XSLT Template
year etemplate nl Jaar
you are not allowed to export more then %1 entries! etemplate nl Je mag niet meer dan %1 items exporteren!
you are not allowed to export more than %1 entries! common nl Je mag niet meer dan %1 items exporteren!
you can respond by visiting: etemplate nl Ju kunt reageren via:
error uploading file! filemanager nl Fout bij uploaden van bestand!
maximum size for uploads filemanager nl Maximum grootte voor uploads

View File

@ -410,7 +410,7 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate pt-br Importar arquivo xml
xslt template etemplate pt-br Modelo XSLT
year etemplate pt-br Ano
you are not allowed to export more then %1 entries! etemplate pt-br Você não tem permissão para exportar mais de %1 registros!
you are not allowed to export more than %1 entries! common pt-br Você não tem permissão para exportar mais de %1 registros!
you can respond by visiting: etemplate pt-br Você pode responder acessando:
error uploading file! filemanager pt-br Erro carregando arquivo!
maximum size for uploads filemanager pt-br Tamanho máximo para uploads

View File

@ -410,5 +410,5 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate ru файл xml для импорта
xslt template etemplate ru Шаблон XLST
year etemplate ru Год
you are not allowed to export more then %1 entries! etemplate ru Вам не разрешено экспортировать более чем %1 записей!
you are not allowed to export more than %1 entries! common ru Вам не разрешено экспортировать более чем %1 записей!
you can respond by visiting: etemplate ru Вы можете отозваться посетив:

View File

@ -174,7 +174,7 @@ file writen etemplate sk Súbor zapísaný
fileupload etemplate sk Nahrať Súbor
first etemplate sk Prvé
floating point etemplate sk Pohyblivá desatinná čiarka
for more then one contact in a document use the tag pagerepeat! etemplate sk Ak chcete mať v dokumente viac než jeden kontakt, použite značku opakovania strany!
for more than one contact in a document use the tag pagerepeat! etemplate sk Ak chcete mať v dokumente viac než jeden kontakt, použite značku opakovania strany!
foreign key etemplate sk Cudzí kľúč
formatted text (html) etemplate sk Formátovaný text (HTML)
go to the first entry etemplate sk choď na prvý záznam
@ -403,7 +403,7 @@ writes a 'etemplates.inc.php' file (for application in name) in the setup-dir of
xml-file to import etemplate sk xml súbor pre import
xslt template etemplate sk XSLT šablóna
year etemplate sk Rok
you are not allowed to export more then %1 entries! etemplate sk Nie je vám dovolené, exportovať viac než %1 záznamov!
you are not allowed to export more than %1 entries! common sk Nie je vám dovolené, exportovať viac než %1 záznamov!
you can respond by visiting: etemplate sk Odpovedať môžete na tejto adrese:
you need to select a file first! etemplate sk Je potrebné najprv vybrať súbor!
your code is incorrect !!! etemplate sk Váš kód je chybný!!!

View File

@ -37,8 +37,9 @@ class importexport_admin_prefs_sidebox_hooks
'icon' => 'import'
),
);
$config = config::read('phpgwapi');
if(bo_merge::is_export_limit_excepted() || $config['export_limit'] !== 'no')
$export_limit = bo_merge::getExportLimit($appname);
//error_log(__METHOD__.__LINE__.' app:'.$appname.' limit:'.$export_limit);
if(bo_merge::is_export_limit_excepted() || $export_limit !== 'no')
{
$file[] = array(
'text' => 'Export',
@ -121,8 +122,9 @@ class importexport_admin_prefs_sidebox_hooks
$file['Import CSV']['link'] = '';
}
}
$config = config::read('phpgwapi');
if ((bo_merge::is_export_limit_excepted() || !$config['export_limit'] || $config['export_limit'] > 0) && $cache[$appname]['export'])
$export_limit = bo_merge::getExportLimit($appname);
//error_log(__METHOD__.__LINE__.' app:'.$appname.' limit:'.$export_limit);
if ((bo_merge::is_export_limit_excepted() || bo_merge::hasExportLimit($export_limit,'ISALLOWED')) && $cache[$appname]['export'])
{
$file['Export CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php',array(
@ -140,7 +142,7 @@ class importexport_admin_prefs_sidebox_hooks
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'
))))
),$appname)))
{
$prefix = 'document_';

View File

@ -52,7 +52,7 @@ class importexport_export_csv implements importexport_iface_export_record
/**
* @var int holds max. number of records allowed to be exported
*/
protected $export_limit = 0;
public $export_limit = 0;
/**
* @var stream stream resource of csv file
@ -100,11 +100,11 @@ class importexport_export_csv implements importexport_iface_export_record
if ( !empty( $_options ) ) {
$this->csv_options = array_merge( $this->csv_options, $_options );
}
//error_log(__METHOD__.__LINE__.array2string($_options['appname']));
if(!bo_merge::is_export_limit_excepted()) {
$config = config::read('phpgwapi');
if($config['export_limit'] == 'no') throw new egw_exception_no_permission_admin('Export disabled');
$this->export_limit = (int)$config['export_limit'];
$this->export_limit = bo_merge::getExportLimit($_options['appname']);
//error_log(__METHOD__.__LINE__.' app:'.$_options['appname'].' limit:'.$this->export_limit);
if($this->export_limit == 'no') throw new egw_exception_no_permission_admin('Export disabled');
}
}

View File

@ -48,20 +48,19 @@ class importexport_export_ui {
$readonlys = array();
$preserv = array();
// Check global setting
if(!bo_merge::is_export_limit_excepted()) {
$config = config::read('phpgwapi');
if($config['export_limit'] == 'no') {
die(lang('Admin disabled exporting'));
}
}
$et = new etemplate(self::_appname. '.export_dialog');
$_appname = $_content['appname'] ? $_content['appname'] : $_GET['appname'];
$_definition = $_content['definition'] ? $_content['definition'] : $_GET['definition'];
$_plugin = $_content['plugin'] ? $_content['plugin'] : $_GET['plugin'];
$_selection = $_content['selection'] ? $_content['selection'] : $_GET['selection'];
// Check global setting
if(!bo_merge::is_export_limit_excepted()) {
$export_limit = bo_merge::getExportLimit($_appname);
if($export_limit == 'no') {
die(lang('Admin disabled exporting'));
}
}
//error_log(__FILE__.__FUNCTION__. '::$_GET[\'appname\']='. $_appname. ',$_GET[\'definition\']='. $_definition. ',$_GET[\'plugin\']='.$_plugin. ',$_GET[\'selection\']='.$_selection);
// if appname is given and valid, list available definitions (if no definition is given)
$readonlys['appname'] = (!empty($_appname) && $GLOBALS['egw']->acl->check('run',1,$_appname));