def add_container_menu_items(self, context, container): request = self.request _url = url.absoluteURL(container, request) if IReadContainer.providedBy(container): #XXX should be the same in all containers ? container=proxy.removeSecurityProxy(container) for name, item in container.items(): if context is None: selected = False else: selected = url.same_path_names(context.__name__, name) item = proxy.removeSecurityProxy(item) if IDCDescriptiveProperties.providedBy(item): title = item.title else: props = IDCDescriptiveProperties(item) title = props.title # only items with valid title if title is not None: self.items.append(url.get_menu_item_descriptor( title, selected, _url, name)) default_view_name = queryDefaultViewName(container, self.request) default_view = component.queryMultiAdapter( (container, self.request), name=default_view_name) if hasattr(default_view, "title") and default_view.title is not None: self.items.insert(0, url.get_menu_item_descriptor( default_view.title, sameProxiedObjects(container, self.context), _url))
def add_container_menu_items(self, context, container): request = self.request _url = url.absoluteURL(container, request) if IReadContainer.providedBy(container): #XXX should be the same in all containers ? container = proxy.removeSecurityProxy(container) for name, item in container.items(): if context is None: selected = False else: selected = url.same_path_names(context.__name__, name) item = proxy.removeSecurityProxy(item) if IDCDescriptiveProperties.providedBy(item): title = item.title else: props = IDCDescriptiveProperties(item) title = props.title # only items with valid title if title is not None: self.items.append( url.get_menu_item_descriptor(title, selected, _url, name)) default_view_name = queryDefaultViewName(container, self.request) default_view = component.queryMultiAdapter((container, self.request), name=default_view_name) if hasattr(default_view, "title") and default_view.title is not None: self.items.insert( 0, url.get_menu_item_descriptor( default_view.title, sameProxiedObjects(container, self.context), _url))
def add_container_menu_items(self, context, container): request = self.request # add a menu item for each user workspace, if we are in an # IWorkspaceSectionLayer # !+ if user is logged in or if request.layer_data if (interfaces.IWorkspaceSectionLayer.providedBy(request) or interfaces.IWorkspaceSchedulingSectionLayer.providedBy( request)): try: workspaces = IAnnotations(request)["layer_data"].get( "workspaces") except: workspaces = [] log.info("%s got user workspaces: %s" % (self, workspaces)) base_url_path = "/workspace" for workspace in workspaces: log.info("appending menu item for user workspace: %s" % str(workspace)) self.items.append( url.get_menu_item_descriptor( workspace.full_name, pos_action_in_url( "/workspace/obj-%s" % workspace.group_id, request.getURL()), base_url_path, "obj-%s" % workspace.group_id)) _url = url.absoluteURL(container, request) if IReadContainer.providedBy(container): #XXX should be the same in all containers ? container = proxy.removeSecurityProxy(container) for name, item in container.items(): if context is None: selected = False else: selected = url.same_path_names(context.__name__, name) item = proxy.removeSecurityProxy(item) if IDCDescriptiveProperties.providedBy(item): title = item.title else: props = IDCDescriptiveProperties(item) title = props.title # only items with valid title if title is not None: self.items.append( url.get_menu_item_descriptor(title, selected, _url, name)) default_view_name = queryDefaultViewName(container, self.request) default_view = component.queryMultiAdapter((container, self.request), name=default_view_name) if hasattr(default_view, "title") and default_view.title is not None: self.items.insert( 0, url.get_menu_item_descriptor( default_view.title, sameProxiedObjects(container, self.context), _url))
def add_container_menu_items(self, context, container): request = self.request # add a menu item for each user workspace, if we are in an # IWorkspaceSectionLayer # !+ if user is logged in or if request.layer_data if interfaces.IWorkspaceSectionLayer.providedBy(request): try: workspaces = IAnnotations(request)["layer_data"].get( "workspaces") except: workspaces = [] log.info("%s got user workspaces: %s" % (self, workspaces)) base_url_path = "/workspace" for workspace in workspaces: log.info("appending menu item for user workspace: %s" % str(workspace)) self.items.append( url.get_menu_item_descriptor( workspace.full_name, pos_action_in_url( "/workspace/obj-%s" % workspace.group_id, request.getURL()), base_url_path, "obj-%s" % workspace.group_id)) _url = url.absoluteURL(container, request) if IReadContainer.providedBy(container): #XXX should be the same in all containers ? container = proxy.removeSecurityProxy(container) for name, item in container.items(): if context is None: selected = False else: selected = url.same_path_names(context.__name__, name) item = proxy.removeSecurityProxy(item) if IDCDescriptiveProperties.providedBy(item): title = item.title else: props = IDCDescriptiveProperties(item) title = props.title # only items with valid title if title is not None: self.items.append( url.get_menu_item_descriptor(title, selected, _url, name)) default_view_name = queryDefaultViewName(container, self.request) default_view = component.queryMultiAdapter((container, self.request), name=default_view_name) if hasattr(default_view, "title") and default_view.title is not None: self.items.insert( 0, url.get_menu_item_descriptor( default_view.title, sameProxiedObjects(container, self.context), _url))