def edit(self, **kwargs):
     """ See IFacetedCriteriaHandler
     """
     criteria = ICriteria(self.context)
     handler = getMultiAdapter((self.context, self.request),
                               name=u'faceted_update_criterion')
     for cid in criteria.keys():
         properties = {}
         for key, value in kwargs.items():
             if not key.startswith(cid):
                 continue
             key = key[len(cid) + 1:]
             properties[key] = value
         handler.edit(cid, **properties)
     return self._redirect('Changes saved', to=self.redirect)
Ejemplo n.º 2
0
 def edit(self, **kwargs):
     """ See IFacetedCriteriaHandler
     """
     criteria = ICriteria(self.context)
     handler = getMultiAdapter((self.context, self.request),
                               name=u'faceted_update_criterion')
     for cid in criteria.keys():
         properties = {}
         for key, value in kwargs.items():
             if not key.startswith(cid):
                 continue
             key = key[len(cid) + 1:]
             properties[key] = value
         handler.edit(cid, **properties)
     return self._redirect('Changes saved', to=self.redirect)
Ejemplo n.º 3
0
def setFacetedNavigation(folder, request, force=False):
    subtyper = getMultiAdapter((folder, request), name=u'faceted_subtyper')
    if (subtyper.is_faceted or not subtyper.can_enable) and not force: return
    subtyper.enable()
    urlTool = plone.api.portal.get_tool(name='portal_url')
    path = '/' + '/'.join(urlTool.getRelativeContentPath(folder))
    criteria = ICriteria(folder)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add(
        'checkbox', 'left', 'default',
        title=u'Organ',
        hidden=False,
        index='indicatedBodySystems',
        operator='or',
        vocabulary=u'eke.biomarker.IndicatedOrgansVocabulary',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5, default=20)
    criteria.add('sorting', 'bottom', 'default', title='Sort on', hidden=True, default='sortable_title')
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[IBiomarker.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add('path', 'bottom', 'default', title='Path Search', hidden=True, index='path', default=path)
    criteria.add('text', 'top', 'default', title=u'Search', hidden=False, index='SearchableText', count=False,
        onlyallelements=True)
    IFacetedLayout(folder).update_layout('faceted_biomarkers_view')
    noLongerProvides(folder, IHidePloneLeftColumn)
    noLongerProvides(folder, IHidePloneRightColumn)
Ejemplo n.º 4
0
def installFacetedNavigation(obj, event):
    if not ISecretomeFolder.providedBy(obj): return
    factory = getToolByName(obj, 'portal_factory')
    if factory.isTemporary(obj): return
    request = obj.REQUEST
    subtyper = getMultiAdapter((obj, request), name=u'faceted_subtyper')
    if subtyper.is_faceted or not subtyper.can_enable: return
    subtyper.enable()
    criteria = ICriteria(obj)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5,
        default=20)
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[IGeneProtein.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add('debug', 'top', 'default', title='Debug Criteria', user='******')
    criteria.add(
        'checkbox', 'left', 'default',
        title=u'Databases',
        hidden=False,
        index='databaseNames',
        operator='or',
        vocabulary=u'eke.secretome.DatabaseNamesVocabulary',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    IFacetedLayout(obj).update_layout(u'faceted_secretome_view')
    noLongerProvides(obj, IHidePloneLeftColumn)
Ejemplo n.º 5
0
def createMembersListSearchPage(portal):
    '''Create the members list page'''
    # New in profile version 1 (software version 1.0.2):
    request = portal.REQUEST
    if 'members-list' in portal.objectIds():
        portal.manage_delObjects('members-list')
    membersList = portal[portal.invokeFactory('Folder', 'members-list')]
    membersList.setTitle('Members List')
    membersList.setDescription('A directory of the people that comprise EDRN.')
    membersList.setExcludeFromNav(True)
    _doPublish(membersList, getToolByName(portal, 'portal_workflow'))
    subtyper = getMultiAdapter((membersList, request), name=u'faceted_subtyper')
    subtyper.enable()
    layout = IFacetedLayout(membersList)
    layout.update_layout('folder_listing')
    criteria = ICriteria(membersList)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5, default=20)
    criteria.add('sorting', 'bottom', 'default', title='Sort on', hidden=True, default='sortable_title')
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[IPerson.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Investigator',
        hidden=False,
        index='piUID',
        operator='or',
        vocabulary=u'eke.site.PrincipalInvestigators',
        count=False,
        maxitems=4,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Type',
        index='investigatorStatus',
        operator='or',
        vocabulary=u'eke.site.NotPeons',
        count=True,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Institution',
        hidden=False,
        index='siteName',
        operator='or',
        vocabulary=u'eke.site.SitesNames',
        count=True,
        maxitems=4,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Member Type',
        hidden=False,
        index='memberType',
        operator='or',
        vocabulary=u'eke.site.MemberType',
        count=True,
        maxitems=20,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add('criteria', 'top', 'default', title='Current Search')
    membersList.reindexObject()
Ejemplo n.º 6
0
def setFacetedNavigation(folder, request):
    subtyper = getMultiAdapter((folder, request), name=u'faceted_subtyper')
    if subtyper.is_faceted or not subtyper.can_enable: return
    subtyper.enable()
    urlTool = getToolByName(folder, 'portal_url')
    path = '/' + '/'.join(urlTool.getRelativeContentPath(folder))
    criteria = ICriteria(folder)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage', 'bottom', 'default', title='Results per page', hidden=True, start=0, end=50, step=5, default=20)
    criteria.add('sorting', 'bottom', 'default', title='Sort on', hidden=True, default='sortable_title')
    criteria.add(
        'checkbox', 'left', 'default',
        title='System',
        hidden=False,
        index='getSystemName',
        operator='or',
        vocabulary=u'eke.specimens.vocab.SystemNames',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Diagnosis',
        hidden=False,
        index='diagnosis',
        operator='or',
        vocabulary=u'eke.specimens.vocab.Diagnoses',
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Storage',
        hidden=False,
        index='getStorageType',
        operator='or',
        vocabulary=STORAGE_VOCAB_NAME,
        count=False,
        maxitems=5,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Collection Type',
        hidden=False,
        index='collectionType',
        operator='or',
        vocabulary=COLLECTION_VOCAB_NAME,
        count=False,
        maxitems=5,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'left', 'default',
        title='Site',
        hidden=False,
        index='siteName',
        operator='or',
        vocabulary=u'eke.specimens.vocab.SitesWithSpecimens',
        count=False,
        maxitems=5,
        sortreversed=False,
        hidezerocount=False,
    )
    criteria.add(
        'checkbox', 'bottom', 'default',
        title='Obj provides',
        hidden=True,
        index='object_provides',
        operator='or',
        vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
        default=[ISpecimenSet.__identifier__],
        count=False,
        maxitems=0,
        sortreversed=False,
        hidezerocount=False
    )
    criteria.add(
        'text', 'center', 'default',
        title='Open Search',
        hidden=False,
        index='SearchableText',
    )
    criteria.add('path', 'bottom', 'default', title='Path Search', hidden=True, index='path', default=path)
    IFacetedLayout(folder).update_layout('faceted_specimens_view')
    alsoProvides(folder, IHidePloneRightColumn)
Ejemplo n.º 7
0
def createMembersListSearchPage(portal):
    '''Create the members list page'''
    # New in profile version 1 (software version 1.0.2):
    request = portal.REQUEST
    if 'members-list' in portal.objectIds():
        portal.manage_delObjects('members-list')
    membersList = portal[portal.invokeFactory('Folder', 'members-list')]
    membersList.setTitle('Members List')
    membersList.setDescription('A directory of the people that comprise EDRN.')
    membersList.setExcludeFromNav(True)
    _doPublish(membersList, getToolByName(portal, 'portal_workflow'))
    subtyper = getMultiAdapter((membersList, request),
                               name=u'faceted_subtyper')
    subtyper.enable()
    layout = IFacetedLayout(membersList)
    layout.update_layout('folder_listing')
    criteria = ICriteria(membersList)
    for cid in criteria.keys():
        criteria.delete(cid)
    criteria.add('resultsperpage',
                 'bottom',
                 'default',
                 title='Results per page',
                 hidden=True,
                 start=0,
                 end=50,
                 step=5,
                 default=20)
    criteria.add('sorting',
                 'bottom',
                 'default',
                 title='Sort on',
                 hidden=True,
                 default='sortable_title')
    criteria.add('checkbox',
                 'bottom',
                 'default',
                 title='Obj provides',
                 hidden=True,
                 index='object_provides',
                 operator='or',
                 vocabulary=u'eea.faceted.vocabularies.ObjectProvides',
                 default=[IPerson.__identifier__],
                 count=False,
                 maxitems=0,
                 sortreversed=False,
                 hidezerocount=False)
    criteria.add('checkbox',
                 'left',
                 'default',
                 title='Investigator',
                 hidden=False,
                 index='piUID',
                 operator='or',
                 vocabulary=u'eke.site.PrincipalInvestigators',
                 count=False,
                 maxitems=4,
                 sortreversed=False,
                 hidezerocount=False)
    criteria.add('checkbox',
                 'left',
                 'default',
                 title='Type',
                 index='investigatorStatus',
                 operator='or',
                 vocabulary=u'eke.site.NotPeons',
                 count=True,
                 maxitems=0,
                 sortreversed=False,
                 hidezerocount=False)
    criteria.add('checkbox',
                 'left',
                 'default',
                 title='Institution',
                 hidden=False,
                 index='siteName',
                 operator='or',
                 vocabulary=u'eke.site.SitesNames',
                 count=True,
                 maxitems=4,
                 sortreversed=False,
                 hidezerocount=False)
    criteria.add('checkbox',
                 'left',
                 'default',
                 title='Member Type',
                 hidden=False,
                 index='memberType',
                 operator='or',
                 vocabulary=u'eke.site.MemberType',
                 count=True,
                 maxitems=20,
                 sortreversed=False,
                 hidezerocount=False)
    criteria.add('criteria', 'top', 'default', title='Current Search')
    membersList.reindexObject()