Пример #1
0
    def createClosedProject(self, proj_id):
        proj_folder = self.portal.projects
        from opencore.interfaces.adding import IAddProject
        IAddProject.providedBy(proj_folder)

        proj = proj_folder.restrictedTraverse(
          'portal_factory/OpenProject/%s' % proj_id)
        proj_folder.portal_factory.doCreate(proj, proj_id)
        closed_proj = proj_folder._getOb(proj_id)

        # now make it closed
        wft = getToolByName(self.portal, 'portal_workflow')
        wfid = 'openplans_teamspace_workflow'
        status = wft.getStatusOf(wfid, closed_proj)
        status['review_state'] = 'closed'
        wft.setStatusOf(wfid, closed_proj, status)

        # and reindex for good measure
        closed_proj.reindexObject()

        return closed_proj
Пример #2
0
def if_projects_selected(viewlet):
    """if we don't check that the viewed url ends with create, then the
       projects folder will be displayed as well (also in projects folder)"""
    return (IAddProject.providedBy(viewlet.context) and
            not url_ends_with(viewlet.context.request.getURL(),
                              '/create'))