From 0fe856dc645c6e33ba39f203afdf480accd7aebd Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Wed, 22 Nov 2023 11:13:43 +0800 Subject: [PATCH] * Limit max chart checked in preview to 6. --- module/chart/config.php | 5 +++-- module/chart/control.php | 3 +++ module/chart/lang/de.php | 1 + module/chart/lang/en.php | 1 + module/chart/lang/fr.php | 1 + module/chart/lang/zh-cn.php | 1 + module/chart/view/preview.html.php | 1 - 7 files changed, 10 insertions(+), 3 deletions(-) diff --git a/module/chart/config.php b/module/chart/config.php index 7ac69a2543..c1d76bea9d 100644 --- a/module/chart/config.php +++ b/module/chart/config.php @@ -2,8 +2,9 @@ $config->chart->widthInput = 128; $config->chart->widthDate = 248; -$config->chart->labelMaxLength = 8; -$config->chart->canLabelRotate = array('line', 'cluBarX', 'cluBarY', 'stackedBar', 'stackedBarY'); +$config->chart->labelMaxLength = 8; +$config->chart->canLabelRotate = array('line', 'cluBarX', 'cluBarY', 'stackedBar', 'stackedBarY'); +$config->chart->chartMaxChecked = 6; $config->chart->dateConvert = array(); $config->chart->dateConvert['year'] = 'YEAR'; diff --git a/module/chart/control.php b/module/chart/control.php index fae3b4a364..3abf7dd36e 100644 --- a/module/chart/control.php +++ b/module/chart/control.php @@ -29,6 +29,9 @@ class chart extends control if(!empty($_POST)) { + $chartChecked = count($this->post->charts); + if($chartChecked > $this->config->chart->chartMaxChecked) $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->chart->chartMaxChecked, $this->config->chart->chartMaxChecked))); + $charts = array(); foreach($this->post->charts as $value) { diff --git a/module/chart/lang/de.php b/module/chart/lang/de.php index 2844c9b4fe..c41edd7512 100644 --- a/module/chart/lang/de.php +++ b/module/chart/lang/de.php @@ -23,6 +23,7 @@ $lang->chart->groupWeek = 'Week %s,%s'; $lang->chart->noChart = 'No Chart'; $lang->chart->noChartSelected = 'Please select one chart.'; +$lang->chart->chartMaxChecked = 'You can only select up to %s charts.'; $lang->chart->aggList = array(); $lang->chart->aggList['count'] = 'Count'; diff --git a/module/chart/lang/en.php b/module/chart/lang/en.php index 2844c9b4fe..c41edd7512 100644 --- a/module/chart/lang/en.php +++ b/module/chart/lang/en.php @@ -23,6 +23,7 @@ $lang->chart->groupWeek = 'Week %s,%s'; $lang->chart->noChart = 'No Chart'; $lang->chart->noChartSelected = 'Please select one chart.'; +$lang->chart->chartMaxChecked = 'You can only select up to %s charts.'; $lang->chart->aggList = array(); $lang->chart->aggList['count'] = 'Count'; diff --git a/module/chart/lang/fr.php b/module/chart/lang/fr.php index 2844c9b4fe..c41edd7512 100644 --- a/module/chart/lang/fr.php +++ b/module/chart/lang/fr.php @@ -23,6 +23,7 @@ $lang->chart->groupWeek = 'Week %s,%s'; $lang->chart->noChart = 'No Chart'; $lang->chart->noChartSelected = 'Please select one chart.'; +$lang->chart->chartMaxChecked = 'You can only select up to %s charts.'; $lang->chart->aggList = array(); $lang->chart->aggList['count'] = 'Count'; diff --git a/module/chart/lang/zh-cn.php b/module/chart/lang/zh-cn.php index 152fee184c..f982b2a9de 100644 --- a/module/chart/lang/zh-cn.php +++ b/module/chart/lang/zh-cn.php @@ -23,6 +23,7 @@ $lang->chart->groupWeek = '%s年第%s周'; $lang->chart->noChart = '暂时没有图表'; $lang->chart->noChartSelected = '请选择至少一个图表。'; +$lang->chart->chartMaxChecked = '最多只能选择%s个图表。'; $lang->chart->aggList = array(); $lang->chart->aggList['count'] = '计数'; diff --git a/module/chart/view/preview.html.php b/module/chart/view/preview.html.php index d90bdb2c81..5a3e8091cc 100644 --- a/module/chart/view/preview.html.php +++ b/module/chart/view/preview.html.php @@ -63,7 +63,6 @@
- chart->preview, '', 'btn btn-primary');?>