Handler for reply new and update (doesn't work yet).
This commit is contained in:
parent
37c56a91b6
commit
4efc83b09e
@ -201,10 +201,34 @@ func (h *Handlers) GuestbookAdminDeleteReply(w http.ResponseWriter, r *http.Requ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handlers) GuestbookAdminUpdateReply(w http.ResponseWriter, r *http.Request) {
|
func (h *Handlers) GuestbookAdminReply(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Handlers) GuestbookAdminNewReply(w http.ResponseWriter, r *http.Request) {
|
r.ParseForm()
|
||||||
|
|
||||||
|
id, err := strconv.ParseInt(r.FormValue("entry_id"), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
reply, err := guestbook.NewReply(id, r.FormValue("message"))
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.URL.Query().Has("update") {
|
||||||
|
if err = h.guestbookDB.UpdateReply(reply); err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = h.guestbookDB.NewReply(reply)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handlers) RSS(w http.ResponseWriter, r *http.Request) {
|
func (h *Handlers) RSS(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user