scut

package
v0.0.0-...-22804f9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2012 License: BSD-2-Clause-Views Imports: 5 Imported by: 0

Documentation

Overview

Package scut contains a somewhat ugly but useful collection of frequently appearing patterns to allow faster prototyping. Methods here are mainly related to view- or conroller-like parts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dirify

func Dirify(s string) string

func GetFile

func GetFile(root, fi string, opt map[string]interface{}, host string, file_reader func(string) ([]byte, error)) ([]byte, error)

TODO: Implement file caching here. Reads the fi relative filepath from either the current template, or the fallback module tpl folder if fi has at least one slash in it. file_reader is optional, falls back to simple ioutil.ReadFile if not given. file_reader will be a custom file_reader with caching soon.

func GetModTPath

func GetModTPath(filename string) []string

Inp: "admin/this/that.txt" []string{ "modules/admin/tpl", "this/that.txt"}

func GetTPath

func GetTPath(opt map[string]interface{}, host string) string

Observes opt and gives you back the path of your template eg "templates/public/template_name" or "templates/private/hostname/template_name"

func Host

func Host(host string, opt map[string]interface{}) string

CanonicalHost(uni.Req.Host, uni.Opt) Gives you back the canonical address of the site so it can be made available from different domains.

func IsAdmin

func IsAdmin(user interface{}) bool

func IsGuest

func IsGuest(user interface{}) bool

func IsModerator

func IsModerator(user interface{}) bool

func IsRegistered

func IsRegistered(user interface{}) bool

func IsStranger

func IsStranger(user interface{}) bool

func Merge

func Merge(a map[string]interface{}, b map[string]interface{})

Merges b into a (overwriting members in a.

func NotAdmin

func NotAdmin(user interface{}) bool

func OnlyAdmin

func OnlyAdmin(dat map[string]interface{})

func PossibleModPath

func PossibleModPath(filep string) bool

Decides if a given relative filepath (filep) is a possible module filepath. This may be deprecated in the future since it seems so restrictive.

func SolvedPuzzles

func SolvedPuzzles(user interface{}) bool

func TemplateName

func TemplateName(opt map[string]interface{}) string

Gives you back the name of the current template in use.

func TemplateType

func TemplateType(opt map[string]interface{}) string

Gives you back the type of the currently used template (either "private" or public).

func Ulev

func Ulev(useri interface{}) int

Gives back the user level.

Types

This section is empty.

Jump to

Keyboard shortcuts

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