display_model

package
v0.0.0-...-076d96f Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2012 License: BSD-2-Clause-Views Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Min_loc_len = 8 // $loc.a.b

Decides if a string should be localized.

Variables

This section is empty.

Functions

func CollectFromMap

func CollectFromMap(dat map[string]interface{}) map[string]struct{}

func CollectFromTempl

func CollectFromTempl(file_content string) map[string]struct{}

Extracts used multilingual variables from a template with regexp.

func CreateExcerpts

func CreateExcerpts(res []interface{}, conf map[string]interface{})

conf := map[string]interface{}{"content": Maybe we could modify this to be able to create excerpts from multiple fields.

func Excerpt

func Excerpt(s string, max_char_count int) string

Cuts a long string at max_char_count, taking a word boundary into account.

func ExtractLocName

func ExtractLocName(s string) string

Extracts the name of the localization file from the given loc string.

func GetOnlyPair

func GetOnlyPair(c map[string]interface{}) (string, interface{})

Extracts the key value pair of a map which has a length of 1.

func IsLocString

func IsLocString(s string) bool

func Load

func Load(opt_i interface{}, root string, file []byte, get func(string, string) ([]byte, error)) ([]byte, error)

Searches all {{load modname/filename.ext}} and replaces that with the proper requires then calls the require module on the file.

func LoadLocStrings

func LoadLocStrings(dat map[string]interface{}, user_langs []string, root, tplpath string, loc_reader func(s string) (map[string]interface{}, error)) (map[string]interface{}, error)

tplpath is public/default or private/127.0.0.1/default

func LoadLocTempl

func LoadLocTempl(file_content string, user_langs []string, root, tplpath string, loc_reader func(s string) (map[string]interface{}, error)) (map[string]interface{}, error)

tplpath is public/default or private/127.0.0.1/default

func ReadFiles

func ReadFiles(root, tplpath string, user_langs []string, locfiles map[string]struct{}, loc_reader func(s string) (map[string]interface{}, error)) (map[string]interface{}, error)

Takes a list of localization filenames and tries to load every one of them, first from the template, then from the modules.

func RunQueries

func RunQueries(db *mgo.Database, queries map[string]interface{}, get map[string][]string, path_n_query string) map[string]interface{}

c: collection string q: query map[string]interface{} p: page number key string This is used to extract the page nubver from get parameters. Also activates paging.

Only works with limit.

sk: skip float64/int Hardcoded value, barely useful (see p instead) l: limit float64/int so: sort string Example: "-created"

TODO: check for validity of type assertions.

func RunQuery

func RunQuery(db *mgo.Database, query_name string, query map[string]interface{}, get map[string][]string, path_n_query string) map[string]interface{}

Convenience function.

Types

type PagingInfo

type PagingInfo struct {
	Result                                 []paging.Pelem
	Skip, Current_page, All_results, Limit int
	Paramkey, Url                          string
}

func DoPaging

func DoPaging(db *mgo.Database, collection string, query map[string]interface{}, page_num_key string, get map[string][]string, pnq string, limit int) PagingInfo

png = path and query In the CMS you can access it from uni.P + "?" + uni.Req.URL.RawQuery.

Jump to

Keyboard shortcuts

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