Documentation ¶
Index ¶
- Variables
- func ActionLoad(c *server.Context)
- func ActionRun(c *server.Context)
- func AssetsBackendCSS(c *server.Context)
- func AssetsCommonCSS(c *server.Context)
- func AssetsFrontendCSS(c *server.Context)
- func CSSList(c *server.Context)
- func CallButton(c *server.Context)
- func CallKW(c *server.Context)
- func ChangePassword(c *server.Context)
- func CheckUser(uid int64)
- func CompanyLogo(c *server.Context)
- func Dashboard(c *server.Context)
- func Execute(uid int64, params CallParams) (res interface{}, rError error)
- func GetSessionInfo(c *server.Context)
- func Image(c *server.Context)
- func JSList(c *server.Context)
- func Load(c *server.Context)
- func LoadLocale(c *server.Context)
- func LoadMenus(c *server.Context)
- func LoginGet(c *server.Context)
- func LoginPost(c *server.Context)
- func LoginRequired(c *server.Context)
- func Logout(c *server.Context)
- func MenuImage(c *server.Context)
- func MenuLoadNeedaction(c *server.Context)
- func Modules(c *server.Context)
- func QWeb(c *server.Context)
- func RegisterRoutes()
- func SearchRead(uid int64, params SearchReadParams) (res *webtypes.SearchReadResult, rError error)
- func SearchReadController(c *server.Context)
- func Translations(c *server.Context)
- func VersionInfo(c *server.Context)
- func WebClient(c *server.Context)
- type CallParams
- type ChangePasswordData
- type Menu
- type SearchReadParams
- type SessionInfo
- type UserCompanies
Constants ¶
This section is empty.
Variables ¶
var ( // AssetsUtils contains the list of scss utilities that must be compiled first AssetsUtils = []string{ "/static/web/lib/bootstrap/scss/_functions.scss", "/static/web/lib/bootstrap/scss/_mixins.scss", "/static/web/src/scss/bs_mixins_overrides.scss", "/static/web/src/scss/utils.scss", } // AssetsPrimaryVariables contains the list of scss files defining primary variables AssetsPrimaryVariables = []string{ "/static/web/src/scss/primary_variables.scss", } // AssetsSecondaryVariables contains the list of scss files defining secondary variables AssetsSecondaryVariables = []string{ "/static/web/src/scss/secondary_variables.scss", } // AssetsBootstrapVariables contains the list of scss files with bootstrap variables AssetsBootstrapVariables = []string{ "/static/web/lib/bootstrap/scss/_variables.scss", } // AssetsBackendHelper contains the list of scss files that need to override Bootstrap variables in backend AssetsBackendHelper = []string{ "/static/web/src/scss/bootstrap_overridden.scss", } // AssetsFrontendHelper contains the list of scss files that need to override Bootstrap variables in frontend AssetsFrontendHelper = []string{ "/static/web/src/scss/bootstrap_overridden.scss", } // AssetsBootstrap contains the list of scss files that import boostrap AssetsBootstrap = []string{ "/static/web/src/scss/import_bootstrap.scss", "/static/web/src/scss/bootstrap_review.scss", } // CommonScss is the list of Scss assets to import by the web client // that are common to the frontend and the backend. All Scss assets are // cat'ed together in the given order before being compiled. // // Assets utils will be inserted before this list CommonScss = []string{ "/static/web/lib/tempusdominus/tempusdominus.scss", "/static/web/src/scss/fonts.scss", "/static/web/src/scss/ui.scss", "/static/web/src/scss/ui_extra.scss", "/static/web/src/scss/navbar.scss", "/static/web/src/scss/mimetypes.scss", "/static/web/src/scss/modal.scss", "/static/web/src/scss/animation.scss", "/static/web/src/scss/rainbow.scss", "/static/web/src/scss/datepicker.scss", "/static/web/src/scss/daterangepicker.scss", "/static/web/src/scss/banner.scss", "/static/web/src/scss/colorpicker.scss", "/static/web/src/scss/translation_dialog.scss", "/static/web/src/scss/keyboard.scss", "/static/web/src/scss/name_and_signature.scss", "/static/web/src/scss/web.zoomodoo.scss", "/static/web/src/scss/fontawesome_overridden.scss", } // BackendScss is the list of Scss assets to import by the web client // that are specific to the backend. All scss assets are // cat'ed together in the given order before being compiled. // // Assets utils will be inserted before this list BackendScss = []string{ "/static/web/src/scss/webclient_extra.scss", "/static/web/src/scss/webclient_layout.scss", "/static/web/src/scss/webclient.scss", "/static/web/src/scss/domain_selector.scss", "/static/web/src/scss/model_field_selector.scss", "/static/web/src/scss/progress_bar.scss", "/static/web/src/scss/dropdown.scss", "/static/web/src/scss/dropdown_extra.scss", "/static/web/src/scss/tooltip.scss", "/static/web/src/scss/switch_company_menu.scss", "/static/web/src/scss/debug_manager.scss", "/static/web/src/scss/control_panel.scss", "/static/web/src/scss/fields.scss", "/static/web/src/scss/fields_extra.scss", "/static/web/src/scss/views.scss", "/static/web/src/scss/pivot_view.scss", "/static/web/src/scss/graph_view.scss", "/static/web/src/scss/form_view.scss", "/static/web/src/scss/form_view_extra.scss", "/static/web/src/scss/list_view.scss", "/static/web/src/scss/list_view_extra.scss", "/static/web/src/scss/kanban_dashboard.scss", "/static/web/src/scss/kanban_examples_dialog.scss", "/static/web/src/scss/kanban_column_progressbar.scss", "/static/web/src/scss/kanban_view.scss", "/static/web/src/scss/kanban_view_mobile.scss", "/static/web/src/scss/web_calendar.scss", "/static/web/src/scss/web_calendar_mobile.scss", "/static/web/src/scss/search_view.scss", "/static/web/src/scss/search_panel.scss", "/static/web/src/scss/search_view_mobile.scss", "/static/web/src/scss/dropdown_menu.scss", "/static/web/src/scss/search_view_extra.scss", "/static/web/src/scss/data_export.scss", "/static/web/src/scss/attachment_preview.scss", "/static/web/src/scss/notification.scss", "/static/web/src/scss/base_document_layout.scss", "/static/web/src/scss/ribbon.scss", "/static/web/src/scss/base_settings.scss", "/static/web/src/scss/report_backend.scss", "/static/web/src/scss/web_responsive.scss", "/static/web/src/scss/style.scss", "/static/web/src/scss/sidebar.scss", } // FrontendScss is the list of Less assets to import by the web client // that are specific to the frontend. All scss assets are // cat'ed together in the given order before being compiled. // // Assets utils will be inserted before this list FrontendScss = []string{ "/static/web/src/scss/lazyloader.scss", "/static/web/src/scss/navbar_mobile.scss", "/static/web/src/scss/notification.scss", } // FrontendContext is the base context to update when rendering // a frontend HTML template. FrontendContext = hweb.Context{ "commonCompiledCSS": commonCSSRoute, "frontendCompiledCSS": frontendCSSRoute, } )
var ( // TypeSubstitutions maps interface types to appropriate concrete types to unmarshal into. // // All types that implement the interface type will use the given concrete type. TypeSubstitutions = map[reflect.Type]reflect.Type{ reflect.TypeOf((*models.RecordData)(nil)).Elem(): reflect.TypeOf(models.FieldMap{}), } // TypePostProcess maps interface types to a function to apply after unmarshalling. TypePostProcess = map[reflect.Type]interface{}{ reflect.TypeOf((*models.RecordData)(nil)).Elem(): func(rs models.RecordSet, arg models.FieldMap) interface{} { return makeModelData(rs, arg).Wrap() }, } )
var MethodAdapters = map[string]methodAdapter{
"Create": createAdapter,
"Write": writeAdapter,
"Onchange": onchangeAdapter,
"Read": readAdapter,
"SearchRead": searchReadAdapter,
"FieldsGet": fieldsGetAdapter,
"NameGet": nameGetAdapter,
}
MethodAdapters is a map giving the adapter to call for each method
Functions ¶
func ActionLoad ¶
ActionLoad returns the action with the given id
func AssetsBackendCSS ¶
AssetsBackendCSS returns the compiled CSS for the backend assets
func AssetsCommonCSS ¶
AssetsCommonCSS returns the compiled CSS for the common assets It creates the temp file on the fly if it doesn't exist yet
func AssetsFrontendCSS ¶
AssetsFrontendCSS returns the compiled CSS for the frontend assets
func CallButton ¶
CallButton executes the given method of the given model and returns the result only if it is an action
func ChangePassword ¶
ChangePassword is called by the client to change the current user password
func CheckUser ¶
func CheckUser(uid int64)
CheckUser panics if the given uid is 0 (i.e. no user is logged in).
func Execute ¶
func Execute(uid int64, params CallParams) (res interface{}, rError error)
Execute executes a method on an object
func GetSessionInfo ¶
GetSessionInfo returns the session information to the client
func Image ¶
Image serves the image stored in the database (base64 encoded) in the given model and given field
func LoginRequired ¶
LoginRequired is a middleware that redirects to login page non logged in users.
func MenuLoadNeedaction ¶
MenuLoadNeedaction serves the number of objects that need an action in the given menu IDs
func RegisterRoutes ¶
func RegisterRoutes()
RegisterRoutes register all controllers for the web module. This function is called from the web PreInit function so that server.ResourceDir is set before calling this function, but controllers.Bootstrap is not, yet.
func SearchRead ¶
func SearchRead(uid int64, params SearchReadParams) (res *webtypes.SearchReadResult, rError error)
SearchRead retrieves database records according to the filters defined in params.
func SearchReadController ¶
SearchReadController returns Records from the database
func Translations ¶
Translations returns data about the current language
func VersionInfo ¶
VersionInfo returns server version information to the client
Types ¶
type CallParams ¶
type CallParams struct { Model string `json:"model"` Method string `json:"method"` Args []json.RawMessage `json:"args"` KWArgs map[string]json.RawMessage `json:"kwargs"` }
CallParams is the arguments' struct for the Execute function. It defines a method to call on a model with the given args and keyword args.
type ChangePasswordData ¶
type ChangePasswordData struct { Fields []struct { Name string `json:"name"` Value string `json:"value"` } `json:"fields"` }
ChangePasswordData is the params format passed to ChangePassword controller
type Menu ¶
type Menu struct { ID int64 `json:"id"` XMLID string `json:"xmlid"` Name string `json:"name"` Children []Menu `json:"children"` Action actions.ActionString `json:"action"` Parent parentTuple `json:"parent_id"` Sequence uint8 `json:"sequence"` WebIconData string `json:"web_icon_data"` }
A Menu is the representation of a single menu item
type SearchReadParams ¶
type SearchReadParams struct { Context types.Context `json:"context"` Domain domains.Domain `json:"domain"` Fields []string `json:"fields"` Limit interface{} `json:"limit"` Model string `json:"model"` Offset int `json:"offset"` Sort string `json:"sort"` }
SearchReadParams is the args struct for the searchRead function.
type SessionInfo ¶
type SessionInfo struct { SessionID int64 `json:"session_id"` UID int64 `json:"uid"` UserContext map[string]interface{} `json:"user_context"` DB string `json:"db"` UserName string `json:"username"` CompanyID int64 `json:"company_id"` Name string `json:"name"` IsSystem bool `json:"is_system"` IsAdmin bool `json:"is_admin"` PartnerDisplayName string `json:"partner_display_name"` PartnerID int64 `json:"partner_id"` UserCompanies UserCompanies `json:"user_companies"` WebBaseURL string `json:"web.base.url"` ShowEffect bool `json:"show_effect"` DisplaySwitchCompanyMenu bool `json:"display_switch_company_menu"` CacheHashes map[string]string `json:"cache_hashes"` }
SessionInfo gathers all information about the current session
func GetSessionInfoStruct ¶
func GetSessionInfoStruct(sess sessions.Session) *SessionInfo
GetSessionInfoStruct returns a struct with information about the given session
type UserCompanies ¶
type UserCompanies struct { CurrentCompany webtypes.RecordIDWithName `json:"current_company"` AllowedCompanies []webtypes.RecordIDWithName `json:"allowed_companies"` }
UserCompanies for the se