controllers

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: LGPL-3.0 Imports: 36 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CommonLess is the list of Less assets to import by the web client
	// that are common to the frontend and the backend. All less assets are
	// cat'ed together in the given order before being compiled.
	CommonLess = []string{
		"/static/web/src/less/fonts.less",
		"/static/web/src/less/navbar.less",
		"/static/web/src/less/mimetypes.less",
		"/static/web/src/less/animation.less",
		"/static/web/src/less/backend_variables.less",
	}
	// CommonCSS is the list of CSS files to include without compilation both
	// for the frontend and the backend.
	CommonCSS = []string{
		"/static/web/lib/jquery.ui/jquery-ui.css",
		"/static/web/lib/fontawesome/css/font-awesome.css",
		"/static/web/lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css",
		"/static/web/lib/select2/select2.css",
		"/static/web/lib/select2-bootstrap-css/select2-bootstrap.css",
	}
	// CommonJS is the list of JavaScript assets to import by the web client
	// that are common to the frontend and the backend
	CommonJS = []string{
		"/static/web/lib/es5-shim/es5-shim.min.js",
		"/static/web/lib/underscore/underscore.js",
		"/static/web/lib/underscore.string/lib/underscore.string.js",
		"/static/web/lib/moment/moment.js",
		"/static/web/lib/jquery/jquery.js",
		"/static/web/lib/jquery.ui/jquery-ui.js",
		"/static/web/lib/jquery/jquery.browser.js",
		"/static/web/lib/jquery.blockUI/jquery.blockUI.js",
		"/static/web/lib/jquery.hotkeys/jquery.hotkeys.js",
		"/static/web/lib/jquery.placeholder/jquery.placeholder.js",
		"/static/web/lib/jquery.form/jquery.form.js",
		"/static/web/lib/jquery.ba-bbq/jquery.ba-bbq.js",
		"/static/web/lib/jquery.mjs.nestedSortable/jquery.mjs.nestedSortable.js",
		"/static/web/lib/bootstrap/js/affix.js",
		"/static/web/lib/bootstrap/js/alert.js",
		"/static/web/lib/bootstrap/js/button.js",
		"/static/web/lib/bootstrap/js/carousel.js",
		"/static/web/lib/bootstrap/js/collapse.js",
		"/static/web/lib/bootstrap/js/dropdown.js",
		"/static/web/lib/bootstrap/js/modal.js",
		"/static/web/lib/bootstrap/js/tooltip.js",
		"/static/web/lib/bootstrap/js/popover.js",
		"/static/web/lib/bootstrap/js/scrollspy.js",
		"/static/web/lib/bootstrap/js/tab.js",
		"/static/web/lib/bootstrap/js/transition.js",
		"/static/web/lib/qweb/qweb2.js",
		"/static/web/src/js/boot.js",
		"/static/web/src/js/config.js",
		"/static/web/src/js/framework/class.js",
		"/static/web/src/js/framework/translation.js",
		"/static/web/src/js/framework/ajax.js",
		"/static/web/src/js/framework/time.js",
		"/static/web/src/js/framework/mixins.js",
		"/static/web/src/js/framework/widget.js",
		"/static/web/src/js/framework/registry.js",
		"/static/web/src/js/framework/session.js",
		"/static/web/src/js/framework/model.js",
		"/static/web/src/js/framework/dom_utils.js",
		"/static/web/src/js/framework/utils.js",
		"/static/web/src/js/framework/qweb.js",
		"/static/web/src/js/framework/bus.js",
		"/static/web/src/js/services/core.js",
		"/static/web/src/js/framework/dialog.js",
		"/static/web/src/js/framework/local_storage.js",
		"/static/web/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js",
		"/static/web/lib/select2/select2.js",
	}
	// BackendLess is the list of Less assets to import by the web client
	// that are specific to the backend. All less assets are
	// cat'ed together in the given order before being compiled.
	BackendLess = []string{
		"/static/web/src/less/import_bootstrap.less",
		"/static/web/src/less/bootstrap_overridden.less",
		"/static/web/src/less/webclient_extra.less",
		"/static/web/src/less/webclient_layout.less",
		"/static/web/src/less/webclient.less",
		"/static/web/src/less/datepicker.less",
		"/static/web/src/less/progress_bar.less",
		"/static/web/src/less/dropdown.less",
		"/static/web/src/less/tooltip.less",
		"/static/web/src/less/debug_manager.less",
		"/static/web/src/less/control_panel.less",
		"/static/web/src/less/control_panel_layout.less",
		"/static/web/src/less/views.less",
		"/static/web/src/less/pivot_view.less",
		"/static/web/src/less/graph_view.less",
		"/static/web/src/less/tree_view.less",
		"/static/web/src/less/form_view_layout.less",
		"/static/web/src/less/form_view.less",
		"/static/web/src/less/list_view.less",
		"/static/web/src/less/search_view.less",
		"/static/web/src/less/modal.less",
		"/static/web/src/less/data_export.less",
		"/static/web/src/less/switch_company_menu.less",
		"/static/web/src/less/dropdown_extra.less",
		"/static/web/src/less/views_extra.less",
		"/static/web/src/less/form_view_extra.less",
		"/static/web/src/less/form_view_layout_extra.less",
		"/static/web/src/less/search_view_extra.less",
		"/static/web/src/less/main.less",
		"/static/web/src/less/responsive_navbar.less",
		"/static/web/src/less/app_drawer.less",
		"/static/web/src/less/responsive_form_view.less",
		"/static/web/src/less/responsive_variables.less",
		"/static/web/src/less/drawer.less",
		"/static/web/src/less/backend_variables.less",
		"/static/web/src/less/bootswatch.less",
		"/static/web/src/less/style.less",
		"/static/web/src/less/sidebar.less",
	}
	// BackendCSS is the list of CSS files to include without compilation for
	// the backend.
	BackendCSS = []string{
		"/static/web/lib/nvd3/nv.d3.css",
		"/static/web/lib/jquery.drawer/css/drawer.3.2.2.css",
	}
	// BackendJS is the list of JavaScript assets to import by the web client
	// that are specific to the backend.
	BackendJS = []string{
		"/static/web/lib/jquery.scrollTo/jquery.scrollTo.js",
		"/static/web/lib/nvd3/d3.v3.js",
		"/static/web/lib/nvd3/nv.d3.js",
		"/static/web/lib/backbone/backbone.js",
		"/static/web/lib/fuzzy-master/fuzzy.js",
		"/static/web/lib/py.js/lib/py.js",
		"/static/web/lib/jquery.ba-bbq/jquery.ba-bbq.js",
		"/static/web/src/js/framework/data_model.js",
		"/static/web/src/js/framework/formats.js",
		"/static/web/src/js/framework/view.js",
		"/static/web/src/js/framework/pyeval.js",
		"/static/web/src/js/action_manager.js",
		"/static/web/src/js/control_panel.js",
		"/static/web/src/js/view_manager.js",
		"/static/web/src/js/abstract_web_client.js",
		"/static/web/src/js/web_client.js",
		"/static/web/src/js/framework/data.js",
		"/static/web/src/js/compatibility.js",
		"/static/web/src/js/framework/misc.js",
		"/static/web/src/js/framework/crash_manager.js",
		"/static/web/src/js/framework/data_manager.js",
		"/static/web/src/js/services/crash_manager.js",
		"/static/web/src/js/services/data_manager.js",
		"/static/web/src/js/services/session.js",
		"/static/web/src/js/widgets/auto_complete.js",
		"/static/web/src/js/widgets/change_password.js",
		"/static/web/src/js/widgets/debug_manager.js",
		"/static/web/src/js/widgets/data_export.js",
		"/static/web/src/js/widgets/date_picker.js",
		"/static/web/src/js/widgets/loading.js",
		"/static/web/src/js/widgets/notification.js",
		"/static/web/src/js/widgets/sidebar.js",
		"/static/web/src/js/widgets/priority.js",
		"/static/web/src/js/widgets/progress_bar.js",
		"/static/web/src/js/widgets/pager.js",
		"/static/web/src/js/widgets/systray_menu.js",
		"/static/web/src/js/widgets/switch_company_menu.js",
		"/static/web/src/js/widgets/user_menu.js",
		"/static/web/src/js/menu.js",
		"/static/web/src/js/views/list_common.js",
		"/static/web/src/js/views/list_view.js",
		"/static/web/src/js/views/form_view.js",
		"/static/web/src/js/views/form_common.js",
		"/static/web/src/js/views/form_widgets.js",
		"/static/web/src/js/views/form_upgrade_widgets.js",
		"/static/web/src/js/views/form_relational_widgets.js",
		"/static/web/src/js/views/list_view_editable.js",
		"/static/web/src/js/views/pivot_view.js",
		"/static/web/src/js/views/graph_view.js",
		"/static/web/src/js/views/graph_widget.js",
		"/static/web/src/js/views/search_view.js",
		"/static/web/src/js/views/search_filters.js",
		"/static/web/src/js/views/search_inputs.js",
		"/static/web/src/js/views/search_menus.js",
		"/static/web/src/js/views/tree_view.js",
		"/static/web/src/js/apps.js",
		"/static/web/lib/bililite-range/bililiteRange.2.6.js",
		"/static/web/lib/jquery.sendkeys/jquery.sendkeys.4.js",
		"/static/web/lib/iscroll/iscroll-probe.5.2.0.js",
		"/static/web/lib/jquery.drawer/js/drawer.3.2.2.js",
		"/static/web/src/js/web_responsive.js",
		"/static/web/src/js/sidebar.js",
		"/static/web/src/js/sidebar-toggle.js",
	}
	// FrontendLess is the list of Less assets to import by the web client
	// that are specific to the frontend. All less assets are
	// cat'ed together in the given order before being compiled.
	FrontendLess = []string{
		"/static/web/src/less/import_bootstrap.less",
	}
	// FrontendCSS is the list of CSS files to include without compilation for
	// the frontend.
	FrontendCSS []string
	// FrontendJS is the list of JavaScript assets to import by the web client
	// that are specific to the frontend.
	FrontendJS = []string{
		"/static/web/src/js/services/session.js",
	}
	// LessHelpers are less files that must be imported for compiling any assets
	LessHelpers = []string{
		"/static/web/lib/bootstrap/less/variables.less",
		"/static/web/lib/bootstrap/less/mixins/vendor-prefixes.less",
		"/static/web/lib/bootstrap/less/mixins/buttons.less",
		"/static/web/src/less/variables.less",
		"/static/web/src/less/utils.less",
	}
	// FrontendContext is the base context to update when rendering
	// a frontend HTML template.
	FrontendContext = hweb.Context{
		"commonCSS":           CommonCSS,
		"commonCompiledCSS":   commonCSSRoute,
		"commonJS":            CommonJS,
		"frontendCSS":         FrontendCSS,
		"frontendCompiledCSS": frontendCSSRoute,
		"frontendJS":          FrontendJS,
	}
)
View Source
var MethodAdapters = map[string]methodAdapter{
	"Create":     createAdapter,
	"Write":      writeAdapter,
	"Onchange":   onchangeAdapter,
	"Read":       readAdapter,
	"SearchRead": searchReadAdapter,
	"FieldsGet":  fieldsGetAdapter,
	"NameGet":    nameGetAdapter,
	"GetFilters": getFiltersAdapter,
}

MethodAdapters is a map giving the adapter to call for each method

Functions

func ActionLoad

func ActionLoad(c *server.Context)

ActionLoad returns the action with the given id

func ActionRun

func ActionRun(c *server.Context)

ActionRun runs the given server action

func AssetsBackendCSS

func AssetsBackendCSS(c *server.Context)

AssetsBackendCSS returns the compiled CSS for the backend assets

func AssetsCommonCSS

func AssetsCommonCSS(c *server.Context)

AssetsCommonCSS returns the compiled CSS for the common assets

func AssetsFrontendCSS

func AssetsFrontendCSS(c *server.Context)

AssetsFrontendCSS returns the compiled CSS for the frontend assets

func BootstrapTranslations

func BootstrapTranslations(c *server.Context)

BootstrapTranslations returns data about the current language

func CSSList

func CSSList(c *server.Context)

CSSList returns the list of CSS files

func CallButton

func CallButton(c *server.Context)

CallButton executes the given method of the given model and returns the result only if it is an action

func CallKW

func CallKW(c *server.Context)

CallKW executes the given method of the given model

func ChangePassword

func ChangePassword(c *server.Context)

ChangePassword is called by the client to change the current user password

func CompanyLogo(c *server.Context)

CompanyLogo serves the logo of the company

func Dashboard

func Dashboard(c *server.Context)

Dashboard returns the dashboard image of the company or the default one

func Execute

func Execute(uid int64, params CallParams) (res interface{}, rError error)

Execute executes a method on an object

func GetSessionInfo

func GetSessionInfo(c *server.Context)

GetSessionInfo returns the session information to the client

func Image

func Image(c *server.Context)

Image serves the image stored in the database (base64 encoded) in the given model and given field

func JSList

func JSList(c *server.Context)

JSList returns the list of JS files

func Load

func Load(c *server.Context)

Load executes a GET request and returns the values

func LoadLocale

func LoadLocale(c *server.Context)

LoadLocale returns the locale's JS file

func LoginGet

func LoginGet(c *server.Context)

LoginGet is called when the client calls the login page

func LoginPost

func LoginPost(c *server.Context)

LoginPost is called when the client sends credentials from the login page

func LoginRequired

func LoginRequired(c *server.Context)

LoginRequired is a middleware that redirects to login page non logged in users.

func Logout

func Logout(c *server.Context)

Logout the current user and redirect to login page

func MenuImage(c *server.Context)

MenuImage serves the image for the given menu

func MenuLoadNeedaction(c *server.Context)

MenuLoadNeedaction serves the number of objects that need an action in the given menu IDs

func Modules

func Modules(c *server.Context)

Modules returns the list of installed modules to the client

func QWeb

func QWeb(c *server.Context)

QWeb returns a concatenation of all client qweb templates

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 added in v0.0.13

func SearchReadController(c *server.Context)

SearchReadController returns Records from the database

func VersionInfo

func VersionInfo(c *server.Context)

VersionInfo returns server version information to the client

func WebClient

func WebClient(c *server.Context)

WebClient is the controller for the application main page

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 struct {
	ID          string
	Name        string
	Children    []Menu
	ActionID    string
	ActionModel string
	HasChildren bool
	HasAction   bool
}

A Menu is the representation of a single menu item

type SearchReadParams added in v0.0.13

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"`
}

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

Jump to

Keyboard shortcuts

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