# -*- coding: utf-8 # Copyright 2005 by Vahur Rebas __doc__ = """Progress Interview module""" __version__ = "0.1b" from Globals import package_home from Products.Archetypes.public import process_types, listTypes from Products.CMFCore import utils from Products.CMFCore.DirectoryView import registerDirectory from config import PROJECT_NAME, SKINS_DIR, GLOBALS import ProgressFolder import ProgressClassFolder import ProgressUserFolder import Phases registerDirectory(SKINS_DIR, GLOBALS) def initialize(context): """ initialize """ content_types, constructors, ftis = process_types(listTypes(PROJECT_NAME), PROJECT_NAME) pr_f_Index = getTypeIndex(content_types, 'ProgressFolder') pr_c_Index = getTypeIndex(content_types, 'ProgressClassFolder') pr_u_Index = getTypeIndex(content_types, 'ProgressUserFolder') # Phases ph_i_Index = getTypeIndex(content_types, 'PhaseI') ph_ii_Index = getTypeIndex(content_types, 'PhaseII') ph_iii_Index = getTypeIndex(content_types, 'PhaseIII') ph_iv_Index = getTypeIndex(content_types, 'PhaseIV') ph_v_Index = getTypeIndex(content_types, 'PhaseV') ph_vi_Index = getTypeIndex(content_types, 'PhaseVI') print ph_i_Index, ph_ii_Index, ph_iii_Index, ph_iv_Index, ph_v_Index, ph_vi_Index pr_f_constructor = [] pr_f_constructor.append(constructors[pr_f_Index]) pr_f_type = [] pr_f_type.append(content_types[pr_f_Index]) pr_c_constructor = [] pr_c_constructor.append(constructors[pr_c_Index]) pr_c_type = [] pr_c_type.append(content_types[pr_c_Index]) pr_u_constructor = [] pr_u_constructor.append(constructors[pr_u_Index]) pr_u_type = [] pr_u_type.append(content_types[pr_u_Index]) # Phases ph_i_constructor = [] ph_i_constructor.append(constructors[ph_i_Index]) ph_i_type = [] ph_i_type.append(content_types[ph_i_Index]) ph_ii_constructor = [] ph_ii_constructor.append(constructors[ph_ii_Index]) ph_ii_type = [] ph_ii_type.append(content_types[ph_ii_Index]) ph_iii_constructor = [] ph_iii_constructor.append(constructors[ph_iii_Index]) ph_iii_type = [] ph_iii_type.append(content_types[ph_iii_Index]) ph_iv_constructor = [] ph_iv_constructor.append(constructors[ph_iv_Index]) ph_iv_type = [] ph_iv_type.append(content_types[ph_iv_Index]) ph_v_constructor = [] ph_v_constructor.append(constructors[ph_v_Index]) ph_v_type = [] ph_v_type.append(content_types[ph_v_Index]) ph_vi_constructor = [] ph_vi_constructor.append(constructors[ph_vi_Index]) ph_vi_type = [] ph_vi_type.append(content_types[ph_vi_Index]) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(pr_f_type), permission = 'Edit', extra_constructors = tuple(pr_f_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(pr_c_type), permission = 'Edit', extra_constructors = tuple(pr_c_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(pr_u_type), permission = 'Edit', extra_constructors = tuple(pr_u_constructor), fti = ftis, ).initialize(context) #Phases utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(ph_i_type), permission = 'Edit', extra_constructors = tuple(ph_i_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(ph_ii_type), permission = 'Edit', extra_constructors = tuple(ph_ii_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(ph_iii_type), permission = 'Edit', extra_constructors = tuple(ph_iii_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(ph_iv_type), permission = 'Edit', extra_constructors = tuple(ph_iv_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(ph_v_type), permission = 'Edit', extra_constructors = tuple(ph_v_constructor), fti = ftis, ).initialize(context) utils.ContentInit( PROJECT_NAME + ' Content', content_types = tuple(ph_vi_type), permission = 'Edit', extra_constructors = tuple(ph_vi_constructor), fti = ftis, ).initialize(context) def getTypeIndex(content_types, meta_type): for i in range(len(content_types)): if content_types[i].meta_type==meta_type: return i