From 586c80d902df56324646af38e069113a2720f3ad Mon Sep 17 00:00:00 2001 From: yaoq Date: Wed, 20 Jul 2022 16:03:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Xss=20=E8=BF=87=E6=BB=A4=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smtweb-framework/bpm/src/main/resources/config/application.yaml | 2 +- .../cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/smtweb-framework/bpm/src/main/resources/config/application.yaml b/smtweb-framework/bpm/src/main/resources/config/application.yaml index ede1cda..faec76f 100644 --- a/smtweb-framework/bpm/src/main/resources/config/application.yaml +++ b/smtweb-framework/bpm/src/main/resources/config/application.yaml @@ -27,7 +27,7 @@ spring: password: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/smt_asp?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/gdmz?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false username: root password: root servlet: diff --git a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java index 0250874..96055e2 100644 --- a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java +++ b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java @@ -59,6 +59,9 @@ public class XssSecurityConfig implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { + if (regex == null || regex.size() == 0) { + return; + } StringBuffer tempStr = new StringBuffer("^"); regex.forEach(k -> { tempStr.append(k); @@ -88,6 +91,7 @@ public class XssSecurityConfig implements InitializingBean { * @return */ public String securityReplace(String text) { + if (!initSuccess()) return text; if (StringUtils.isEmpty(text)) { return text; } else { @@ -102,11 +106,16 @@ public class XssSecurityConfig implements InitializingBean { * @return */ public boolean matches(String text) { + if (!initSuccess()) return false; if (StringUtils.isEmpty(text)) { return false; } return XSS_PATTERN.matcher(text).matches(); } + + private boolean initSuccess() { + return regex != null && regex.size() > 0; + } } From 348dc1a11f46a21ac93ea10049aade335d138a49 Mon Sep 17 00:00:00 2001 From: yaoq Date: Wed, 20 Jul 2022 16:03:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Xss=20=E8=BF=87=E6=BB=A4=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java index 96055e2..f22f625 100644 --- a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java +++ b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/filter/XssSecurityConfig.java @@ -59,7 +59,7 @@ public class XssSecurityConfig implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { - if (regex == null || regex.size() == 0) { + if (!initSuccess()) { return; } StringBuffer tempStr = new StringBuffer("^"); From d82740a3581bbef448caa5e658072f69b49bfd7d Mon Sep 17 00:00:00 2001 From: xiaxl Date: Wed, 20 Jul 2022 16:15:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E5=88=86=E7=BB=84=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/template/index.yaml | 18 + .../resources/static/template/model_group_card.ftl | 426 +++++++++++++++++++++ 2 files changed, 444 insertions(+) create mode 100644 smtweb-framework/bpm/src/main/resources/static/template/model_group_card.ftl diff --git a/smtweb-framework/bpm/src/main/resources/static/template/index.yaml b/smtweb-framework/bpm/src/main/resources/static/template/index.yaml index 96baf12..b1d8b7a 100644 --- a/smtweb-framework/bpm/src/main/resources/static/template/index.yaml +++ b/smtweb-framework/bpm/src/main/resources/static/template/index.yaml @@ -57,6 +57,24 @@ model: label: '列数' desc: '请选择表单列数(目前只支持1,2,3)' - + name: 'model_group_card' + label: '分组卡片' + # list/card/view + type: 'card' + # 布局 + layout: + - + name: 'c1' + label: '分组卡片' + type: 'card' + hasGroup: true + param: + - + name: 'mainDs' + type: 'ds' + label: '主卡片数据集' + desc: '请选择主要卡片数据集' + - name: 'model_list_card' label: '简单列表(含卡片)' # list/card/view diff --git a/smtweb-framework/bpm/src/main/resources/static/template/model_group_card.ftl b/smtweb-framework/bpm/src/main/resources/static/template/model_group_card.ftl new file mode 100644 index 0000000..a91d943 --- /dev/null +++ b/smtweb-framework/bpm/src/main/resources/static/template/model_group_card.ftl @@ -0,0 +1,426 @@ +{ + "version": 6, + "form": [ + { + "page": { + "id": "p${newId()}", + "type": "fx-page", + "props": { + "title": "${title}", + "key": "${newId()}" + } + }, + "graph": { + "shape": "panel", + "id": "root_panel", + "type": "fx-split-panel", + "props": { + "horizontal": false, + "shadow": "never", + "size": "1200" + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-split-panel", + "shape": "panel", + "props": { + "size": "56", + "horizontal": true, + "scroll": false, + "name": "s11" + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "alignY": "center", + "backgroundImage": "", + "size": "50" + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-button-group", + "props": { + "menus": [] + }, + "slots": { + "default": [ + { + "type": "fx-button", + "props": { + "label": "返回", + "leftIcon": "left", + "action": "button:return", + "text": false, + "link": true, + "type": "primary", + "size": "large" + }, + "id": "${newId()}" + } + ], + "dropdown": [] + } + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "alignY": "center", + "size": "200", + "backgroundImage": "", + "paddingLeft": 10 + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-title", + "props": { + "label": "${title}" + } + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "alignY": "center", + "backgroundImage": "", + "paddingRight": 32 + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-button-group", + "props": { + "menus": [], + "textAlign": "right" + }, + "slots": { + "default": [ + { + "type": "fx-button", + "props": { + "label": "删除", + "leftIcon": "delete", + "type": "", + "action": "button:remove" + }, + "id": "${newId()}" + }, + { + "id": "${newId()}", + "type": "fx-button", + "props": { + "label": "新增", + "type": "primary", + "linkType": "curr", + "leftIcon": "plus" + } + } + ], + "dropdown": [] + } + } + ] + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0" + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-divider", + "props": { + "label": "", + "contentPosition": "center", + "direction": "horizontal" + } + } + ] + }, + { + "id": "${newId()}", + "type": "fx-split-panel", + "shape": "panel", + "props": { + "horizontal": false, + "scroll": true, + "tab": false + }, + "children": [ + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "10", + "backgroundColor": "--color-transparent" + }, + "children": [] + }, + <#list layout.c1 as group> + + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "48", + "label": "${group.label}", + "colNum": 2, + "alignY": "center", + "paddingLeft": 32, + "paddingRight": 32, + "shadow": "", + "backgroundImage": "bgImg-region-title" + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-title", + "props": { + "label": "${group.label}", + "fontSize": 16, + "color": "#01070D", + "fontWeight": "bold", + "showPrefix": false, + "prefixWidth": 5, + "prefixHeight": 24, + "prefixColor": "#1E90FF" + } + } + ] + }, + <#if (group.type == "card")> + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0" + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-divider", + "props": { + "label": "", + "contentPosition": "center", + "direction": "horizontal" + } + } + ] + }, + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "0", + "gridTemplateColumns": "1fr 1fr 1fr", + "paddingTop": 32 + }, + "children": [ + <#list group.fields as field> + { + "id": "${newId()}", + "type": "fx-${field.editor}", + "props": { + "label": "${field.label}", + "type": "text", + "dataset": "${field.dataset}", + "required": "${field.required}", + "field": "${field.id}", + "placeholder": "请输入内容", + "labelWidth": 150, + "readonly": "${field.readonly}", + "affixError": true + }, + "events": {} + }<#if field_has_next>, + + ] + }, + <#elseif (group.type == "list")> + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "400", + "label": "列表", + "colNum": 0, + "paddingLeft": 20, + "paddingRight": 20, + "shadow": "", + "paddingTop": 0 + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-table", + "props": { + "label": "表格", + "border": true, + "stripe": true, + "showHeader": true, + "fit": true, + "dataset": "${group.dataset}", + "actionWidth": 150 + }, + "slots": { + "default": [ + <#list group.fields as field> + { + "id": "id${newId()}", + "type": "fx-table-column", + "props": { + "field": "${field.id}", + "label": "${field.label}" + } + }<#if field_has_next>, + + ], + "button": [ + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "编辑", + "type": "text", + "leftIcon": "edit", + "action": "button:edit", + "dataset": "${group.dataset}", + "link": true, + "linkType": "", + "nextAction": "", + "fxLink": "" + } + }, + { + "id": "id${newId()}", + "type": "fx-button", + "props": { + "label": "删除", + "type": "text", + "leftIcon": "delete-themes", + "action": "button:remove", + "preAction": "", + "link": true, + "confirm": "" + } + } + ] + }, + "events": {} + } + ] + }, + + { + "id": "${newId()}", + "type": "fx-form-panel", + "shape": "panel", + "props": { + "size": "10", + "backgroundColor": "transparent" + }, + "children": [] + }<#if group_has_next>, + + ] + }, + { + "shape": "panel", + "id": "form_panel", + "type": "fx-form-panel", + "props": { + "colNum": 3, + "paddingX": 5, + "paddingY": 5, + "size": "56", + "alignX": "", + "alignY": "center", + "shadow": "always" + }, + "children": [ + { + "id": "id${newId()}", + "type": "fx-button-group", + "props": { + "showDropdown": false, + "textAlign": "center" + }, + "slots": { + "default": [ + { + "type": "fx-button", + "props": { + "label": "重置", + "leftIcon": "", + "type": "", + "action": "button:add", + "linkType": "curr" + }, + "id": "id${newId()}" + }, + { + "type": "fx-button", + "props": { + "label": "保存", + "leftIcon": "", + "type": "primary", + "action": "button:save" + }, + "id": "id${newId()}" + }, + { + "type": "fx-button", + "props": { + "label": "保存并新增", + "leftIcon": "", + "action": "button:return", + "type": "primary" + }, + "id": "id${newId()}" + } + ], + "dropdown": [] + }, + "layout": { + "row": 3, + "col": 3 + } + } + ] + } + ] + } + } + ], + "model": [ + <#list datasets as dataset> + <#include "incModel/inc_model.ftl"/><#if dataset_has_next>, + + ], + "option": { + "widgetRef": [${widgetRef}], + "vars": [] + } +} \ No newline at end of file