Mercurial > gemma
changeset 877:254cd247826d geo-style
The XSLT stuff is not need (Puh!).
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 30 Sep 2018 20:09:02 +0200 |
parents | 8b9bd9ccdd93 |
children | 495fc3264265 |
files | pkg/geoserver/boot.go pkg/models/intservices.go schema/gemma.sql |
diffstat | 3 files changed, 5 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/geoserver/boot.go Sun Sep 30 19:42:16 2018 +0200 +++ b/pkg/geoserver/boot.go Sun Sep 30 20:09:02 2018 +0200 @@ -403,6 +403,8 @@ entries[i].Name, http.StatusText(resp.StatusCode)) } + //log.Printf("%s\n", entries[i].Style.String) + // TODO: Connect with feature. }
--- a/pkg/models/intservices.go Sun Sep 30 19:42:16 2018 +0200 +++ b/pkg/models/intservices.go Sun Sep 30 20:09:02 2018 +0200 @@ -3,10 +3,8 @@ import ( "context" "database/sql" - "fmt" "log" "net/http" - "strings" "sync" "gemma.intevation.de/gemma/pkg/auth" @@ -31,45 +29,17 @@ updateStyleSQL = ` UPDATE sys_admin.published_services -SET style = xslt_process($1, $2, $3)::bytea -WHERE name IN (SELECT oid FROM pg_class WHERE relname = $4)` -) - -const ( - replaceNameXSLT = `<?xml version="1.0"?> -<xsl:stylesheet version="1.0" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:sld="http://www.opengis.net/sld" - xmlns:se="http://www.opengis.net/se"> - - <xsl:param name="name"/> - - <xsl:template - match="/sld:StyledLayerDescriptor/sld:NamedLayer/sld:Name/text()"> - <xsl:value-of select="$name"/> - </xsl:template> - - <xsl:template - match="/sld:StyledLayerDescriptor/sld:NamedLayer/se:Name/text()"> - <xsl:value-of select="$name"/> - </xsl:template> - - <xsl:template match="@*|node()"> - <xsl:copy> - <xsl:apply-templates select="@*|node()"/> - </xsl:copy> - </xsl:template> -</xsl:stylesheet>` +SET style = $1::bytea +WHERE name IN (SELECT oid FROM pg_class WHERE relname = $2)` ) var InternalServices = &IntServices{} func UpdateInternalStyle(req *http.Request, name, style string) error { return auth.RunAsSessionUser(req, func(conn *sql.Conn) error { - param := fmt.Sprintf("name='%s'", strings.Replace(name, ",", "", -1)) _, err := conn.ExecContext( req.Context(), updateStyleSQL, - style, replaceNameXSLT, param, name) + style, name) if err == nil { InternalServices.Invalidate() }
--- a/schema/gemma.sql Sun Sep 30 19:42:16 2018 +0200 +++ b/schema/gemma.sql Sun Sep 30 20:09:02 2018 +0200 @@ -5,8 +5,6 @@ -- CREATE EXTENSION postgis; -CREATE EXTENSION xml2; - -- Needed for 3D processing e.g. for cross section profiles -- FIXME disabled for now, because not available on Ubuntu/Debian --CREATE EXTENSION postgis_sfcgal;