Documentation ¶
Index ¶
- type Ask
- type Config
- type FormFolder
- type Manager
- func (m *Manager) ComposeTemplate(templatePath string, subject string) (Message, error)
- func (m *Manager) GetFormDataHandler(w http.ResponseWriter, r *http.Request)
- func (m *Manager) GetFormTemplateHandler(w http.ResponseWriter, r *http.Request)
- func (m *Manager) GetFormsCatalogHandler(w http.ResponseWriter, r *http.Request)
- func (m *Manager) GetPostedFormData(key string) (Message, bool)
- func (m *Manager) PostFormDataHandler(w http.ResponseWriter, r *http.Request)
- func (m *Manager) RenderForm(data []byte, composeReply bool) (string, error)
- func (m *Manager) UpdateFormTemplates(ctx context.Context) (UpdateResponse, error)
- func (m *Manager) UpdateFormTemplatesHandler(w http.ResponseWriter, r *http.Request)
- type Message
- type Option
- type Select
- type Template
- type UpdateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { FormsPath string MyCall string Locator string AppVersion string LineReader func() string UserAgent string GPSd cfg.GPSdConfig }
Config passes config options to the forms package
type FormFolder ¶
type FormFolder struct { Name string `json:"name"` Path string `json:"path"` Version string `json:"version"` FormCount int `json:"form_count"` Forms []Template `json:"forms"` Folders []FormFolder `json:"folders"` }
FormFolder is a folder with forms. A tree structure with Form leaves and sub-Folder branches
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the forms subsystem
func (*Manager) ComposeTemplate ¶ added in v0.16.0
ComposeTemplate composes a message from a template (templatePath) by prompting the user through stdio.
It combines all data needed for the whole template-based message: subject, body, and attachments.
func (*Manager) GetFormDataHandler ¶
func (m *Manager) GetFormDataHandler(w http.ResponseWriter, r *http.Request)
GetFormDataHandler is the counterpart to PostFormDataHandler. Returns the form field values to the frontend
func (*Manager) GetFormTemplateHandler ¶
func (m *Manager) GetFormTemplateHandler(w http.ResponseWriter, r *http.Request)
GetFormTemplateHandler serves a template's HTML form (filled-in with instance values)
func (*Manager) GetFormsCatalogHandler ¶
func (m *Manager) GetFormsCatalogHandler(w http.ResponseWriter, r *http.Request)
GetFormsCatalogHandler reads all forms from config.FormsPath and writes them in the http response as a JSON object graph This lets the frontend present a tree-like GUI for the user to select a form for composing a message
func (*Manager) GetPostedFormData ¶
GetPostedFormData is similar to GetFormDataHandler, but used when posting the form-based message to the outbox
func (*Manager) PostFormDataHandler ¶
func (m *Manager) PostFormDataHandler(w http.ResponseWriter, r *http.Request)
PostFormDataHandler - When the user is done filling a form, the frontend posts the input fields to this handler, which stores them in a map, so that other browser tabs can read the values back with GetFormDataHandler
func (*Manager) RenderForm ¶
RenderForm finds the associated form and returns the filled-in form in HTML given the contents of a form attachment
func (*Manager) UpdateFormTemplates ¶
func (m *Manager) UpdateFormTemplates(ctx context.Context) (UpdateResponse, error)
UpdateFormTemplates handles searching for and installing the latest version of the form templates.
func (*Manager) UpdateFormTemplatesHandler ¶
func (m *Manager) UpdateFormTemplatesHandler(w http.ResponseWriter, r *http.Request)
UpdateFormTemplatesHandler handles API calls to update form templates.
type Message ¶ added in v0.16.0
type Message struct { To string `json:"msg_to"` Cc string `json:"msg_cc"` Subject string `json:"msg_subject"` Body string `json:"msg_body"` Attachments []*fbb.File `json:"-"` // contains filtered or unexported fields }
Message represents a concrete message compiled from a template
type Template ¶ added in v0.16.0
type Template struct { // The name of this template. Name string `json:"name"` // Absolute path to the template file represented by this struct. // // Note: The web gui uses relative paths, and for these instances the // value is set accordingly. Path string `json:"template_path"` // Absolute path to the optional HTML Form composer (aka "input form"). InputFormPath string `json:"-"` // Absolute path to the optional HTML Form viewer (aka "display form"). DisplayFormPath string `json:"-"` // Absolute path to the optional reply template. ReplyTemplatePath string `json:"-"` }
Template holds information about a Winlink template.
type UpdateResponse ¶
type UpdateResponse struct { NewestVersion string `json:"newestVersion"` Action string `json:"action"` }
UpdateResponse is the API response format for the upgrade forms endpoint