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

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

Setado CMFSin

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