From b1eea9afa70651a679f5d229b7e6a84ecd4d98ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E8=BE=B0=E8=BD=A9?= Date: Mon, 17 Apr 2023 17:15:07 +0800 Subject: [PATCH 1/4] * Fix bug #34275. --- module/chart/js/common.js | 14 +++++ module/chart/js/preview.js | 86 +++++++++++++++--------------- module/chart/view/preview.html.php | 6 +-- 3 files changed, 61 insertions(+), 45 deletions(-) diff --git a/module/chart/js/common.js b/module/chart/js/common.js index f7d9bf587c..715932d691 100644 --- a/module/chart/js/common.js +++ b/module/chart/js/common.js @@ -87,3 +87,17 @@ function initDatepicker($obj, callback) if(typeof callback == 'function') callback($obj); } + +/** + * Attr date check. + * + * @param object $obj + * @access public + * @return void + */ +function attrDateCheck($obj) +{ + $obj.find('.form-date').attr('onchange', 'checkDate(this, this.value)'); + $obj.find('.form-datetime').attr('onchange', 'checkDate(this, this.value)'); +} + diff --git a/module/chart/js/preview.js b/module/chart/js/preview.js index 44955b951e..48b48de670 100644 --- a/module/chart/js/preview.js +++ b/module/chart/js/preview.js @@ -1,10 +1,8 @@ $(function() { initCheckBox(); - initQueryBtn(); $('#exportchart').modalTrigger(); - chartMap = new Map(); if(charts.length > 0) { var chartPros = charts.map(function(chart) @@ -12,7 +10,6 @@ $(function() var echartDom = $('#chartDraw' + chart.currentGroup + '_' + chart.id).get(0); var echart = echarts.init(echartDom); ajaxGetChart(false, chart, echart); - chartMap.set(chart.cudrrentGroup + chart.id, chart); return renderFilters(chart); }); @@ -21,9 +18,14 @@ $(function() calcPreviewGrowFilter(); $('body').resize(() => {calcPreviewGrowFilter(true);}); }); - } + chartMap = new Map(); + charts.forEach(function(chart) + { + chartMap.set(chart.currentGroup + '_' + chart.id, chart); + }); + $('[data-toggle="tooltip"]').tooltip(); }) @@ -73,53 +75,53 @@ function initCheckBox() /** * Init query button. * + * @param object $obj * @access public * @return void */ -function initQueryBtn() +function queryData(obj) { - $('.btn-query').click(function() + var chartID = $(obj).parents('.filterBox').attr('data-chart'); + var chartInfo = chartMap.get(chartID); + chartInfo.searchFilters = JSON.parse(JSON.stringify(chartInfo.filters)); + + // Foreach filters and set current value in searchFilters. */ + $('#filterItems' + chartID + ' .filter-items').children().each(function(index) { - var chartID = $(this).attr('data-chart'); - var chartInfo = chartMap.get(chartID); - chartInfo.searchFilters = JSON.parse(JSON.stringify(chartInfo.filters)); + var $child = $(this); + if(!$child.hasClass('filter-item')) return; - // Foreach filters and set current value in searchFilters. */ - $('#filterItems' + chartID + ' .filter-items').children().each(function(index) + var filter = chartInfo.searchFilters[index]; + var type = filter.type; + var value = null; + + if(type == 'input' || type == 'select') { - var $child = $(this); - var filter = chartInfo.searchFilters[index]; - var type = filter.type; - var value = null; + var value = $child.find('#default').val(); + chartInfo.searchFilters[index].default = value; + } + else if(type == 'date' || type == 'datetime') + { + var begin = $child.find('input').first().val(); + var end = $child.find('input').last().val(); - if(type == 'input' || type == 'select') - { - var value = $child.find('#default').val(); - chartInfo.searchFilters[index].default = value; - } - else if(type == 'date' || type == 'datetime') - { - var begin = $child.find('input').first().val(); - var end = $child.find('input').last().val(); + var value = {"begin":begin, "end":end}; + chartInfo.searchFilters[index].default = value; + } + else if(type == 'condition') + { + var operator = $child.find('#operator').data('zui.picker').getValue(); + var value = $child.find('#value').val(); - var value = {"begin":begin, "end":end}; - chartInfo.searchFilters[index].default = value; - } - else if(type == 'condition') - { - var operator = $child.find('#operator').data('zui.picker').getValue(); - var value = $child.find('#value').val(); - - chartInfo.searchFilters[index].operator = operator; - chartInfo.searchFilters[index].value = value; - } - }); - - //* Reload echart. */ - var echartDom = $('#chartDraw' + chartID).get(0); - var echartInfo = echarts.init(echartDom); - ajaxGetChart(false, chartInfo, echartInfo); + chartInfo.searchFilters[index].operator = operator; + chartInfo.searchFilters[index].value = value; + } }); + + //* Reload echart. */ + var echartDom = $('#chartDraw' + chartID).get(0); + var echartInfo = echarts.init(echartDom); + ajaxGetChart(false, chartInfo, echartInfo); } function calcPreviewGrowFilter(resize = false) @@ -247,6 +249,6 @@ function renderFilterItem(filter, resp, index, step) }; var html = $($.zui.formatString(tpl, data)) initPicker(html, 'picker-select', true); - initDatepicker(html); + initDatepicker(html, attrDateCheck); return html; } diff --git a/module/chart/view/preview.html.php b/module/chart/view/preview.html.php index 758931353d..f9ed630a22 100644 --- a/module/chart/view/preview.html.php +++ b/module/chart/view/preview.html.php @@ -20,7 +20,7 @@ chart->widthInput);?> chart->widthDate);?> bi->pickerHeight);?> - ";?> + ";?>
-
+
filters)):?> -
chart->query, "data-chart={$chart->currentGroup}{$chart->id}", 'btn btn-primary btn-query');?>
+
chart->query, "onclick='queryData(this)'", 'btn btn-primary btn-query');?>
From 01e3f26c57309b24f326aac975422c15590b106f Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 17 Apr 2023 09:29:31 +0000 Subject: [PATCH 2/4] * Use export instead of exportChart. --- module/chart/view/preview.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/chart/view/preview.html.php b/module/chart/view/preview.html.php index 758931353d..bda28fc0f6 100644 --- a/module/chart/view/preview.html.php +++ b/module/chart/view/preview.html.php @@ -36,7 +36,7 @@
config->edition == 'biz' or $this->config->edition == 'max'):?>
- " . $lang->export, '', "class='btn btn-link btn-export' id='exportchart'");?> + " . $lang->export, '', "class='btn btn-link btn-export' id='exportchart'");?> chart->toDesign, '', "class='btn btn-primary '");?>
From 79fc91885c5fb79339959c0a13f8df403cf79b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Mon, 17 Apr 2023 09:39:28 +0000 Subject: [PATCH 3/4] * Hide backup menu if using dmdb. --- module/admin/lang/menu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/admin/lang/menu.php b/module/admin/lang/menu.php index 48d69fff0f..bf0448e0e7 100644 --- a/module/admin/lang/menu.php +++ b/module/admin/lang/menu.php @@ -45,16 +45,16 @@ $lang->admin->menuList->convert['link'] = 'convert|convertjira'; $lang->admin->menuList->convert['order'] = 50; $lang->admin->menuList->system['subMenu']['mode'] = array('link' => "{$lang->custom->mode}|custom|mode|"); -$lang->admin->menuList->system['subMenu']['backup'] = array('link' => "{$lang->backup->common}|backup|index|"); $lang->admin->menuList->system['subMenu']['trash'] = array('link' => "{$lang->action->trash}|action|trash|"); $lang->admin->menuList->system['subMenu']['safe'] = array('link' => "{$lang->security}|admin|safe|", 'alias' => 'checkweak,resetpwdsetting', 'links' => array('admin|resetpwdsetting|', 'admin|checkweak|')); $lang->admin->menuList->system['subMenu']['cron'] = array('link' => "{$lang->admin->cron}|cron|index|", 'subModule' => 'cron'); $lang->admin->menuList->system['subMenu']['timezone'] = array('link' => "{$lang->timezone}|custom|timezone|"); $lang->admin->menuList->system['subMenu']['buildindex'] = array('link' => "{$lang->admin->buildIndex}|search|buildindex|"); $lang->admin->menuList->system['subMenu']['tableengine'] = array('link' => "{$lang->admin->tableEngine}|admin|tableengine|"); +if($this->config->db->driver == 'mysql') $lang->admin->menuList->system['subMenu']['backup'] = array('link' => "{$lang->backup->common}|backup|index|"); $lang->admin->menuList->system['menuOrder']['5'] = 'mode'; -$lang->admin->menuList->system['menuOrder']['10'] = 'backup'; +if($this->config->db->driver == 'mysql') $lang->admin->menuList->system['menuOrder']['10'] = 'backup'; $lang->admin->menuList->system['menuOrder']['15'] = 'trash'; $lang->admin->menuList->system['menuOrder']['30'] = 'safe'; $lang->admin->menuList->system['menuOrder']['35'] = 'cron'; From fed027e5a72fc8f6d6894c3d6885a4b3883bb2fd Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 17 Apr 2023 17:39:21 +0800 Subject: [PATCH 4/4] * fix bug. --- module/doc/config.php | 1 + module/doc/model.php | 19 +++++++++-------- module/group/lang/resource.php | 38 ++++++++++++++++++---------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/module/doc/config.php b/module/doc/config.php index 509dfaa28c..7b2f96b2ec 100644 --- a/module/doc/config.php +++ b/module/doc/config.php @@ -50,6 +50,7 @@ $config->doc->spaceMethod['mine'] = 'myspace'; $config->doc->spaceMethod['view'] = 'myspace'; $config->doc->spaceMethod['collect'] = 'myspace'; $config->doc->spaceMethod['createdby'] = 'myspace'; +$config->doc->spaceMethod['editedby'] = 'myspace'; $config->doc->spaceMethod['product'] = 'productspace'; $config->doc->spaceMethod['project'] = 'projectspace'; $config->doc->spaceMethod['execution'] = 'projectspace'; diff --git a/module/doc/model.php b/module/doc/model.php index 0c86709c1e..ad336a6dd4 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1126,7 +1126,7 @@ class docModel extends model unset($this->config->doc->search['fields']['execution']); } - if(in_array($type, array('view', 'collect', 'createdby'))) $libPairs = array('' => '') + $this->getLibs('all', 'withObject'); + if(in_array($type, array('view', 'collect', 'createdby', 'editedby'))) $libPairs = array('' => '') + $this->getLibs('all', 'withObject'); $this->config->doc->search['module'] = $queryName; $this->config->doc->search['params']['lib']['values'] = $libPairs + array('all' => $this->lang->doclib->all); @@ -3147,20 +3147,21 @@ class docModel extends model $myCreation->hasAction = false; $myCreation->active = $libType == 'createdby' ? 1 : 0; - $myCreation = new stdclass(); - $myCreation->id = 0; - $myCreation->name = $this->lang->doc->myEdited; - $myCreation->type = 'editedBy'; - $myCreation->objectType = 'doc'; - $myCreation->objectID = 0; - $myCreation->hasAction = false; - $myCreation->active = $libType == 'editedby' ? 1 : 0; + $myEdition = new stdclass(); + $myEdition->id = 0; + $myEdition->name = $this->lang->doc->myEdited; + $myEdition->type = 'editedBy'; + $myEdition->objectType = 'doc'; + $myEdition->objectID = 0; + $myEdition->hasAction = false; + $myEdition->active = $libType == 'editedby' ? 1 : 0; $libTree = array(); $libTree[] = $myLib; if(common::hasPriv('doc', 'myView')) $libTree[] = $myView; if(common::hasPriv('doc', 'myCollection')) $libTree[] = $myCollection; if(common::hasPriv('doc', 'myCreation')) $libTree[] = $myCreation; + if(common::hasPriv('doc', 'myEdition')) $libTree[] = $myEdition; } return $libTree; } diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 4c948337ec..22c9a54419 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1401,6 +1401,7 @@ $lang->resource->doc->mySpace = 'mySpace'; $lang->resource->doc->myView = 'myView'; $lang->resource->doc->myCollection = 'myCollection'; $lang->resource->doc->myCreation = 'myCreation'; +$lang->resource->doc->myEdition = 'myEdition'; $lang->resource->doc->createLib = 'createLib'; $lang->resource->doc->editLib = 'editLib'; $lang->resource->doc->deleteLib = 'deleteLib'; @@ -1425,24 +1426,25 @@ $lang->doc->methodOrder[10] = 'mySpace'; $lang->doc->methodOrder[15] = 'myView'; $lang->doc->methodOrder[20] = 'myCollection'; $lang->doc->methodOrder[25] = 'myCreation'; -$lang->doc->methodOrder[30] = 'createLib'; -$lang->doc->methodOrder[35] = 'editLib'; -$lang->doc->methodOrder[40] = 'deleteLib'; -$lang->doc->methodOrder[45] = 'create'; -$lang->doc->methodOrder[50] = 'edit'; -$lang->doc->methodOrder[55] = 'view'; -$lang->doc->methodOrder[60] = 'delete'; -$lang->doc->methodOrder[65] = 'deleteFile'; -$lang->doc->methodOrder[70] = 'collect'; -$lang->doc->methodOrder[75] = 'productSpace'; -$lang->doc->methodOrder[80] = 'projectSpace'; -$lang->doc->methodOrder[85] = 'teamSpace'; -$lang->doc->methodOrder[90] = 'showFiles'; -$lang->doc->methodOrder[95] = 'addCatalog'; -$lang->doc->methodOrder[100] = 'editCatalog'; -$lang->doc->methodOrder[105] = 'sortCatalog'; -$lang->doc->methodOrder[110] = 'deleteCatalog'; -$lang->doc->methodOrder[115] = 'displaySetting'; +$lang->doc->methodOrder[30] = 'myEdition'; +$lang->doc->methodOrder[35] = 'createLib'; +$lang->doc->methodOrder[40] = 'editLib'; +$lang->doc->methodOrder[45] = 'deleteLib'; +$lang->doc->methodOrder[50] = 'create'; +$lang->doc->methodOrder[55] = 'edit'; +$lang->doc->methodOrder[60] = 'view'; +$lang->doc->methodOrder[65] = 'delete'; +$lang->doc->methodOrder[70] = 'deleteFile'; +$lang->doc->methodOrder[75] = 'collect'; +$lang->doc->methodOrder[80] = 'productSpace'; +$lang->doc->methodOrder[85] = 'projectSpace'; +$lang->doc->methodOrder[90] = 'teamSpace'; +$lang->doc->methodOrder[95] = 'showFiles'; +$lang->doc->methodOrder[100] = 'addCatalog'; +$lang->doc->methodOrder[105] = 'editCatalog'; +$lang->doc->methodOrder[110] = 'sortCatalog'; +$lang->doc->methodOrder[115] = 'deleteCatalog'; +$lang->doc->methodOrder[120] = 'displaySetting'; /* Mail. */ $lang->resource->mail = new stdclass();