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

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

Acrescentada aba para SAAl

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