def getEditModuleHierarchy(typename): _menu = {} menus = {} types = [] for type in loadAllDatatypes(): if type.name == typename: types = [type] break for dtype in types: # get menu for type _items = {} if dtype.name != "root": n = tree.Node("", type=dtype.name) menu_str = getEditMenuString(dtype.name) if menu_str != "": menus[n.type] = parseMenuString(menu_str) _menu = {} _menu[-1] = [] editModules = getEditModules() # modules installed in system for module in editModules: if module.startswith("menu"): active = -1 for m in menus[n.type]: if m.getName().endswith(module): active = menus[n.type].index(m) break if active not in _menu.keys(): _menu[active] = [] _menu[active].append(module) else: active = -1 for m in menus[n.type]: items = m.getItemList() for item in items: if item == module: active = menus[n.type].index(m) if active not in _items.keys(): _items[active] = [] _items[active].append( (module, items.index(item))) break if active == -1: if active not in _items.keys(): _items[active] = [] _items[active].append((module, 0)) for key in _menu.keys(): if key in _items.keys(): items = _items[key] items.sort(lambda x, y: cmp(x[1], y[1])) for item in items: _menu[key].append(item[0]) return _menu
def getEditModuleHierarchy(typename): _menu = {} menus = {} try: nodeclass = Node.get_class_for_typestring(typename.lower()) except KeyError: return {} if typename == "root": return {} _items = {} menu_str = get_edit_menu_tabs(nodeclass) if menu_str != "": menus[nodeclass.name] = parseMenuString(menu_str) _menu = {} _menu[-1] = [] editModules = getEditModules() # modules installed in system for module in editModules: if module.startswith("menu"): active = -1 for m in menus[nodeclass.name]: if m.getName().endswith(module): active = menus[nodeclass.name].index(m) break if active not in _menu.keys(): _menu[active] = [] _menu[active].append(module) else: active = -1 for m in menus[nodeclass.name]: items = m.getItemList() for item in items: if item == module: active = menus[nodeclass.name].index(m) if active not in _items.keys(): _items[active] = [] _items[active].append((module, items.index(item))) break if active == -1: if active not in _items.keys(): _items[active] = [] _items[active].append((module, 0)) for key in _menu.keys(): if key in _items.keys(): items = _items[key] items.sort(lambda x, y: cmp(x[1], y[1])) for item in items: _menu[key].append(item[0]) return _menu
def getEditModuleHierarchy(typename): _menu = {} menus = {} types = [] for type in loadAllDatatypes(): if type.name == typename: types = [type] break for dtype in types: # get menu for type _items = {} if dtype.name != "root": n = tree.Node("", type=dtype.name) menu_str = getEditMenuString(dtype.name) if menu_str != "": menus[n.type] = parseMenuString(menu_str) _menu = {} _menu[-1] = [] editModules = getEditModules() # modules installed in system for module in editModules: if module.startswith("menu"): active = -1 for m in menus[n.type]: if m.getName().endswith(module): active = menus[n.type].index(m) break if active not in _menu.keys(): _menu[active] = [] _menu[active].append(module) else: active = -1 for m in menus[n.type]: items = m.getItemList() for item in items: if item == module: active = menus[n.type].index(m) if active not in _items.keys(): _items[active] = [] _items[active].append((module, items.index(item))) break if active == -1: if active not in _items.keys(): _items[active] = [] _items[active].append((module, 0)) for key in _menu.keys(): if key in _items.keys(): items = _items[key] items.sort(lambda x, y: cmp(x[1], y[1])) for item in items: _menu[key].append(item[0]) return _menu
def filterMenu(menuitems, user): hide = user.hidden_edit_functions ret = [] for menu in parseMenuString(menuitems): i = [] for item in menu.getItemList(): if item not in hide: i.append(item) menu.item = i ret.append(menu) return ret
def filterMenu(menuitems, user): hide = users.getHideMenusForUser(user) ret = [] for menu in parseMenuString(menuitems): i = [] for item in menu.getItemList(): if item not in hide: i.append(item) menu.item = i ret.append(menu) return ret
def adminNavigation(): if len(adminModules) == 0: # load admin modules mods = getAdminModules(os.walk(os.path.join(config.basedir, 'web/admin/modules'))) for mod in mods: if hasattr(mods[mod], "getInformation"): adminModules[mod] = (mods[mod]) # get module configuration root = q(Root).one() admin_configuration = root.system_attrs.get("admin.menu", "") if admin_configuration == "": # no confguration found -> use default admin_configuration = "menumain();menudata(metatype;mapping);menuworkflow(workflows);menusystem(settingsmenu)" root.system_attrs["admin.menu"] = admin_configuration return parseMenuString(admin_configuration[:-1])
def adminNavigation(): if len(adminModules) == 0: # load admin modules mods = getAdminModules(os.walk(os.path.join(config.basedir, 'web/admin/modules'))) for mod in mods: if hasattr(mods[mod], "getInformation"): adminModules[mod] = (mods[mod]) # get module configuration root = getRoot() admin_configuration = root.get("admin.menu") if admin_configuration == "": # no confguration found -> use default admin_configuration = "menumain();menuuser(usergroup;user);menuacl(acls);menudata(metatype;mapping);menuworkflow(workflows);menusystem(logfile;flush;settings;settingsmenu)" root.set("admin.menu", admin_configuration) return parseMenuString(admin_configuration[:-1])
def adminNavigation(): if len(adminModules) == 0: # load admin modules mods = getAdminModules( os.walk(os.path.join(config.basedir, 'web/admin/modules'))) for mod in mods: if hasattr(mods[mod], "getInformation"): adminModules[mod] = (mods[mod]) # get module configuration root = q(Root).one() admin_configuration = root.system_attrs.get("admin.menu", "") if admin_configuration == "": # no confguration found -> use default admin_configuration = "menumain();menudata(metatype;mapping);menuworkflow(workflows);menusystem(settingsmenu)" root.system_attrs["admin.menu"] = admin_configuration return parseMenuString(admin_configuration[:-1])