go
This commit is contained in:
30
main.go
30
main.go
@@ -327,7 +327,7 @@ func (s *Server) XkeywordPrivate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
sparam := strings.TrimSpace(r.Form.Get("search"))
|
||||
D := GetDataReturnDataPort(makeContactTableJoin()+"WHERE c.contact_owner_id = -1 AND (l.location_name LIKE '%"+sparam+"%');", "SELECT * FROM keyword c WHERE (c.keyword_owner = -1 OR c.keyword_owner = 1) AND c.keyword_name LIKE '%"+sparam+"%';")
|
||||
D := GetDataReturnDataPort("", "SELECT * FROM keyword c WHERE (c.keyword_owner = -1 OR c.keyword_owner = 1) AND c.keyword_name LIKE '%"+sparam+"%';")
|
||||
funcs := template.FuncMap{"now": time.Now}
|
||||
templatesDir := getenv("BLOG_TEMPLATES_DIR", "./static/templates")
|
||||
layout := template.Must(template.New("schlagwort").Funcs(funcs).ParseFiles(templatesDir + "/schlagwortliste.html"))
|
||||
@@ -340,7 +340,7 @@ func (s *Server) XkwbctPublic(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
sparam := strings.TrimSpace(r.Form.Get("cid"))
|
||||
D := GetDataReturnDataPort(makeContactTableJoin()+"WHERE c.contact_owner_id = -1 AND (l.location_name LIKE '%"+sparam+"%');", "SELECT c.* FROM keyword c JOIN contactkeyword z ON (z.contactkeyword_keyword = c.keyword_id) WHERE z.contactkeyword_contact = "+sparam+";")
|
||||
D := GetDataReturnDataPort("", "SELECT c.* FROM keyword c JOIN contactkeyword z ON (z.contactkeyword_keyword = c.keyword_id) WHERE z.contactkeyword_contact = "+sparam+";")
|
||||
funcs := template.FuncMap{"now": time.Now}
|
||||
templatesDir := getenv("BLOG_TEMPLATES_DIR", "./static/templates")
|
||||
layout := template.Must(template.New("schlagwort").Funcs(funcs).ParseFiles(templatesDir + "/schlagwortliste.html"))
|
||||
@@ -348,11 +348,31 @@ func (s *Server) XkwbctPublic(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (s *Server) XkwbctPrivate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
user := r.Context().Value(userKey).(string)
|
||||
fmt.Println(user)
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "bad request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
sparam := strings.TrimSpace(r.Form.Get("cid"))
|
||||
D := GetDataReturnDataPort(makeContactTableJoin()+" JOIN contactkeyword z ON (z.contactkeyword_contact = c.contact_id) WHERE c.keyword_owner = -1 OR c.keyword_owner = 1 AND z.contactkeyword_keyword = "+sparam+";", "")
|
||||
funcs := template.FuncMap{"now": time.Now}
|
||||
templatesDir := getenv("BLOG_TEMPLATES_DIR", "./static/templates")
|
||||
layout := template.Must(template.New("kontakt").Funcs(funcs).ParseFiles(templatesDir + "/kontaktliste.html"))
|
||||
layout.ExecuteTemplate(w, "kontakt", D)
|
||||
}
|
||||
|
||||
func (s *Server) XctbkwPublic(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "bad request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
sparam := strings.TrimSpace(r.Form.Get("cid"))
|
||||
D := GetDataReturnDataPort(makeContactTableJoin()+" JOIN contactkeyword z ON (z.contactkeyword_contact = c.contact_id) WHERE c.keyword_owner = -1 AND z.contactkeyword_keyword = "+sparam+";", "")
|
||||
funcs := template.FuncMap{"now": time.Now}
|
||||
templatesDir := getenv("BLOG_TEMPLATES_DIR", "./static/templates")
|
||||
layout := template.Must(template.New("kontakt").Funcs(funcs).ParseFiles(templatesDir + "/kontaktliste.html"))
|
||||
layout.ExecuteTemplate(w, "kontakt", D)
|
||||
}
|
||||
|
||||
func (s *Server) XctbkwPrivate(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -522,7 +542,7 @@ func main() {
|
||||
IdleTimeout: 60 * time.Second,
|
||||
}
|
||||
|
||||
log.Println("Listening on https://localhost:8080 …")
|
||||
log.Println("🚀 Listening on https://0.0.0.0:8080 …")
|
||||
/*if err := server.ListenAndServeTLS("cert.pem", "key.pem"); err != nil {
|
||||
StopServer(err)
|
||||
}*/
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<col style="width: 10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<tr hx-post="/htmx/contact" hx-trigger="click delay:200ms" hx-target="#z-1" hx-swap="outerHTML" hx-vals='{"search": ""}'>
|
||||
<th>Name <a href="/sso">(Anmelden)</a></th>
|
||||
<th>Telefon</th>
|
||||
<th>Mobil</th>
|
||||
|
@@ -6,12 +6,12 @@
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Stichwort</th>
|
||||
<th hx-post="/htmx/keyword" hx-trigger="click delay:200ms" hx-target="#z-2" hx-swap="outerHTML" hx-vals='{"search": ""}'>Stichwort</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .Keywords }}
|
||||
<tr><td>{{ .Name }}</td></tr>
|
||||
<tr hx-post="/htmx/contactbykeyword" hx-trigger="click delay:200ms" hx-target="#z-1" hx-swap="outerHTML" hx-vals='{"cid": "{{ .Id }}"}'><td>{{ .Name }}</td></tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user