uploadedissuehandler

package
v2.5.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DaysIssueConsideredNew = 14

DaysIssueConsideredNew is how long we warn users that the issue is new - but it can be queued before that warning goes away so long as DaysIssueConsideredDangerous has elapsed

Variables

View Source
var (

	// Layout is the base template, cloned from the responder's layout, from
	// which all subpages are built
	Layout *tmpl.TRoot

	// TitleList renders the uploaded issues landing page
	TitleList *tmpl.Template

	// TitleTmpl renders the list of issues and a summary of errors for a given title
	TitleTmpl *tmpl.Template

	// IssueTmpl renders the list of PDFs and errors in a given issue
	IssueTmpl *tmpl.Template
)

Functions

func FileHandler

func FileHandler(w http.ResponseWriter, req *http.Request)

FileHandler attempts to find and display a file to the browser

func FilePath

func FilePath(title, issue, filename string) string

FilePath returns the relative path to view a given file

func HomeHandler

func HomeHandler(w http.ResponseWriter, req *http.Request)

HomeHandler spits out the title list

func IssueHandler

func IssueHandler(w http.ResponseWriter, req *http.Request)

IssueHandler prints a list of pages for a given issue

func IssuePath

func IssuePath(title, issue string) string

IssuePath returns the relative path to the given issue's file list page

func IssueWorkflowHandler

func IssueWorkflowHandler(w http.ResponseWriter, req *http.Request)

IssueWorkflowHandler handles setting up the issue move job

func IssueWorkflowPath

func IssueWorkflowPath(title, issue, action string) string

IssueWorkflowPath returns the path to make workflow changes to the given issue

func Setup

func Setup(r *mux.Router, baseWebPath string, c *config.Config, w *issuewatcher.Watcher)

Setup sets up all the routing rules and other configuration

func TitleHandler

func TitleHandler(w http.ResponseWriter, req *http.Request)

TitleHandler prints a list of issues for a given title

func TitlePath

func TitlePath(name string) string

TitlePath returns the relative path to the given title's issue list page

Types

type File

type File struct {
	*uploads.File
	Issue *Issue
	Slug  string
}

File wraps a schema.File for web presentation

func (*File) HasErrors

func (f *File) HasErrors() bool

HasErrors reports true if this file has any errors

func (f *File) Link() template.HTML

Link returns a link for this title

type Issue

type Issue struct {
	*uploads.Issue
	Slug       string           // Short, URL-friendly identifier for an issue
	Title      *Title           // Title to which this issue belongs
	QueueInfo  template.HTML    // Informational message from the queue process, if any
	Files      []*File          // List of files
	FileLookup map[string]*File // Lookup for finding a File by its filename / slug
}

Issue wraps uploads.Issue for web presentation

func (*Issue) ChildErrors

func (i *Issue) ChildErrors() (n int)

ChildErrors reports the number of files with errors

func (*Issue) HasErrors

func (i *Issue) HasErrors() bool

HasErrors reports true if this issue has any errors - due to the way AddError works in the schema, this will report true if the issue has an error *or* if one or more files have errors

func (*Issue) IsNew

func (i *Issue) IsNew() bool

IsNew tells the presentation if the issue is fairly new, which can be important for some publishers who upload over several days

func (i *Issue) Link() template.HTML

Link returns a link for this title

func (*Issue) WorkflowPath

func (i *Issue) WorkflowPath(action string) string

WorkflowPath returns the path to perform a workflow action against this issue

type Searcher

type Searcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Searcher holds onto a Scanner for running local queries against scan and sftp uploads. This structure is completely thread-safe; a single instance can and should used for the life of the web server. All data access is via functions to allow automatic rescanning of the file system.

func (*Searcher) BuildInProcessList

func (s *Searcher) BuildInProcessList() error

BuildInProcessList pulls all pending SFTP move jobs from the database and indexes them by location in order to avoid showing issues which are already awaiting processing.

func (*Searcher) FailedSearch

func (s *Searcher) FailedSearch() bool

FailedSearch returns true if too many scans have failed in a row

func (*Searcher) IsInProcess

func (s *Searcher) IsInProcess(issueKey string) bool

IsInProcess returns whether the given issue key has been seen in the in-process issue list

func (*Searcher) Ready

func (s *Searcher) Ready() bool

Ready returns whether or not the searcher has completed at least one search

func (*Searcher) RemoveIssue

func (s *Searcher) RemoveIssue(i *Issue)

RemoveIssue takes the given issue out of all lookups to hide it from front-end queueing operations

func (*Searcher) TitleLookup

func (s *Searcher) TitleLookup(slug string) *Title

TitleLookup returns the Title for a given slug

func (*Searcher) Titles

func (s *Searcher) Titles() []*Title

Titles returns the list of titles

func (*Searcher) TopErrors

func (s *Searcher) TopErrors() apperr.List

TopErrors returns the list of errors found that weren't tied to an issue/title/file

type Title

type Title struct {
	*schema.Title
	Slug        string
	Issues      []*Issue
	IssueLookup map[string]*Issue
	Type        TitleType
}

Title wraps a schema.Title with some extra information for web presentation.

func (*Title) HasErrors

func (t *Title) HasErrors() bool

HasErrors reports true if this title has any errors - due to the way AddError works in the schema, this will report true if the title has an error *or* if one or more issues have errors

func (t *Title) Link() template.HTML

Link returns a link for this title

func (*Title) Show

func (t *Title) Show() bool

Show returns true if the title has any issues or errors. If there are no errors and no issues, there's no reason to display it.

type TitleType

type TitleType int

TitleType tells us if a title contains born-digital issues or scanned

const (
	TitleTypeScanned TitleType = iota
	TitleTypeBornDigital
)

The two constants for TitleType

func (TitleType) String

func (tt TitleType) String() string

String tells us a human-friendly meaning for the type of title

Jump to

Keyboard shortcuts

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