source: publico/ILPortalCasas/trunk/Extensions/AppInstall.py @ 979

Última Alteração nesse arquivo desde 979 foi 979, incluída por rafahelabazzanella, 14 anos atrás

Instalacao seta tarefa para pack

File size: 30.4 KB
Linha 
1from Products.CMFCore.utils import getToolByName
2from Products.CMFPlone.utils import _createObjectByType
3from Acquisition import aq_base
4from Products.PloneMaintenance.MaintenanceTask import addMaintenanceTask
5
6INDEX_HTML = '''<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
7      lang="en"
8      metal:use-macro="here/main_template/macros/master"
9      i18n:domain="plone">
10<body>
11<div metal:fill-slot="main">
12  <br />
13
14  <div metal:use-macro="here/portlet_noticia_destaque/macros/portlet" /><br />
15  <div metal:use-macro="here/portlet_noticias/macros/portlet" /><br />
16
17</div>
18</body>
19</html>
20'''
21
22SAAP = '''<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
23      lang="en"
24      i18n:domain="plone">
25<script language="JavaScript1.2">
26    function poponload() {
27        openwindow = window.open("http://saapdemo.interlegis.gov.br/saap/index_saap_html", "saap", "location=0, status=1, scrollbars=0, width=750, height=600");
28        openwindow.moveTo(200,200);
29    }
30</script>
31<body onload="javascript: poponload()">
32    <p>Sera aberta uma janela com o sistema. Se esta nao for aberta, clique <a href="javascript:poponload()">aqui</a>.</p>
33    <p>Se vc clicar no link acima e nao for aberta a janela, va no menu do seu browser e desabilite a opcao "Bloquear janelas popup".</p>
34
35</body>
36</html>
37
38'''
39
40def install(self):
41    portal = self
42    replaceIndex(portal)
43    deletePastas(portal)
44    addHistoria(portal)
45    addCamara(portal)
46    addAgenda(portal)
47    addProcessos(portal)
48    addLeis(portal)
49    addLicitacoes(portal)
50    addContabilidade(portal)
51    addUtilidades(portal)
52    addImagens(portal)
53    addEnquetes(portal)
54    addNewsletters(portal)
55    addForuns(portal)
56    addNoticia(portal)
57    addEvento(portal)
58#    addOuvidoria(portal)
59    addWebmail(portal)
60    addSaap(portal)
61    addSaal(portal)
62    setupPortal(portal)
63    setupSlots(portal)
64    deleteAction(portal)
65    deleteAction2(portal)
66    deleteAction3(portal)
67    deleteAction4(portal)
68    deleteCategoria(portal)
69    setupActions(portal)
70    setupCssmanager(portal)
71    setupGroups(portal)
72    setupMaintenance(portal)
73    setupMemberdata(portal)
74    setupMembership(portal)
75    setupMetadata(portal)
76    setupPortalCss(portal)
77    setupWorkflow(portal)
78    setupProperties(portal)
79    setupPublicatorUtilidades(portal)
80    setupPublicatorPrevisao(portal)
81    setupPublicatorDestaque(portal)
82    setupPublicatorNoticia(portal)
83    setupPublicatorBanner(portal)
84    setupSin(portal)
85    setupSkin(portal)
86    setupTipo(portal)
87
88def replaceIndex(portal):
89    portal.manage_delObjects('front-page')
90    portal.manage_addProduct['PageTemplates'].manage_addPageTemplate('index_html', '', INDEX_HTML)
91
92def deletePastas(portal):
93    portal.manage_delObjects('news')
94    portal.manage_delObjects('events')
95
96def addHistoria(portal):
97    portal.invokeFactory('Folder', id='historia', title='História')
98    hist = getattr(aq_base(portal), 'historia')
99    addable_types = ['Folder','File','Link','Document','DisplayPage']
100    if getattr(hist.aq_base, 'setConstrainTypesMode', None) is not None:
101        hist.setConstrainTypesMode(1)
102        hist.setImmediatelyAddableTypes(addable_types)
103        hist.setLocallyAllowedTypes(addable_types)
104
105    portal_workflow = getToolByName(portal, 'portal_workflow')
106    historia = getattr(portal, 'historia', None)
107    if historia is not None:
108        portal_workflow.doActionFor(historia, 'publish')
109    historia.invokeFactory('Folder', id='historia-camara', title='História da Câmara')
110    historia_camara = getattr(historia, 'historia-camara', None)
111    if historia_camara is not None:
112        portal_workflow.doActionFor(historia_camara, 'publish')
113    historia.invokeFactory('Folder', id='historia-cidade', title='História da Cidade')
114    historia_cidade = getattr(historia, 'historia-cidade', None)
115    if historia_cidade is not None:
116        portal_workflow.doActionFor(historia_cidade, 'publish')
117
118def addCamara(portal):
119    portal.invokeFactory('Folder', id='camara', title='A Câmara')
120    cam = getattr(aq_base(portal), 'camara')
121    addable_types = ['Folder','File','Link','Document','DisplayPage']
122    if getattr(cam.aq_base, 'setConstrainTypesMode', None) is not None:
123        cam.setConstrainTypesMode(1)
124        cam.setImmediatelyAddableTypes(addable_types)
125        cam.setLocallyAllowedTypes(addable_types)
126
127    portal_workflow = getToolByName(portal, 'portal_workflow')
128    camara = getattr(portal, 'camara', None)
129    if camara is not None:
130        portal_workflow.doActionFor(camara, 'publish')
131    camara.invokeFactory('Folder', id='funcao', title='Função e Definição')
132    funcao = getattr(camara, 'funcao', None)
133    if funcao is not None:
134        portal_workflow.doActionFor(funcao, 'publish')
135    camara.invokeFactory('Folder', id='departamentos', title='Departamentos')
136    departamentos = getattr(camara, 'departamentos', None)
137    if departamentos is not None:
138        portal_workflow.doActionFor(departamentos, 'publish')
139    camara.invokeFactory('Folder', id='vereadores', title='Vereadores')
140    vereadores = getattr(camara, 'vereadores', None)
141    if vereadores is not None:
142        portal_workflow.doActionFor(vereadores, 'publish')
143    vereadores.invokeFactory('Folder', id='informacoes', title='Vereadores')
144    informacoes = getattr(vereadores, 'informacoes', None)
145    if informacoes is not None:
146        portal_workflow.doActionFor(informacoes, 'publish')
147    vereadores.invokeFactory('Folder', id='ex-vereadores', title='Ex-Vereadores')
148    ex_vereadores = getattr(vereadores, 'ex-vereadores', None)
149    if ex_vereadores is not None:
150        portal_workflow.doActionFor(ex_vereadores, 'publish')
151    vereadores.invokeFactory('Folder', id='discursos', title='Discursos')
152    discursos = getattr(vereadores, 'discursos', None)
153    if discursos is not None:
154        portal_workflow.doActionFor(discursos, 'publish')
155    vereadores.invokeFactory('Folder', id='fale-vereador', title='Fale com o Vereador')
156    fale_vereador = getattr(vereadores, 'fale-vereador', None)
157    if fale_vereador is not None:
158        portal_workflow.doActionFor(fale_vereador, 'publish')
159    camara.invokeFactory('Folder', id='comissoes', title='Comissões')
160    comissoes = getattr(camara, 'comissoes', None)
161    if comissoes is not None:
162        portal_workflow.doActionFor(comissoes, 'publish')
163    camara.invokeFactory('Folder', id='mesa-diretora', title='Mesa Diretora')
164    mesa_diretora = getattr(camara, 'mesa-diretora', None)
165    if mesa_diretora is not None:
166        portal_workflow.doActionFor(mesa_diretora, 'publish')
167
168def addAgenda(portal):
169    portal.invokeFactory('CalendarX', id='agenda', title='Agenda')
170    agenda = getattr(portal, 'agenda', None)
171    agenda.manage_addProperty('right_slots', [''], 'lines')
172
173def addProcessos(portal):
174    portal.invokeFactory('Folder', id='processos-legislativos', title='Processos Legislativos')
175    proc = getattr(aq_base(portal), 'historia')
176    addable_types = ['Folder','File','Link','Document','DisplayPage']
177    if getattr(proc.aq_base, 'setConstrainTypesMode', None) is not None:
178        proc.setConstrainTypesMode(1)
179        proc.setImmediatelyAddableTypes(addable_types)
180        proc.setLocallyAllowedTypes(addable_types)
181
182    portal_workflow = getToolByName(portal, 'portal_workflow')
183    processos = getattr(portal, 'processos-legislativos', None)
184    if processos is not None:
185        portal_workflow.doActionFor(processos, 'publish')
186    processos.invokeFactory('Folder', id='ordem-dia', title='Ordem do Dia')
187    ordem = getattr(processos, 'ordem-dia', None)
188    if ordem is not None:
189        portal_workflow.doActionFor(ordem, 'publish')
190    processos.invokeFactory('Folder', id='sessoes', title='Sessões')
191    sessoes = getattr(processos, 'sessoes', None)
192    if sessoes is not None:
193        portal_workflow.doActionFor(sessoes, 'publish')
194    sessoes.invokeFactory('Folder', id='sessoes-online', title='Sessões On-line')
195    sessoes_online = getattr(sessoes, 'sessoes-online', None)
196    if sessoes_online is not None:
197        portal_workflow.doActionFor(sessoes_online, 'publish')
198    processos.invokeFactory('Folder', id='atas', title='Atas')
199    atas = getattr(processos, 'atas', None)
200    if atas is not None:
201        portal_workflow.doActionFor(atas, 'publish')
202
203def addLeis(portal):
204    portal.invokeFactory('Folder', id='leis', title='Leis')
205    lei = getattr(aq_base(portal), 'leis')
206    addable_types = ['Folder','File','Link','Document','DisplayPage']
207    if getattr(lei.aq_base, 'setConstrainTypesMode', None) is not None:
208        lei.setConstrainTypesMode(1)
209        lei.setImmediatelyAddableTypes(addable_types)
210        lei.setLocallyAllowedTypes(addable_types)
211
212    portal_workflow = getToolByName(portal, 'portal_workflow')
213    leis = getattr(portal, 'leis', None)
214    if leis is not None:
215        portal_workflow.doActionFor(leis, 'publish')
216    leis.invokeFactory('Folder', id='legislacao-municipal', title='Legislação Municipal')
217    legislacao_municipal = getattr(leis, 'legislacao-municipal', None)
218    if legislacao_municipal is not None:
219        portal_workflow.doActionFor(legislacao_municipal, 'publish')
220    leis.invokeFactory('Folder', id='leis-federais', title='Leis Federais')
221    leis_federais = getattr(leis, 'leis-federais', None)
222    if leis_federais is not None:
223        portal_workflow.doActionFor(leis_federais, 'publish')
224    leis.invokeFactory('Folder', id='leis-estaduais', title='Leis Estaduais')
225    leis_estaduais = getattr(leis, 'leis-estaduais', None)
226    if leis_estaduais is not None:
227        portal_workflow.doActionFor(leis_estaduais, 'publish')
228    leis.invokeFactory('Folder', id='projetos-lei', title='Projetos de Lei')
229    projetos_lei = getattr(leis, 'projetos-lei', None)
230    if projetos_lei is not None:
231        portal_workflow.doActionFor(projetos_lei, 'publish')
232    projetos = getattr(leis, 'projetos-lei', None)
233    projetos.invokeFactory('Folder', id='estatisticas-proposicoes', title='Estatísticas de Proposições')
234    estatisticas_proposicoes = getattr(projetos, 'estatisticas-proposicoes', None)
235    if estatisticas_proposicoes is not None:
236        portal_workflow.doActionFor(estatisticas_proposicoes, 'publish')
237    leis.invokeFactory('Folder', id='legislacao', title='Legislação')
238    legislacao = getattr(leis, 'legislacao', None)
239    if legislacao is not None:
240        portal_workflow.doActionFor(legislacao, 'publish')
241
242def addLicitacoes(portal):
243    portal.invokeFactory('Folder', id='licitacoes', title='Licitações')
244    lic = getattr(aq_base(portal), 'licitacoes')
245    addable_types = ['Folder','File','Link','Document','DisplayPage']
246    if getattr(lic.aq_base, 'setConstrainTypesMode', None) is not None:
247        lic.setConstrainTypesMode(1)
248        lic.setImmediatelyAddableTypes(addable_types)
249        lic.setLocallyAllowedTypes(addable_types)
250
251    portal_workflow = getToolByName(portal, 'portal_workflow')
252    licitacoes = getattr(portal, 'licitacoes', None)
253    if licitacoes is not None:
254        portal_workflow.doActionFor(licitacoes, 'publish')
255    licitacoes.invokeFactory('Folder', id='editais', title='Editais')
256    editais = getattr(licitacoes, 'editais', None)
257    if editais is not None:
258        portal_workflow.doActionFor(editais, 'publish')
259    licitacoes.invokeFactory('Folder', id='concursos', title='Concursos')
260    concursos = getattr(licitacoes, 'concursos', None)
261    if concursos is not None:
262        portal_workflow.doActionFor(concursos, 'publish')
263    licitacoes.invokeFactory('Folder', id='pregao', title='Pregão')
264    pregao = getattr(licitacoes, 'pregao', None)
265    if pregao is not None:
266        portal_workflow.doActionFor(pregao, 'publish')
267    licitacoes.invokeFactory('Folder', id='tomada-preco', title='Tomada de Preço')
268    tomada_preco = getattr(licitacoes, 'tomada-preco', None)
269    if tomada_preco is not None:
270        portal_workflow.doActionFor(tomada_preco, 'publish')
271    licitacoes.invokeFactory('Folder', id='convite', title='Convite')
272    convite = getattr(licitacoes, 'convite', None)
273    if convite is not None:
274        portal_workflow.doActionFor(convite, 'publish')
275
276def addContabilidade(portal):
277    portal.invokeFactory('Folder', id='contabilidade', title='Contabilidade')
278    cont = getattr(aq_base(portal), 'contabilidade')
279    addable_types = ['Folder','File','Link','Document','DisplayPage']
280    if getattr(cont.aq_base, 'setConstrainTypesMode', None) is not None:
281        cont.setConstrainTypesMode(1)
282        cont.setImmediatelyAddableTypes(addable_types)
283        cont.setLocallyAllowedTypes(addable_types)
284
285    portal_workflow = getToolByName(portal, 'portal_workflow')
286    contabilidade = getattr(portal, 'contabilidade', None)
287    if contabilidade is not None:
288        portal_workflow.doActionFor(contabilidade, 'publish')
289
290def addUtilidades(portal):
291    portal.invokeFactory('Folder', id='utilidades', title='Utilidades', excludeFromNav=1)
292    utd = getattr(aq_base(portal), 'utilidades')
293    addable_types = ['Folder','File','Link','Document','DisplayPage']
294    if getattr(utd.aq_base, 'setConstrainTypesMode', None) is not None:
295        utd.setConstrainTypesMode(1)
296        utd.setImmediatelyAddableTypes(addable_types)
297        utd.setLocallyAllowedTypes(addable_types)
298
299    link = getattr(portal, 'utilidades', None)
300    link.invokeFactory('Link', id='interlegis', title='Programa Interlegis', remoteUrl='http://www.interlegis.gov.br')
301    link.invokeFactory('Link', id='senado', title='Senado Federal', remoteUrl='http://www.senado.gov.br')
302    link.invokeFactory('Link', id='camara', title='Câmara dos Deputados', remoteUrl='http://www.camara.gov.br')
303    portal_workflow = getToolByName(portal, 'portal_workflow')
304    interlegis = getattr(link, 'interlegis', None)
305    if interlegis is not None:
306        portal_workflow.doActionFor(interlegis, 'publish')
307    senado = getattr(link, 'senado', None)
308    if senado is not None:
309        portal_workflow.doActionFor(senado, 'publish')
310    camara = getattr(link, 'camara', None)
311    if camara is not None:
312        portal_workflow.doActionFor(camara, 'publish')
313
314def addImagens(portal):
315    portal.invokeFactory('Folder', id='imagens', title='Imagens', excludeFromNav=1)
316    portal_workflow = getToolByName(portal, 'portal_workflow')
317    imagem = getattr(aq_base(portal), 'imagens')
318    addable_types = ['Image','Folder','Link']
319    if getattr(imagem.aq_base, 'setConstrainTypesMode', None) is not None:
320        imagem.setConstrainTypesMode(1)
321        imagem.setImmediatelyAddableTypes(addable_types)
322        imagem.setLocallyAllowedTypes(addable_types)
323
324    imagens = getattr(portal, 'imagens', None)
325    imagens.invokeFactory('Folder', id='inoticias', title='Notícias')
326    imagens.invokeFactory('Folder', id='banners', title='Banners')
327    imgban = getattr(imagens, 'banners', None)
328
329    imgban.invokeFactory('Image', id='banner_interlegis.jpg', title='Banner Interlegis')
330    newImage = getattr(imgban, 'banner_interlegis.jpg')
331    newImage.edit(file=file(INSTANCE_HOME+'/Products/ILPortalCasas/Extensions/banner_interlegis.jpg').read())
332
333    imgban.invokeFactory('Image', id='banner_senado.jpg', title='Banner Senado')
334    newImage = getattr(imgban, 'banner_senado.jpg')
335    newImage.edit(file=file(INSTANCE_HOME+'/Products/ILPortalCasas/Extensions/banner_senado.jpg').read())
336
337    imgban.invokeFactory('Image', id='banner_camara.jpg', title='Banner Câmara')
338    newImage = getattr(imgban, 'banner_camara.jpg')
339    newImage.edit(file=file(INSTANCE_HOME+'/Products/ILPortalCasas/Extensions/banner_camara.jpg').read())
340
341def addEnquetes(portal):
342    portal.invokeFactory('Folder', id='enquetes', title='Enquetes', excludeFromNav=1)
343
344    enquete = getattr(aq_base(portal), 'enquetes')
345    addable_types = ['PlonePopoll']
346    if getattr(enquete.aq_base, 'setConstrainTypesMode', None) is not None:
347        enquete.setConstrainTypesMode(1)
348        enquete.setImmediatelyAddableTypes(addable_types)
349        enquete.setLocallyAllowedTypes(addable_types)
350
351def addNewsletters(portal):
352    portal.invokeFactory('Folder', id='newsletters', title='Newsletters', excludeFromNav=1)
353
354    newsletters = getattr(aq_base(portal), 'newsletters')
355    addable_types = ['Subscriber','NewsletterTheme']
356    if getattr(newsletters.aq_base, 'setConstrainTypesMode', None) is not None:
357        newsletters.setConstrainTypesMode(1)
358        newsletters.setImmediatelyAddableTypes(addable_types)
359        newsletters.setLocallyAllowedTypes(addable_types)
360
361def addForuns(portal):
362    portal.invokeFactory('Ploneboard', id='foruns', title='Fóruns')
363    portal_workflow = getToolByName(portal, 'portal_workflow')
364    foruns = getattr(portal, 'foruns', None)
365    if foruns is not None:
366        portal_workflow.doActionFor(foruns, 'publish')
367
368def addNoticia(portal):
369    if 'news' not in portal.objectIds():
370        _createObjectByType('Large Plone Folder', portal, id='noticias',
371                            title='Notícias', description='Notícias', excludeFromNav=1)
372    news = getattr(aq_base(portal), 'noticias')
373
374    addable_types = ['News Item']
375    if getattr(news.aq_base, 'setConstrainTypesMode', None) is not None:
376        news.setConstrainTypesMode(1)
377        news.setImmediatelyAddableTypes(addable_types)
378        news.setLocallyAllowedTypes(addable_types)
379
380    try:
381        news.manage_addProperty('default_page', ['news_topic','news_listing','index_html'], 'lines')
382    except BadRequest:
383        pass
384
385def addEvento(portal):
386    if 'events' not in portal.objectIds():
387        _createObjectByType('Large Plone Folder', portal, id='eventos',
388                            title='Eventos', description='Eventos', excludeFromNav=1)
389    events = getattr(aq_base(portal), 'eventos')
390
391    addable_types = ['Event']
392    if getattr(events.aq_base, 'setConstrainTypesMode', None) is not None:
393        events.setConstrainTypesMode(1)
394        events.setImmediatelyAddableTypes(addable_types)
395        events.setLocallyAllowedTypes(addable_types)
396
397    try:
398        events.manage_addProperty('default_page', ['events_topic','events_listing','index_html'], 'lines')
399    except BadRequest:
400        pass
401
402#def addOuvidoria(portal):
403#    portal.invokeFactory('OmbudsmanFolder', id='ouvidoria', title='Ouvidoria', excludeFromNav=1)
404
405def addWebmail(portal):
406    portal.invokeFactory('Folder', id='webmail', title='Webmail', excludeFromNav=1)
407    portal_workflow = getToolByName(portal, 'portal_workflow')
408    webmail = getattr(portal, 'webmail', None)
409    if webmail is not None:
410        portal_workflow.doActionFor(webmail, 'publish')
411
412def addSaap(portal):
413    portal.invokeFactory('Folder', id='saap', title='SAAP', excludeFromNav=1)
414    saap = getattr(portal, 'saap', None)
415    saap.manage_addProduct['PageTemplates'].manage_addPageTemplate('index_html', '', SAAP)
416
417def addSaal(portal):
418    portal.invokeFactory('Folder', id='saal', title='SAAL', excludeFromNav=1)
419
420def setupPortal(portal):
421    portal.manage_changeProperties(title='Portal das Casas Legislativas',
422                                   email_from_address='admin-stc@interlegis.gov.br',
423                                   email_from_name= 'Administrador')
424
425def setupSlots(portal):
426    left_slots =  ('here/portlet_navigation/macros/portlet', \
427                   'here/portlet_preferencias/macros/portlet', \
428                   'here/portlet_gazette/macros/portlet', \
429                   'here/sin_tool/macros/Zope-PT', \
430                   'here/portlet_recent/macros/portlet',)
431    portal._setPropValue('left_slots', left_slots)
432    right_slots = ('here/portlet_calendar/macros/portlet', \
433                   'here/popoll_slot2/macros/popollBox', \
434                   'here/portlet_review/macros/portlet', \
435                   'here/portlet_utilidades/macros/portlet', \
436                   'here/portlet_previsao/macros/portlet',)
437    portal._setPropValue('right_slots', right_slots)
438
439def deleteAction(portal):
440    portal_actions = getToolByName(portal, 'portal_actions')
441    idx = 0
442    for action in portal_actions.listActions():
443        if action.getId() == 'index_html':
444            portal_actions.deleteActions((idx,))
445            break
446        idx += 1
447
448def deleteAction2(portal):
449    portal_actions = getToolByName(portal, 'portal_actions')
450    idx = 0
451    for action in portal_actions.listActions():
452        if action.getId() == 'sitemap':
453            portal_actions.deleteActions((idx,))
454            break
455        idx += 1
456
457def deleteAction3(portal):
458    portal_actions = getToolByName(portal, 'portal_actions')
459    idx = 0
460    for action in portal_actions.listActions():
461        if action.getId() == 'contact':
462            portal_actions.deleteActions((idx,))
463            break
464        idx += 1
465
466def deleteAction4(portal):
467    portal_actions = getToolByName(portal, 'portal_actions')
468    idx = 0
469    for action in portal_actions.listActions():
470        if action.getId() == 'plone_setup':
471            portal_actions.deleteActions((idx,))
472            break
473        idx += 1
474
475def deleteCategoria(portal):
476    portal_actions = getToolByName(portal, 'portal_actions')
477    idx = 0
478    for actions in portal_actions.listActions():
479        if actions.getCategory() == 'site_actions':
480            portal_actions.deleteActions((idx,))
481            break
482        idx += 1
483
484def setupActions(portal):
485    portal_actions = getToolByName(portal, 'portal_actions')
486    portal_actions.addAction(id='index_html', name='Página Inicial', action='string:$portal_url', condition='', permission='View', category='portal_tabs', visible=1)
487
488    portal_actions.addAction(id='ouvidoria', name='Ouvidoria', action='string:${portal_url}/ouvidoria', condition='', permission='View', category='portal_tabs', visible=1)
489
490    portal_actions.addAction(id='saap', name='SAAP', action='string: ${portal_url}/saap', condition='member', permission='View', category='portal_tabs', visible=1)
491
492    portal_actions.addAction(id='saal', name='SAAL', action='string: ${portal_url}/saal', condition='member', permission='View', category='portal_tabs', visible=1)
493 
494    portal_actions.addAction(id='webmail', name='Webmail', action='string:${portal_url}/webmail', condition='', permission='View', category='portal_tabs', visible=1)
495
496    portal_actions.addAction(id='contact', name='Fale com a Câmara', action='string: ${portal_url}/contact-info', condition='', permission='View', category='portal_tabs', visible=1)
497
498    portal_actions.addAction(id='sitemap', name='Site Map', action='string: ${portal_url}/sitemap', condition='', permission='View', category='portal_tabs', visible=1)
499
500    portal_actions.addAction(id='login_form', name='Acessar', action='string: ${portal_url}/login_form', condition='python:here.portal_membership.isAnonymousUser()', permission='View', category='portal_tabs', visible=1)
501
502def setupCssmanager(portal):
503    cssmanager = getToolByName(portal, 'portal_cssmanager')
504    cssmanager.manage_addToMapping('base_properties','Plone Css')
505
506def setupGroups(portal):
507    portal_groups = getToolByName(portal, 'portal_groups')
508    portal_groups.toggleGroupWorkspacesCreation()
509
510def setupMaintenance(portal):
511    portal_maintenance = getToolByName(portal, 'portal_maintenance')
512    portal_maintenance.tasks.invokeFactory('MaintenanceTask', 'pack')
513    portal_maintenance.tasks.pack._updateProperty('script_name','packDB')
514    portal_maintenance.tasks.pack._updateProperty('title','pack')
515    portal_maintenance.tasks.pack._updateProperty('scheduled_hour','22')
516
517
518def setupMemberdata(portal):
519    portal_memberdata = getToolByName(portal, 'portal_memberdata')
520    portal_memberdata.listed = (False)
521    if not portal_memberdata.hasProperty('sexo'):
522        portal_memberdata._setProperty('sexo', '', 'string')
523    if not portal_memberdata.hasProperty('idade'):
524        portal_memberdata._setProperty('idade', '', 'string')
525    if not portal_memberdata.hasProperty('endereco'):
526        portal_memberdata._setProperty('endereco', '', 'string')
527    if not portal_memberdata.hasProperty('bairro'):
528        portal_memberdata._setProperty('bairro', '', 'string')
529    if not portal_memberdata.hasProperty('cidade'):
530        portal_memberdata._setProperty('cidade', '', 'string')
531    if not portal_memberdata.hasProperty('estado'):
532        portal_memberdata._setProperty('estado', '', 'string')
533    if not portal_memberdata.hasProperty('fone_res'):
534        portal_memberdata._setProperty('fone_res', '', 'string')
535
536def setupMembership(portal):
537    portal_membership = getToolByName(portal, 'portal_membership')
538    portal_membership.setMemberareaCreationFlag()
539
540def setupMetadata(portal):
541    portal_metadata = getToolByName(portal, 'portal_metadata')
542    portal_metadata.updateElementPolicy(
543            element='Subject',
544            content_type='Event',
545            is_required=0,
546            supply_default=0,
547            default_value='',
548            enforce_vocabulary=0,
549            allowed_vocabulary=('Encontro', 'Convenção', 'Reunião', 'Evento Social', 'Trabalho'))
550
551def setupPortalCss(portal):
552    portal_css = getToolByName(portal, 'portal_css')
553    portal_css.manage_removeStylesheet('generated.css')
554    portal_css.manage_addStylesheet(id='generated.css', expression='', media='screen', rel='stylesheet',
555                             rendering='import', enabled=False)
556
557def setupWorkflow(portal):
558    portal_workflow = getToolByName(portal, 'portal_workflow')
559    portal_workflow.setDefaultChain('portal_modelo_workflow')
560
561def setupProperties(portal):
562    portal_properties = getToolByName(portal, 'portal_properties')
563    portal_properties.site_properties.default_language = 'pt-br'
564    portal_properties.site_properties.localTimeFormat = '%d/%m/%Y'
565    portal_properties.site_properties.localLongTimeFormat = '%d/%m/%Y %H:%M'
566    portal_properties.site_properties.disable_folder_sections = (True)
567    portal_properties.navtree_properties.includeTop = (False)
568    portal_properties.navtree_properties.idsNotToList = ('Members','portal_ombudsman',)
569    portal_properties.navtree_properties.metaTypesNotToList = ('ATImage','ATFile','ATEvent','ATLink','ATNewsItem',)
570
571    portal_properties.manage_addPropertySheet('portal_casas_properties','Propriedades do Portal das Casas')
572    if not portal_properties.portal_casas_properties.hasProperty('estado'):
573        portal_properties.portal_casas_properties._setProperty('estado', ['AC;Acre','AL;Alagoas','AP;Amapá','AM;Amazonas','BA;Bahia','CE;Ceará','DF;Distrito Federal','ES;Espírito Santo','GO;Goiás','MA;Maranhão','MT;Mato Grosso','MS;Mato Grosso do Sul','MG;Minas Gerais','PA;Pará','PB;Paraíba','PR;Paraná','PE;Pernambuco','PI;Piauí','RJ;Rio de Janeiro','RN;Rio Grande do Norte','RS;Rio Grande do Sul','RO;Rondônia','RR;Roraima','SC;Santa Catarina','SP;São Paulo','SE;Sergipe','TO;Tocantins'], 'lines')
574    if not portal_properties.portal_casas_properties.hasProperty('idade'):
575        portal_properties.portal_casas_properties._setProperty('idade', ['0;Menos que 15','1;15 a 20','2;20 a 25','3;25 a 30','4;30 a 35','5;35 a 40','6;45 a 50','7;50 a 55','8;55 a 60','9;60 a 65','10;65 a 70','11;70 a 75','12;75 a 80','13;Acima de 80'], 'lines')
576    if not portal_properties.portal_casas_properties.hasProperty('sexo'):
577        portal_properties.portal_casas_properties._setProperty('sexo', ['FE;Feminino','MA;Masculino'], 'lines')
578
579def setupPublicatorUtilidades(portal):
580    portal_publicator = getToolByName(portal, 'portal_publicator')
581    portal_publicator.addPublicationBox(id='utilidades',
582                           name='Utilidades',
583                           content_type=['Link'],
584                           n_items=5)
585
586def setupPublicatorPrevisao(portal):
587    portal_publicator = getToolByName(portal, 'portal_publicator')
588    portal_publicator.addPublicationBox(id='previsao',
589                           name='Previsão do Tempo',
590                           content_type=['Link'],
591                           n_items=1,
592                           with_image=1,
593                           image_states = ['published'],
594                           images_folder='imagens')
595
596def setupPublicatorDestaque(portal):
597    portal_publicator = getToolByName(portal, 'portal_publicator')
598    portal_publicator.addPublicationBox(id='destaque',
599                           name='Notícia Destaque',
600                           content_type=['News Item'],
601                           n_items=1,
602                           with_image=1,
603                           image_states = ['published'],
604                           images_folder='imagens/noticias')
605
606def setupPublicatorNoticia(portal):
607    portal_publicator = getToolByName(portal, 'portal_publicator')
608    portal_publicator.addPublicationBox(id='noticia',
609                           name='Últimas Notícias',
610                           content_type=['News Item'],
611                           n_items=5)
612
613def setupPublicatorBanner(portal):
614    portal_url = getToolByName(portal, 'portal_url')
615    url = portal_url(relative_to_portal=1)
616    items_banners = [{'Description':'Senado Federal','RemoteUrl':'http://www.senado.gov.br', 'ImageURL':'/imagens/banners/banner_senado.jpg', 'NewWindow': 'on', 'RelativeContentURL': '/utilidades/senado', 'RelativeURL':url+'/imagens/banners/banner_senado.jpg'},{'Description':'Interlegis', 'RemoteUrl':'http://www.interlegis.gov.br', 'ImageURL':'/imagens/banners/banner_interlegis.jpg', 'NewWindow': 'on', 'RelativeContentURL': '/utilidades/interlegis', 'RelativeURL':url+'/imagens/banners/banner_interlegis.jpg'},{'Description':'Câmara dos Deputados','RemoteUrl':'http://www.camara.gov.br', 'ImageURL':'/imagens/banners/banner_camara.jpg', 'NewWindow': 'on', 'RelativeContentURL': '/utilidades/camara', 'RelativeURL':url+'/imagens/banners/banner_camara.jpg'}]
617    portal_publicator = getToolByName(portal, 'portal_publicator')
618    portal_publicator.addPublicationBox(id='banners',
619                           name='Banners',
620                           content_type=['Link'],
621                           n_items=12,
622                           with_image=1,
623                           images_folder='imagens/banners',
624                           image_states=['published'],
625                           items=items_banners)
626
627def setupSin(portal):
628    sin_tool = getToolByName(portal, 'sin_tool')
629    channel = sin_tool.addChannel('zopept', '1h:http://rss.groups.yahoo.com/group/zope-pt/rss')
630    maps = sin_tool.addMap('Zope-PT', ['zopept'])
631
632def setupSkin(portal):
633    portal_skins = getToolByName(portal, 'portal_skins')
634    path = portal_skins.getSkinPath('Plone Default')
635    path = [elem.strip() for elem in path.split(',') if elem != '.svn']
636    path = ','.join(path)
637    portal_skins.addSkinSelection('Portal Casas', path)
638    portal_skins.manage_properties(default_skin = 'Portal Casas',
639                                   request_varname = 'plone_skin',
640                                   del_skin = 0,
641                                   chosen = [])
642
643def setupTipo(portal):
644    portal_types = getToolByName(portal, 'portal_types')
645    portal_types['Plone Site'].global_allow = False
646    addable_types=['Folder', 'OmbudsmanFolder']
647    portal_types['Plone Site'].filter_content_types = True
648    portal_types['Plone Site'].allowed_content_types = addable_types
649
650
651def uninstall(self):
652    pass
653
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.