Mercurial > gemma
annotate pkg/controllers/printtemplates.go @ 3223:9e087a495f41
Fixed SQL statements. Got broken when migrated to new filter builder.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 09 May 2019 15:42:21 +0200 |
parents | 4c254651d80b |
children | d84c64c0f510 |
rev | line source |
---|---|
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 // |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 // Copyright (C) 2018 by via donau |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 package controllers |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import ( |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
17 "bytes" |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 "database/sql" |
2161
7444b75d5497
Print templates endpoints: Get rid of useless models.PrintTemplateIn model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
19 "encoding/json" |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 "net/http" |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
21 "strings" |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
22 "time" |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
23 |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
24 "github.com/gorilla/mux" |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
25 "github.com/jackc/pgx/pgtype" |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
26 |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
27 "gemma.intevation.de/gemma/pkg/models" |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
28 ) |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
29 |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
30 const maxPrintTemplateSize = 5 * 1024 * 1024 |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
31 |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
32 const ( |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
33 listPrintTemplatesSQL = ` |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
34 SELECT |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
35 template_name, |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
36 template_type::varchar, |
2270
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
37 date_info, |
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
38 country |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
39 FROM users.templates |
3223
9e087a495f41
Fixed SQL statements. Got broken when migrated to new filter builder.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
40 WHERE |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
41 ` |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
42 |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
43 hasPrintTemplateSQL = ` |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
44 SELECT true FROM users.templates |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
45 WHERE template_name = $1 AND template_type = $2::template_types` |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
46 |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
47 deletePrintTemplateSQL = ` |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
48 DELETE FROM users.templates |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
49 WHERE template_name = $1 AND template_type = $2::template_types` |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
50 |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
51 selectPrintTemplateSQL = ` |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
52 SELECT template_data FROM users.templates |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
53 WHERE template_name = $1 AND template_type = $2::template_types` |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
54 |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
55 insertPrintTemplateSQL = ` |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
56 INSERT INTO users.templates (template_name, template_type, template_data, country) |
2267
37ae1bee3e4a
Ajjusted RLS for user templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2247
diff
changeset
|
57 SELECT |
37ae1bee3e4a
Ajjusted RLS for user templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2247
diff
changeset
|
58 $1, |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
59 $2::template_types, |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
60 $3, |
2267
37ae1bee3e4a
Ajjusted RLS for user templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2247
diff
changeset
|
61 CASE WHEN pg_has_role('sys_admin', 'MEMBER') THEN NULL |
37ae1bee3e4a
Ajjusted RLS for user templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2247
diff
changeset
|
62 ELSE users.current_user_country() |
37ae1bee3e4a
Ajjusted RLS for user templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2247
diff
changeset
|
63 END` |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
64 |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
65 updatePrintTemplateSQL = ` |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
66 UPDATE user.templates template_data = $2 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
67 WHERE template_name = $1 AND template_type = $2::template_types` |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 ) |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
70 var templateTypes = []string{"map", "diagram", "report"} |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
71 |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 func listPrintTemplates( |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 _ interface{}, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 req *http.Request, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 conn *sql.Conn, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 ) (jr JSONResult, err error) { |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
77 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
78 ts := mux.Vars(req)["types"] |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
79 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
80 if ts == "" { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
81 if ts = req.FormValue("types"); ts == "" { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
82 ts = strings.Join(templateTypes, ",") |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
83 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
84 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
85 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
86 types := toTextArray(ts, templateTypes) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
87 filter := buildFilterTerm("template_type = ANY($%d) ", types) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
88 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
89 var stmt strings.Builder |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
90 var args []interface{} |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
91 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
92 stmt.WriteString(listPrintTemplatesSQL) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
93 filter.serialize(&stmt, &args) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
94 stmt.WriteString(" ORDER BY date_info DESC") |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
95 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
96 var rows *sql.Rows |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
97 if rows, err = conn.QueryContext(req.Context(), stmt.String(), args...); err != nil { |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
98 return |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
99 } |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
100 defer rows.Close() |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
101 |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
102 type template struct { |
2270
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
103 Name string `json:"name"` |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
104 Type string `json:"type"` |
2270
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
105 Time models.Time `json:"time"` |
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
106 Country *string `json:"country,omitempty"` |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
107 } |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
108 |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
109 templates := []*template{} |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
110 |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
111 for rows.Next() { |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
112 var tmpl template |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
113 var w time.Time |
2270
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
114 var country sql.NullString |
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
115 if err = rows.Scan(&tmpl.Name, &w, &country); err != nil { |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
116 return |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
117 } |
3089
813309225e35
Made 'go vet' happy again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2270
diff
changeset
|
118 tmpl.Time = models.Time{Time: w} |
2270
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
119 if country.Valid { |
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
120 tmpl.Country = &country.String |
1c8b8a4476af
Print templates: Add country to listing if template has one.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2267
diff
changeset
|
121 } |
2150
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
122 templates = append(templates, &tmpl) |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
123 } |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
124 |
2c67c51d57ad
Print templates: Implemented GET of all templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2148
diff
changeset
|
125 jr = JSONResult{Result: templates} |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 return |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 func fetchPrintTemplate( |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 _ interface{}, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 req *http.Request, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 conn *sql.Conn, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 ) (jr JSONResult, err error) { |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
134 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
135 vars := mux.Vars(req) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
136 name, typ := vars["name"], vars["type"] |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
137 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
138 ctx := req.Context() |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
139 var data pgtype.Bytea |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
140 err = conn.QueryRowContext(ctx, selectPrintTemplateSQL, name, typ).Scan(&data) |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
141 |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
142 switch { |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
143 case err == sql.ErrNoRows: |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
144 err = JSONError{ |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
145 Code: http.StatusNotFound, |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
146 Message: "No such template found", |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
147 } |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
148 return |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
149 case err != nil: |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
150 return |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
151 case data.Status != pgtype.Present: |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
152 err = JSONError{ |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
153 Code: http.StatusInternalServerError, |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
154 Message: "Unexpected return value from database query", |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
155 } |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
156 return |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
157 } |
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
158 jr = JSONResult{Result: bytes.NewReader(data.Bytes)} |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 return |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 } |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 func createPrintTemplate( |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
163 input interface{}, |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 req *http.Request, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 conn *sql.Conn, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 ) (jr JSONResult, err error) { |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
167 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
168 vars := mux.Vars(req) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
169 name, typ := vars["name"], vars["type"] |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
170 |
2161
7444b75d5497
Print templates endpoints: Get rid of useless models.PrintTemplateIn model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
171 in := input.(*json.RawMessage) |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
172 |
2161
7444b75d5497
Print templates endpoints: Get rid of useless models.PrintTemplateIn model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
173 if name == "" { |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
174 err = JSONError{ |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
175 Code: http.StatusBadRequest, |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
176 Message: "Template must have a none empty name", |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
177 } |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
178 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
179 } |
2161
7444b75d5497
Print templates endpoints: Get rid of useless models.PrintTemplateIn model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
180 if len(*in) == 0 { |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
181 err = JSONError{ |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
182 Code: http.StatusBadRequest, |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
183 Message: "Template must have a none empty template", |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
184 } |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
185 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
186 } |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
187 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
188 ctx := req.Context() |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
189 var tx *sql.Tx |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
190 if tx, err = conn.BeginTx(ctx, nil); err != nil { |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
191 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
192 } |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
193 defer tx.Rollback() |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
194 |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
195 var dummy bool |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
196 err = tx.QueryRowContext(ctx, hasPrintTemplateSQL, name, typ).Scan(&dummy) |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
197 |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
198 switch { |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
199 case err == sql.ErrNoRows: |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
200 // This is fine. |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
201 case err != nil: |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
202 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
203 default: |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
204 err = JSONError{ |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
205 Code: http.StatusBadRequest, |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
206 Message: "A template with this name already exists", |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
207 } |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
208 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
209 } |
2161
7444b75d5497
Print templates endpoints: Get rid of useless models.PrintTemplateIn model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
210 data := pgtype.Bytea{Bytes: *in, Status: pgtype.Present} |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
211 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
212 if _, err = tx.ExecContext(ctx, insertPrintTemplateSQL, name, typ, &data); err != nil { |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
213 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
214 } |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
215 |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
216 if err = tx.Commit(); err != nil { |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
217 return |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
218 } |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
219 jr = JSONResult{ |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
220 Code: http.StatusCreated, |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
221 Result: map[string]string{ |
2161
7444b75d5497
Print templates endpoints: Get rid of useless models.PrintTemplateIn model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2158
diff
changeset
|
222 "created": name, |
2158
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
223 }, |
7bd485bf85e8
Print templates: Implemented /api/templates/print POST to create new templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2155
diff
changeset
|
224 } |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
225 return |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
226 } |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
227 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
228 func deletePrintTemplate( |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 _ interface{}, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 req *http.Request, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 conn *sql.Conn, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
232 ) (jr JSONResult, err error) { |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
233 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
234 vars := mux.Vars(req) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
235 name, typ := vars["name"], vars["type"] |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
236 |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
237 ctx := req.Context() |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
238 var tx *sql.Tx |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
239 if tx, err = conn.BeginTx(ctx, nil); err != nil { |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
240 return |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
241 } |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
242 defer tx.Rollback() |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
243 |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
244 var dummy bool |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
245 err = tx.QueryRowContext(ctx, hasPrintTemplateSQL, name, typ).Scan(&dummy) |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
246 |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
247 switch { |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
248 case err == sql.ErrNoRows: |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
249 err = JSONError{ |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
250 Code: http.StatusNotFound, |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
251 Message: "No such template found", |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
252 } |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
253 return |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
254 case err != nil: |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
255 return |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
256 case !dummy: |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
257 err = JSONError{ |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
258 Code: http.StatusInternalServerError, |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
259 Message: "Unexpected return value from database query", |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
260 } |
2155
51c5aead78c0
Print templates: Implemented /api/templates/print/{name} GET.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2153
diff
changeset
|
261 return |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
262 } |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
263 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
264 if _, err = tx.ExecContext(ctx, deletePrintTemplateSQL, name, typ); err != nil { |
2153
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
265 return |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
266 } |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
267 |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
268 if err = tx.Commit(); err != nil { |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
269 return |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
270 } |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
271 |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
272 jr = JSONResult{ |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
273 Result: map[string]string{ |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
274 "deleted": name, |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
275 }, |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
276 } |
cdd68f555ad7
Print templates: Implemented /api/templates/print/{name} DELETE.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2150
diff
changeset
|
277 |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
278 return |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
279 } |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
280 |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
281 func updatePrintTemplate( |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
282 input interface{}, |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
283 req *http.Request, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
284 conn *sql.Conn, |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
285 ) (jr JSONResult, err error) { |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
286 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
287 vars := mux.Vars(req) |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
288 name, typ := vars["name"], vars["type"] |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
289 |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
290 in := input.(*json.RawMessage) |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
291 |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
292 if name == "" { |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
293 err = JSONError{ |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
294 Code: http.StatusBadRequest, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
295 Message: "Template must have a none empty name", |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
296 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
297 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
298 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
299 if len(*in) == 0 { |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
300 err = JSONError{ |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
301 Code: http.StatusBadRequest, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
302 Message: "Template must have a none empty template", |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
303 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
304 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
305 } |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
306 |
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
307 ctx := req.Context() |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
308 var tx *sql.Tx |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
309 if tx, err = conn.BeginTx(ctx, nil); err != nil { |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
310 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
311 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
312 defer tx.Rollback() |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
313 |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
314 var dummy bool |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
315 err = tx.QueryRowContext(ctx, hasPrintTemplateSQL, name, typ).Scan(&dummy) |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
316 |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
317 switch { |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
318 case err == sql.ErrNoRows: |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
319 err = JSONError{ |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
320 Code: http.StatusNotFound, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
321 Message: "No such template found", |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
322 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
323 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
324 case err != nil: |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
325 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
326 case !dummy: |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
327 err = JSONError{ |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
328 Code: http.StatusInternalServerError, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
329 Message: "Unexpected return value from database query", |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
330 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
331 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
332 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
333 data := pgtype.Bytea{Bytes: *in, Status: pgtype.Present} |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
334 |
3217
4c254651d80b
Added template types "map", "diagram", "report".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3089
diff
changeset
|
335 if _, err = tx.ExecContext(ctx, updatePrintTemplateSQL, name, typ, &data); err != nil { |
2162
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
336 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
337 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
338 |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
339 if err = tx.Commit(); err != nil { |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
340 return |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
341 } |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
342 |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
343 jr = JSONResult{ |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
344 Code: http.StatusOK, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
345 Result: map[string]string{ |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
346 "updated": name, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
347 }, |
0627565fb4d2
Print templates: Implemented /api/templates/print/{name} PATCH to update print templates.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2161
diff
changeset
|
348 } |
2148
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
349 return |
4057a1f15174
Print templates: Forget to add controller file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
350 } |