handlers

package
v0.0.0-...-f9eced6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package handlers combines link data with http handler funcs.

Package handlers contains handler funcs; which are not stored in the main package, because the systemtests must access these handler funcs.

Index

Constants

This section is empty.

Variables

View Source
var ConfigReloadH = func(w http.ResponseWriter, req *http.Request) {

	w.Header().Set("Content-Type", "text/plain; charset=utf-8")

	fileName := cfg.CfgPath
	r, bucketClose, err := cloudio.Open(fileName)
	if err != nil {
		log.Fatalf("Error opening writer to %v: %v", fileName, err)
	}
	defer func() {
		err := r.Close()
		if err != nil {
			log.Printf("Error closing writer to bucket to %v: %v", fileName, err)
		}
	}()
	defer func() {
		err := bucketClose()
		if err != nil {
			log.Printf("Error closing bucket of writer to %v: %v", fileName, err)
		}
	}()
	log.Printf("Opened reader to cloud config %v", cfg.CfgPath)
	cfg.Load(r)

	fmt.Fprintf(w, "cfg reloaded")

}

ConfigReloadH can be everywhere but in package cfg. Package cfg must remain free of iocloud

Functions

func DownloadUnsubscribe

func DownloadUnsubscribe(w http.ResponseWriter, r *http.Request)

DownloadUnsubscribe responds CSV file; test using CURLOPT_SSL_VERIFYPEER => --insecure curl -i --insecure https://localhost:8083/survey/unsubscribe-download -o tmp-unsubscribe-local.csv curl -i https://survey2.zew.de/unsubscribe-download -o tmp-unsubscribe-remote.csv

func LoginByHashID

func LoginByHashID(w http.ResponseWriter, r *http.Request)

LoginByHashID is an entry point for HashIDs;

it prepares the request params
 so that they can be processed below by lgn.LoginByHash

func LogoutSiteH

func LogoutSiteH(w http.ResponseWriter, r *http.Request)

LogoutSiteH calls lgn.Logout and wraps it in site layout

func MainH

func MainH(w http.ResponseWriter, r *http.Request)

MainH or "/home" loads and displays the questionnaire with page and lang_code

func RegisterHandlers

func RegisterHandlers(mux *http.ServeMux)

RegisterHandlers cannot go into a global var or into an init() func, Since the handler funcs use the links slice and create circular dependencies.

func RegistrationFMRH

func RegistrationFMRH(w http.ResponseWriter, r *http.Request)

RegistrationFMRH shows a registraton form for FMT report

func RegistrationFMTDeH

func RegistrationFMTDeH(w http.ResponseWriter, r *http.Request)

RegistrationFMTDeH shows a registraton form for the FMT

func RegistrationFMTEnH

func RegistrationFMTEnH(w http.ResponseWriter, r *http.Request)

RegistrationFMTEnH shows a registraton form for the FMT

func RegistrationsFMTDownload

func RegistrationsFMTDownload(w http.ResponseWriter, r *http.Request)

RegistrationsFMTDownload returns the CSV files

func TestCloudStore

func TestCloudStore(w1 http.ResponseWriter, r *http.Request)

TestCloudStore checks if the cloud store is readable and writable; Implementation in package cloudio causes circular dependencies

func TransferrerEndpointH

func TransferrerEndpointH(w http.ResponseWriter, r *http.Request)

TransferrerEndpointH responds with finished questionnaires from the filesystem in JSON; preventing of huge filesizes, the response is gzipped; you need to be logged in with admin role; survey_id and wave_id must be set as URL params; only finished questionnaires are included (q.ClosingTime != zero); fetch_all=1 includes unfinished questionnaires;

func UnsubscribeH

func UnsubscribeH(w http.ResponseWriter, r *http.Request)

UnsubscribeH creates a generic CSV file containing requests to be removed from go-massmail tasks

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL