core (menus): constants are used for menu types
This commit is contained in:
parent
603f2e5760
commit
126d95e764
2 changed files with 22 additions and 7 deletions
|
|
@ -58,6 +58,15 @@ class Const(object):
|
|||
STATIC_BLOG_PARAM_KEYWORDS = "Keywords"
|
||||
STATIC_BLOG_PARAM_DESCRIPTION = "Description"
|
||||
|
||||
## Menus ##
|
||||
|
||||
MENU_GLOBAL = "GLOBAL"
|
||||
MENU_ROOM = "ROOM"
|
||||
MENU_SINGLE = "SINGLE"
|
||||
MENU_JID_CONTEXT = "JID_CONTEXT"
|
||||
MENU_ROSTER_JID_CONTEXT = "ROSTER_JID_CONTEXT"
|
||||
MENU_ROSTER_GROUP_CONTEXT = "MENU_ROSTER_GROUP_CONTEXT"
|
||||
|
||||
## Profile and entities ##
|
||||
PROF_KEY_NONE = '@NONE@'
|
||||
PROF_KEY_DEFAULT = '@DEFAULT@'
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ class SAT(service.Service):
|
|||
"""Authenticate the profile.
|
||||
|
||||
@param password (string): the SàT profile password
|
||||
@param profile_key: %(doc_profile_key)s
|
||||
@param profile: %(doc_profile)s
|
||||
@return: Deferred: a deferred None in case of success, a failure otherwise.
|
||||
"""
|
||||
session_data = self.memory.auth_sessions.profileGetUnique(profile)
|
||||
|
|
@ -771,7 +771,7 @@ class SAT(service.Service):
|
|||
|
||||
#Menus management
|
||||
|
||||
def importMenu(self, path, callback, security_limit=C.NO_SECURITY_LIMIT, help_string="", type_="NORMAL"):
|
||||
def importMenu(self, path, callback, security_limit=C.NO_SECURITY_LIMIT, help_string="", type_=C.MENU_GLOBAL):
|
||||
"""register a new menu for frontends
|
||||
@param path: path to go to the menu (category/subcategory/.../item), must be an iterable (e.g.: ("File", "Open"))
|
||||
/!\ use D_() instead of _() for translations (e.g. (D_("File"), D_("Open")))
|
||||
|
|
@ -781,11 +781,17 @@ class SAT(service.Service):
|
|||
@param help_string: string used to indicate what the menu do (can be show as a tooltip).
|
||||
/!\ use D_() instead of _() for translations
|
||||
@param type: one of:
|
||||
- GLOBAL: classical menu, can be shown in a menubar on top (e.g. something like File/Open)
|
||||
- ROOM: like a global menu, but only shown in multi-user chat
|
||||
- JID_CONTEXT: contextual menu, used with any jid (e.g.: ad hoc commands, jid is already filled)
|
||||
- ROSTER_JID_CONTEXT: like JID_CONTEXT, but restricted to jids in roster.
|
||||
- ROSTER_GROUP_CONTEXT: contextual menu, used with group (e.g.: publish microblog, group is already filled)
|
||||
- C.MENU_GLOBAL: classical menu, can be shown in a menubar on top (e.g. something like File/Open)
|
||||
- C.MENU_ROOM: like a global menu, but only shown in multi-user chat
|
||||
menu_data must contain a "room_jid" data
|
||||
- C.MENU_SINGLE: like a global menu, but only shown in one2one chat
|
||||
menu_data must contain a "jid" data
|
||||
- C.MENU_JID_CONTEXT: contextual menu, used with any jid (e.g.: ad hoc commands, jid is already filled)
|
||||
menu_data must contain a "jid" data
|
||||
- C.MENU_ROSTER_JID_CONTEXT: like JID_CONTEXT, but restricted to jids in roster.
|
||||
menu_data must contain a "room_jid" data
|
||||
- C.MENU_ROSTER_GROUP_CONTEXT: contextual menu, used with group (e.g.: publish microblog, group is already filled)
|
||||
menu_data must contain a "group" data
|
||||
@return: menu_id (same as callback_id)
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue