From 70a702691534d43723e8f1ebcc6fdc5f77bf2ff8 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 14 Sep 2011 13:09:13 +0000 Subject: [PATCH] * merge_print/calendar: control the availability of mergeprint and csv export, if the export_limit is set to ->no<- and the user in question is not exempted from export_limit restrictions --- calendar/inc/class.calendar_ui.inc.php | 5 +++++ etemplate/inc/class.bo_merge.inc.php | 2 +- etemplate/inc/class.nextmatch_widget.inc.php | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 99fe33178c..26782dfe82 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -163,6 +163,11 @@ class calendar_ui // calendar does not work with hidden sidebox atm. unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); + + $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 + $this->config['export_limit'] = $this->config['calendar_export_limit'] = bo_merge::getExportLimit($this->config['calendar_export_limit']); } /** diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index 4817e71e39..c49f5f630b 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -1172,7 +1172,7 @@ abstract class bo_merge */ public static function get_documents($dirs, $prefix='document_', $mime_filter=null) { - if (!$dirs) return array(); + if (!$dirs || (!self::hasExportLimit('','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 diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 86d004f2e8..46d9424143 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -760,7 +760,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 +777,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 +1069,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) { @@ -1475,7 +1475,7 @@ class nextmatch_widget } if ($export_limit && (!is_numeric($export_limit) || $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!',$export_limit)); return false; } if (!isset($value['no_csv_support'])) $value['no_csv_support'] = !is_array($value['csv_fields']);