def get_group_watchers(context): """Index people who should have context appear in their timeline.""" if context.portal_type in ( "Discussion Item", "collective.history.useraction" ): return watchers = [] context = aq_inner(context) group = context #Add content's creators as watchers if hasattr(context, 'creators'): watchers.extend(context.creators) elif hasattr(context, 'Creators'): watchers.extend(context.Creators()) #Add followers of the first content's creator as watchers watchers.extend(get_followers(context)) if context.portal_type != "collective.rcse.group": group = get_group(context) if group and hasattr(group, 'creators'): watchers.extend(group.creators) #Add watchers of the group as watchers of the content watcherlist = component.queryAdapter( group, interface=IWatcherList, name="group_watchers", default=None ) if watcherlist: watchers.extend(watcherlist.watchers) watchers = tuple(set(watchers)) return watchers
def update(self): if self.tools is None: self.tools = component.getMultiAdapter( (self.context, self.request), name="plone_tools") if self.catalog is None: catalogid = 'portal_requestaccess_catalog' self.catalog = getToolByName(self.context, catalogid) if self.memberid is None: mtool = self.tools.membership() member = mtool.getAuthenticatedMember() if member is not None: self.memberid = member.getId() if self.pstate is None: self.pstate = component.getMultiAdapter( (self.context, self.request), name="plone_portal_state") if self.container is None: portal = self.pstate.portal() self.container = portal.portal_requestaccess self.group = get_group(self.context) self.proxy_manager = None if self.group is not None: name = "@@proxy_group_manager" self.proxy_manager = self.group.unrestrictedTraverse(name) self.proxy_manager.update() self.proxy_group = self.proxy_manager.proxy self.group = self.proxy_manager.group
def get_group_watchers(context): """Index people who should have context appear in their timeline.""" if context.portal_type in ("Discussion Item", "collective.history.useraction"): return watchers = [] context = aq_inner(context) group = context #Add content's creators as watchers if hasattr(context, 'creators'): watchers.extend(context.creators) elif hasattr(context, 'Creators'): watchers.extend(context.Creators()) #Add followers of the first content's creator as watchers watchers.extend(get_followers(context)) if context.portal_type != "collective.rcse.group": group = get_group(context) if group and hasattr(group, 'creators'): watchers.extend(group.creators) #Add watchers of the group as watchers of the content watcherlist = component.queryAdapter(group, interface=IWatcherList, name="group_watchers", default=None) if watcherlist: watchers.extend(watcherlist.watchers) watchers = tuple(set(watchers)) return watchers
def update(self): if self.tools is None: self.tools = component.getMultiAdapter( (self.context, self.request), name="plone_tools" ) if self.catalog is None: catalogid = 'portal_requestaccess_catalog' self.catalog = getToolByName(self.context, catalogid) if self.memberid is None: mtool = self.tools.membership() member = mtool.getAuthenticatedMember() if member is not None: self.memberid = member.getId() if self.pstate is None: self.pstate = component.getMultiAdapter( (self.context, self.request), name="plone_portal_state" ) if self.container is None: portal = self.pstate.portal() self.container = portal.portal_requestaccess self.group = get_group(self.context) self.proxy_manager = None if self.group is not None: name = "@@proxy_group_manager" self.proxy_manager = self.group.unrestrictedTraverse(name) self.proxy_manager.update() self.proxy_group = self.proxy_manager.proxy self.group = self.proxy_manager.group
def __call__(self): group = get_group(self.context) if group is not None and group != self.context: url = group.absolute_url() + '/@@manage-portlets' self.request.response.redirect(url) return return super(ManageContextualPortlets, self).__call__()
def __init__(self, context): self.what = "collective.rcse.group" self.where = None group = get_group(context) if group: portal_membership = getToolByName(context, 'portal_membership') if portal_membership.checkPermission('Add portal content', group): self.where = IUUID(group)
def updateGroup(self): if self.group is None: self.group = get_group(self.context) if self.group is not None: if self.group_url is None: self.group_url = self.group.absolute_url() if self.group_title is None: self.group_title = self.group.Title()
def updateGroup(self): if self.group is None: self.group = get_group(self.context) if self.group is not None: if self.group_url is None: self.group_url = self.group.absolute_url() if self.group_title is None: self.group_title = self.group.Title()
def __init__(self, context): self.what = "collective.rcse.group" self.where = None group = get_group(context) if group: portal_membership = getToolByName(context, 'portal_membership') if portal_membership.checkPermission('Add portal content', group): self.where = IUUID(group)
def group_url(self): group = get_group(self.context) if group is None: group_url = self.portal_state.navigation_root_url() if not group_url.endswith('/home'): group_url += '/home' else: group_url = group.absolute_url() return group_url
def get_query(self): query = {"sort_on": "effective", "sort_limit": self.data.count} if self.data.ptype: query['portal_type'] = self.data.ptype group = get_group(self.context) if self.data.group and group: query['path'] = {'query' : '/'.join(group.getPhysicalPath()), 'depth': 1} return query
def group_url(self): group = get_group(self.context) if group is None: group_url = self.portal_state.navigation_root_url() if not group_url.endswith('/home'): group_url += '/home' else: group_url = group.absolute_url() return group_url
def get_query(self): query = {"sort_on": "effective", "sort_limit": self.data.count} if self.data.ptype: query['portal_type'] = self.data.ptype group = get_group(self.context) if self.data.group and group: query['path'] = { 'query': '/'.join(group.getPhysicalPath()), 'depth': 1 } return query
def get_calendar_url(context, search_base): portal_state = context.restrictedTraverse('plone_portal_state') navigation_root = portal_state.navigation_root() if search_base: base = navigation_root.restrictedTraverse(search_base.lstrip('/')) return '%s/event_listing' % base.absolute_url() else: group = get_group(context) if group is None: group = navigation_root return '%s/event_listing' % group.absolute_url()
def get_calendar_url(context, search_base): portal_state = context.restrictedTraverse('plone_portal_state') navigation_root = portal_state.navigation_root() if search_base: base = navigation_root.restrictedTraverse(search_base.lstrip('/')) return '%s/event_listing' % base.absolute_url() else: group = get_group(context) if group is None: group = navigation_root return '%s/event_listing' % group.absolute_url()
def update(self): self.membership = getToolByName(self.context, 'portal_membership') super(EditBar, self).update() #MENU self.menus = {} for menu in MENUS: self.menus[menu] = getUtility( IBrowserMenu, name=menu, ).getMenuItems(self.context, self.request) #remove advanced workflow action if exists if len(self.menus["plone_contentmenu_workflow"]): del self.menus["plone_contentmenu_workflow"][-1] self.context_state = getMultiAdapter((self.context, self.request), name=u'plone_context_state') self.object_actions = self.context_state.actions('object') try: adapter = queryAdapter(self.context, IStringSubstitution, 'review_state_title') if adapter: self.review_state = adapter() else: self.review_state = None except WorkflowException: self.review_state = None self.object_uid = unicode(IUUID(self.context, u"")) self.group = get_group(self.context) self.isGroup = self.context.portal_type in ( "collective.rcse.group", "collective.rcse.proxygroup" ) self.member = self.portal_state.member() if self.member is not None and self.group is not None: self.memberid = self.member.getId() getroles = self.group.manage_getUserRolesAndPermissions # TODO Remove security manage save and reset when # https://github.com/zopefoundation/AccessControl/issues/4 # is fixed sm = getSecurityManager() self.roles = getroles(self.memberid) setSecurityManager(sm) self.isOwner = self.hasRole("Owner") # owner = self.group.getOwner() # if owner: # self.isOwner = self.memberid == owner.getId() self.isManager = self.hasRole("Manager") self.isSiteAdmin = self.hasRole("Site Administrator") self.isContributor = self.hasRole("Contributor")
def update(self): if self.plone_utils is None: self.plone_utils = getToolByName(self.context, 'plone_utils') if self.use_view_action is None: pp = getToolByName(self.context, 'portal_properties') self.use_view_action = pp.site_properties.getProperty( 'typesUseViewActionInListings', ()) if self.group is None: self.group = get_group(self.context) name = "@@timeline_header_group" self.group_description = self.group.restrictedTraverse(name)() super(GroupTimelineView, self).update()
def update(self): self.membership = getToolByName(self.context, 'portal_membership') super(EditBar, self).update() #MENU self.menus = {} for menu in MENUS: self.menus[menu] = getUtility( IBrowserMenu, name=menu, ).getMenuItems(self.context, self.request) #remove advanced workflow action if exists if len(self.menus["plone_contentmenu_workflow"]): del self.menus["plone_contentmenu_workflow"][-1] self.context_state = getMultiAdapter((self.context, self.request), name=u'plone_context_state') self.object_actions = self.context_state.actions('object') try: adapter = queryAdapter(self.context, IStringSubstitution, 'review_state_title') if adapter: self.review_state = adapter() else: self.review_state = None except WorkflowException: self.review_state = None self.object_uid = unicode(IUUID(self.context, u"")) self.group = get_group(self.context) self.isGroup = self.context.portal_type in ( "collective.rcse.group", "collective.rcse.proxygroup") self.member = self.portal_state.member() if self.member is not None and self.group is not None: self.memberid = self.member.getId() getroles = self.group.manage_getUserRolesAndPermissions # TODO Remove security manage save and reset when # https://github.com/zopefoundation/AccessControl/issues/4 # is fixed sm = getSecurityManager() self.roles = getroles(self.memberid) setSecurityManager(sm) self.isOwner = self.hasRole("Owner") # owner = self.group.getOwner() # if owner: # self.isOwner = self.memberid == owner.getId() self.isManager = self.hasRole("Manager") self.isSiteAdmin = self.hasRole("Site Administrator") self.isContributor = self.hasRole("Contributor")
def update(self): AutoExtensibleForm.update(self) form.Form.update(self) #if I can use the current group to add content set the value of where factory = component.queryUtility(IVocabularyFactory, "collective.rcse.vocabulary.groups") vocab = factory(self.context) group = get_group(self.context) if group: uid = IUUID(group) try: if vocab.getTerm(uid): self.widgets['where'].value = uid except LookupError: pass self.widgets['where'].value = uid
def update(self): AutoExtensibleForm.update(self) form.Form.update(self) #if I can use the current group to add content set the value of where factory = component.queryUtility(IVocabularyFactory, "collective.rcse.vocabulary.groups") vocab = factory(self.context) group = get_group(self.context) if group: uid = IUUID(group) try: if vocab.getTerm(uid): self.widgets['where'].value = uid except LookupError: pass self.widgets['where'].value = uid
def update(self): self.features = settings.features self.group = get_group(self.context) self.catalog = getToolByName(self.context, 'portal_catalog') self.path = self.context.getPhysicalPath() self.path_str = "/".join(self.context.getPhysicalPath()) self.context_state = component.getMultiAdapter( (self.context, self.request), name=u'plone_context_state') self.portal_state = component.getMultiAdapter( (self.context, self.request), name=u'plone_portal_state') self.navroot = self.portal_state.navigation_root() self.navroot_path = self.navroot.getPhysicalPath() parents_ids = self.path[len(self.navroot_path):] #the breadcrumb let you select two levels of groups self.parents_info = [] query1 = { "path": { "query": '/'.join(self.navroot_path), "depth": 1 }, "portal_type": "collective.rcse.group" } brains = self.catalog(**query1) parents = self.get_brain_info(brains) self.parents_info.append(parents) self.parent_url = None #level2. #FIXME: il faut voir au niveau du parents_ids. if len(parents_ids) > 0: # context is in a group self.parent_url = self.context.aq_inner.aq_parent.absolute_url() # We add Back to current group in the list path = '/'.join(self.navroot_path + parents_ids[:1]) query2 = { "path": { "query": path, "depth": 1 }, "portal_type": "collective.rcse.group" } brains = self.catalog(**query2) if brains: parents = self.get_brain_info(brains) self.parents_info.append(parents)
def update(self): self.features = settings.features self.group = get_group(self.context) self.catalog = getToolByName(self.context, 'portal_catalog') self.path = self.context.getPhysicalPath() self.path_str = "/".join(self.context.getPhysicalPath()) self.context_state = component.getMultiAdapter( (self.context, self.request), name=u'plone_context_state' ) self.portal_state = component.getMultiAdapter( (self.context, self.request), name=u'plone_portal_state' ) self.navroot = self.portal_state.navigation_root() self.navroot_path = self.navroot.getPhysicalPath() parents_ids = self.path[len(self.navroot_path):] #the breadcrumb let you select two levels of groups self.parents_info = [] query1 = {"path": {"query": '/'.join(self.navroot_path), "depth": 1}, "portal_type": "collective.rcse.group"} brains = self.catalog(**query1) parents = self.get_brain_info(brains) self.parents_info.append(parents) self.parent_url = None #level2. #FIXME: il faut voir au niveau du parents_ids. if len(parents_ids) > 0: # context is in a group self.parent_url = self.context.aq_inner.aq_parent.absolute_url() # We add Back to current group in the list path = '/'.join(self.navroot_path + parents_ids[:1]) query2 = {"path": {"query": path, "depth": 1}, "portal_type": "collective.rcse.group"} brains = self.catalog(**query2) if brains: parents = self.get_brain_info(brains) self.parents_info.append(parents)
def _doDelete(self): wf = self.context.restrictedTraverse('folder_publish') ##parameters=workflow_action=None, paths=[], comment='No comment', ##expiration_date=None, effective_date=None, include_children=False wf(workflow_action="delete", comment="RCSE Delete action", include_children=True, paths=['/'.join(self.context.getPhysicalPath())]) status = IStatusMessage(self.request) # lets replace the message from folder_publish by ours. status.show() self.request.cookies[STATUSMESSAGEKEY] = None self.request.response.expireCookie(STATUSMESSAGEKEY, path='/') annotations = IAnnotations(self.request) annotations[STATUSMESSAGEKEY] = None status.add(_(u"Item and it's content has been deleted")) # avoid getting the context itself if it's a group group = get_group(aq_inner(self.context).__parent__) if group is None: url = getToolByName(self.context, 'portal_url')() else: url = group.absolute_url() self.request.response.redirect(url)
def _doDelete(self): wf = self.context.restrictedTraverse('folder_publish') ##parameters=workflow_action=None, paths=[], comment='No comment', ##expiration_date=None, effective_date=None, include_children=False wf(workflow_action="delete", comment="RCSE Delete action", include_children=True, paths=['/'.join(self.context.getPhysicalPath())]) status = IStatusMessage(self.request) # lets replace the message from folder_publish by ours. status.show() self.request.cookies[STATUSMESSAGEKEY] = None self.request.response.expireCookie(STATUSMESSAGEKEY, path='/') annotations = IAnnotations(self.request) annotations[STATUSMESSAGEKEY] = None status.add(_(u"Item and it's content has been deleted")) # avoid getting the context itself if it's a group group = get_group(aq_inner(self.context).__parent__) if group is None: url = getToolByName(self.context, 'portal_url')() else: url = group.absolute_url() self.request.response.redirect(url)