From 9e52f7dfb3dc50a6271151f63cc085ca0774a50e Mon Sep 17 00:00:00 2001 From: huangbin Date: Sat, 15 Aug 2020 10:45:57 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A6=82=E6=9E=9Cinfo=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=BD=BF=E7=94=A8=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?plugin=EF=BC=8Cdetail=E9=A1=B5=E9=9D=A2=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=AE=98=E6=96=B9plugin=EF=BC=8C=E9=82=A3=E4=B9=88=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=90=8E=EF=BC=8C=E5=BA=94=E8=AF=A5=E8=B7=B3=E5=9B=9E?= =?UTF-8?q?=E5=88=B0=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/admin/controller/common.go | 5 ++++- plugins/admin/controller/detail.go | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/admin/controller/common.go b/plugins/admin/controller/common.go index 32fa97510..1f491e14e 100644 --- a/plugins/admin/controller/common.go +++ b/plugins/admin/controller/common.go @@ -234,7 +234,10 @@ func isInfoUrl(s string) bool { sub := reg.FindStringSubmatch(s) return len(sub) > 2 && !strings.Contains(sub[2], "/") } - +func isDetailUrl(s string, p string) bool { + reg, _ := regexp.Compile("(.*?)info/" + p + "/detail") + return reg.MatchString(s) +} func isNewUrl(s string, p string) bool { reg, _ := regexp.Compile("(.*?)info/" + p + "/new") return reg.MatchString(s) diff --git a/plugins/admin/controller/detail.go b/plugins/admin/controller/detail.go index ab10ebd86..04819c2a6 100644 --- a/plugins/admin/controller/detail.go +++ b/plugins/admin/controller/detail.go @@ -27,6 +27,7 @@ func (h *Handler) ShowDetail(ctx *context.Context) { info = panel.GetInfo() formModel = newPanel.GetForm() fieldList = make(types.FieldList, 0) + referer = ctx.Referer() ) if len(detail.FieldList) == 0 { @@ -71,6 +72,10 @@ func (h *Handler) ShowDetail(ctx *context.Context) { editUrl = user.GetCheckPermissionByUrlMethod(editUrl, h.route("show_edit").Method()) deleteUrl = user.GetCheckPermissionByUrlMethod(deleteUrl, h.route("delete").Method()) + if referer != "" && !isInfoUrl(referer) && !isDetailUrl(referer, ctx.Query(constant.PrefixKey)) { + infoUrl = referer + } + deleteJs := "" if deleteUrl != "" { From 49895f14409c270af73eba351c643c4fa8ac6166 Mon Sep 17 00:00:00 2001 From: huangbin Date: Sat, 15 Aug 2020 12:19:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E5=88=B0=E5=AE=98?= =?UTF-8?q?=E6=96=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/admin/controller/common.go | 5 +---- plugins/admin/controller/detail.go | 5 ----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/plugins/admin/controller/common.go b/plugins/admin/controller/common.go index 40dc70a08..89bb915e2 100644 --- a/plugins/admin/controller/common.go +++ b/plugins/admin/controller/common.go @@ -234,10 +234,7 @@ func isInfoUrl(s string) bool { sub := reg.FindStringSubmatch(s) return len(sub) > 2 && !strings.Contains(sub[2], "/") } -func isDetailUrl(s string, p string) bool { - reg, _ := regexp.Compile("(.*?)info/" + p + "/detail") - return reg.MatchString(s) -} + func isNewUrl(s string, p string) bool { reg, _ := regexp.Compile("(.*?)info/" + p + "/new") return reg.MatchString(s) diff --git a/plugins/admin/controller/detail.go b/plugins/admin/controller/detail.go index 04819c2a6..ab10ebd86 100644 --- a/plugins/admin/controller/detail.go +++ b/plugins/admin/controller/detail.go @@ -27,7 +27,6 @@ func (h *Handler) ShowDetail(ctx *context.Context) { info = panel.GetInfo() formModel = newPanel.GetForm() fieldList = make(types.FieldList, 0) - referer = ctx.Referer() ) if len(detail.FieldList) == 0 { @@ -72,10 +71,6 @@ func (h *Handler) ShowDetail(ctx *context.Context) { editUrl = user.GetCheckPermissionByUrlMethod(editUrl, h.route("show_edit").Method()) deleteUrl = user.GetCheckPermissionByUrlMethod(deleteUrl, h.route("delete").Method()) - if referer != "" && !isInfoUrl(referer) && !isDetailUrl(referer, ctx.Query(constant.PrefixKey)) { - infoUrl = referer - } - deleteJs := "" if deleteUrl != "" { From ba279460d9c1a4500d71522a73430c79e28b8303 Mon Sep 17 00:00:00 2001 From: huangbin Date: Sat, 15 Aug 2020 12:19:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A6=82=E6=9E=9Cinfo=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=BD=BF=E7=94=A8=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?plugin=EF=BC=8Cdetail=E9=A1=B5=E9=9D=A2=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=AE=98=E6=96=B9plugin=EF=BC=8C=E9=82=A3=E4=B9=88=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=90=8E=EF=BC=8C=E5=BA=94=E8=AF=A5=E8=B7=B3=E5=9B=9E?= =?UTF-8?q?=E5=88=B0=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/admin/controller/common.go | 5 ++++- plugins/admin/controller/detail.go | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/admin/controller/common.go b/plugins/admin/controller/common.go index 89bb915e2..40dc70a08 100644 --- a/plugins/admin/controller/common.go +++ b/plugins/admin/controller/common.go @@ -234,7 +234,10 @@ func isInfoUrl(s string) bool { sub := reg.FindStringSubmatch(s) return len(sub) > 2 && !strings.Contains(sub[2], "/") } - +func isDetailUrl(s string, p string) bool { + reg, _ := regexp.Compile("(.*?)info/" + p + "/detail") + return reg.MatchString(s) +} func isNewUrl(s string, p string) bool { reg, _ := regexp.Compile("(.*?)info/" + p + "/new") return reg.MatchString(s) diff --git a/plugins/admin/controller/detail.go b/plugins/admin/controller/detail.go index ab10ebd86..04819c2a6 100644 --- a/plugins/admin/controller/detail.go +++ b/plugins/admin/controller/detail.go @@ -27,6 +27,7 @@ func (h *Handler) ShowDetail(ctx *context.Context) { info = panel.GetInfo() formModel = newPanel.GetForm() fieldList = make(types.FieldList, 0) + referer = ctx.Referer() ) if len(detail.FieldList) == 0 { @@ -71,6 +72,10 @@ func (h *Handler) ShowDetail(ctx *context.Context) { editUrl = user.GetCheckPermissionByUrlMethod(editUrl, h.route("show_edit").Method()) deleteUrl = user.GetCheckPermissionByUrlMethod(deleteUrl, h.route("delete").Method()) + if referer != "" && !isInfoUrl(referer) && !isDetailUrl(referer, ctx.Query(constant.PrefixKey)) { + infoUrl = referer + } + deleteJs := "" if deleteUrl != "" {