context

package
v0.0.0-...-d4285bb Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Browse

type Browse struct {
	IsUser          bool
	Pid, Sid        bson.ObjectId
	Uid, File, View string
	//ChildFile                  string
	Current, Next int
	DisplayCount  int
	Level         Level
	Result        *Result
}

Browse is used to keep track of the user's browsing.

func (*Browse) ClearSubmission

func (b *Browse) ClearSubmission()

func (*Browse) SetDisplayCount

func (b *Browse) SetDisplayCount(r *http.Request) error

func (*Browse) SetFile

func (b *Browse) SetFile(r *http.Request) error

func (*Browse) SetFileIndices

func (b *Browse) SetFileIndices(r *http.Request) error

func (*Browse) SetLevel

func (b *Browse) SetLevel(route string)

func (*Browse) SetPid

func (b *Browse) SetPid(r *http.Request) error

func (*Browse) SetResult

func (b *Browse) SetResult(r *http.Request) error

func (*Browse) SetSid

func (b *Browse) SetSid(r *http.Request) error

func (*Browse) SetUid

func (b *Browse) SetUid(r *http.Request) error

func (*Browse) Submissions

func (b *Browse) Submissions() ([]*project.Submission, error)

func (*Browse) Update

func (b *Browse) Update(r *http.Request) error

type C

type C struct {
	Session *sessions.Session
	Browse  *Browse
}

Context is used to keep track of the current user's session.

func Load

func Load(s *sessions.Session) *C

Load loads a context from the session.

func (*C) AddMessage

func (c *C) AddMessage(m string, isErr bool)

AddMessage adds a message to be displayed to the user.

func (*C) AddUser

func (c *C) AddUser(u string)

AddUser sets the currently signed in user.

func (*C) Close

func (c *C) Close()

Close closes a session.

func (*C) Errors

func (c *C) Errors() []interface{}

Errors retrieves all error messages.

func (*C) IsView

func (c *C) IsView(v string) bool

IsView checks whether the given view matches the user's current view.

func (*C) LoggedIn

func (c *C) LoggedIn() bool

LoggedIn checks whether a user is signed in.

func (*C) RemoveUser

func (c *C) RemoveUser()

AddUser sets the currently signed in user.

func (*C) Save

func (c *C) Save(r *http.Request, w http.ResponseWriter) error

Save stores the current session.

func (*C) Successes

func (c *C) Successes() []interface{}

Successes retrieves all success messages.

func (*C) Username

func (c *C) Username() (string, error)

Username retrieves the current user's username.

type Level

type Level int
const (
	HOME Level = iota
	PROJECTS
	USERS
	SUBMISSIONS
	FILES
	ANALYSIS
)

func (Level) Is

func (l Level) Is(level string) bool

type Result

type Result struct {
	Type   string
	Name   string
	FileID bson.ObjectId
}

func NewResult

func NewResult(s string) (*Result, error)

func (*Result) Check

func (r *Result) Check(pid bson.ObjectId)

func (*Result) Date

func (r *Result) Date() string

func (*Result) Format

func (r *Result) Format() string

func (*Result) HasCode

func (r *Result) HasCode() bool

func (*Result) Raw

func (r *Result) Raw() string

func (*Result) Set

func (r *Result) Set(s string) error

func (*Result) Update

func (r *Result) Update(sid bson.ObjectId, fname string) error

type Setter

type Setter func(*http.Request) error

Jump to

Keyboard shortcuts

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