Esempio n. 1
0
    def render(self, portal=None):
        from genweb.controlpanel.interface import IGenwebControlPanelSettings
        from plone.app.controlpanel.site import ISiteSchema
        import unicodedata
        import types
        if CSRF:
            alsoProvides(self.request, IDisableCSRFProtection)
        portal = api.portal.get()
        mail = IMailSchema(portal)
        name = mail.email_from_name
        if name is not None:
            name = unicodedata.normalize('NFKD', name).encode('utf-8',
                                                              errors='ignore')
        email = mail.email_from_address
        site = ISiteSchema(portal)
        ga = '\n'.join(site.webstats_js)
        if ga is not '':
            ga = unicodedata.normalize('NFKD', ga).encode('utf-8',
                                                          errors='ignore')
        registry = queryUtility(IRegistry)
        gwcps = registry.forInterface(IGenwebControlPanelSettings)

        html_title_ca = gwcps.html_title_ca
        if html_title_ca is not None and type(
                html_title_ca) != types.BooleanType:
            html_title_ca = unicodedata.normalize(
                'NFKD', gwcps.html_title_ca).encode('utf-8', errors='ignore')
        html_title_es = gwcps.html_title_es
        if html_title_es is not None and type(
                html_title_es) != types.BooleanType:
            html_title_es = unicodedata.normalize(
                'NFKD', gwcps.html_title_es).encode('utf-8', errors='ignore')
        html_title_en = gwcps.html_title_en
        if html_title_en is not None and type(
                html_title_en) != types.BooleanType:
            html_title_en = unicodedata.normalize(
                'NFKD', gwcps.html_title_en).encode('utf-8', errors='ignore')
        signatura_unitat_ca = gwcps.signatura_unitat_ca
        if signatura_unitat_ca is not None and type(
                signatura_unitat_ca) != types.BooleanType:
            signatura_unitat_ca = unicodedata.normalize(
                'NFKD', gwcps.signatura_unitat_ca).encode('utf-8',
                                                          errors='ignore')
        signatura_unitat_es = gwcps.signatura_unitat_es
        if signatura_unitat_es is not None and type(
                signatura_unitat_es) != types.BooleanType:
            signatura_unitat_es = unicodedata.normalize(
                'NFKD', gwcps.signatura_unitat_es).encode('utf-8',
                                                          errors='ignore')
        signatura_unitat_en = gwcps.signatura_unitat_en
        if signatura_unitat_en is not None and type(
                signatura_unitat_en) != types.BooleanType:
            signatura_unitat_en = unicodedata.normalize(
                'NFKD', gwcps.signatura_unitat_en).encode('utf-8',
                                                          errors='ignore')
        right_logo_enabled = gwcps.right_logo_enabled
        if right_logo_enabled is not None and type(
                right_logo_enabled) != types.BooleanType:
            right_logo_enabled = unicodedata.normalize(
                'NFKD', gwcps.right_logo_enabled).encode('utf-8',
                                                         errors='ignore')
        right_logo_alt = gwcps.right_logo_alt
        if right_logo_alt is not None and type(
                right_logo_alt) != types.BooleanType:
            right_logo_alt = unicodedata.normalize(
                'NFKD', gwcps.right_logo_alt).encode('utf-8', errors='ignore')
        meta_author = gwcps.meta_author
        if meta_author is not None and type(meta_author) != types.BooleanType:
            meta_author = unicodedata.normalize(
                'NFKD', gwcps.meta_author).encode('utf-8', errors='ignore')
        contacte_id = gwcps.contacte_id
        if contacte_id is not None and type(contacte_id) != types.BooleanType:
            contacte_id = unicodedata.normalize(
                'NFKD', gwcps.contacte_id).encode('utf-8', errors='ignore')
        contacte_BBDD_or_page = gwcps.contacte_BBDD_or_page
        if contacte_BBDD_or_page is not None and type(
                contacte_BBDD_or_page) != types.BooleanType:
            contacte_BBDD_or_page = unicodedata.normalize(
                'NFKD', gwcps.contacte_BBDD_or_page).encode('utf-8',
                                                            errors='ignore')
        contacte_al_peu = gwcps.contacte_al_peu
        if contacte_al_peu is not None and type(
                contacte_al_peu) != types.BooleanType:
            contacte_al_peu = unicodedata.normalize(
                'NFKD', gwcps.contacte_al_peu).encode('utf-8', errors='ignore')
        directori_upc = gwcps.directori_upc
        if directori_upc is not None and type(
                directori_upc) != types.BooleanType:
            directori_upc = unicodedata.normalize(
                'NFKD', gwcps.directori_upc).encode('utf-8', errors='ignore')
        directori_filtrat = gwcps.directori_filtrat
        if directori_filtrat is not None and type(
                directori_filtrat) != types.BooleanType:
            directori_filtrat = unicodedata.normalize(
                'NFKD', gwcps.directori_filtrat).encode('utf-8',
                                                        errors='ignore')
        contacte_no_upcmaps = gwcps.contacte_no_upcmaps
        if contacte_no_upcmaps is not None and type(
                contacte_no_upcmaps) != types.BooleanType:
            contacte_no_upcmaps = unicodedata.normalize(
                'NFKD', gwcps.contacte_no_upcmaps).encode('utf-8',
                                                          errors='ignore')
        contacte_multi_email = gwcps.contacte_multi_email
        if contacte_multi_email is not None and type(
                contacte_multi_email) != types.BooleanType:
            contacte_multi_email = unicodedata.normalize(
                'NFKD', gwcps.contacte_multi_email).encode('utf-8',
                                                           errors='ignore')
        contact_emails_table = gwcps.contact_emails_table
        especific1 = gwcps.especific1
        if especific1 is not None and type(especific1) != types.BooleanType:
            especific1 = unicodedata.normalize(
                'NFKD', gwcps.especific1).encode('utf-8', errors='ignore')
        especific2 = gwcps.especific2
        if especific2 is not None and type(especific2) != types.BooleanType:
            especific2 = unicodedata.normalize(
                'NFKD', gwcps.especific2).encode('utf-8', errors='ignore')
        treu_imatge_capsalera = gwcps.treu_imatge_capsalera
        if treu_imatge_capsalera is not None and type(
                treu_imatge_capsalera) != types.BooleanType:
            treu_imatge_capsalera = unicodedata.normalize(
                'NFKD', gwcps.treu_imatge_capsalera).encode('utf-8',
                                                            errors='ignore')
        treu_menu_horitzontal = gwcps.treu_menu_horitzontal
        if treu_menu_horitzontal is not None and type(
                treu_menu_horitzontal) != types.BooleanType:
            treu_menu_horitzontal = unicodedata.normalize(
                'NFKD', gwcps.treu_menu_horitzontal).encode('utf-8',
                                                            errors='ignore')
        treu_icones_xarxes_socials = gwcps.treu_icones_xarxes_socials
        if treu_icones_xarxes_socials is not None and type(
                treu_icones_xarxes_socials) != types.BooleanType:
            treu_icones_xarxes_socials = unicodedata.normalize(
                'NFKD',
                gwcps.treu_icones_xarxes_socials).encode('utf-8',
                                                         errors='ignore')
        amaga_identificacio = gwcps.amaga_identificacio
        if amaga_identificacio is not None and type(
                amaga_identificacio) != types.BooleanType:
            amaga_identificacio = unicodedata.normalize(
                'NFKD', gwcps.amaga_identificacio).encode('utf-8',
                                                          errors='ignore')
        idiomes_publicats = gwcps.idiomes_publicats
        languages_link_to_root = gwcps.languages_link_to_root
        if languages_link_to_root is not None and type(
                languages_link_to_root) != types.BooleanType:
            languages_link_to_root = unicodedata.normalize(
                'NFKD', gwcps.languages_link_to_root).encode('utf-8',
                                                             errors='ignore')
        idestudi_master = gwcps.idestudi_master
        if idestudi_master is not None and type(
                idestudi_master) != types.BooleanType:
            idestudi_master = unicodedata.normalize(
                'NFKD', gwcps.idestudi_master).encode('utf-8', errors='ignore')
        create_packet = gwcps.create_packet
        if create_packet is not None and type(
                create_packet) != types.BooleanType:
            create_packet = unicodedata.normalize(
                'NFKD', gwcps.create_packet).encode('utf-8', errors='ignore')
        cl_title_ca = gwcps.cl_title_ca
        if cl_title_ca is not None and type(cl_title_ca) != types.BooleanType:
            cl_title_ca = unicodedata.normalize(
                'NFKD', gwcps.cl_title_ca).encode('utf-8', errors='ignore')
        cl_url_ca = gwcps.cl_url_ca
        cl_img_ca = gwcps.cl_img_ca
        if cl_img_ca is not None and type(cl_img_ca) != types.BooleanType:
            cl_img_ca = unicodedata.normalize('NFKD', gwcps.cl_img_ca).encode(
                'utf-8', errors='ignore')
        cl_open_new_window_ca = gwcps.cl_open_new_window_ca
        if cl_open_new_window_ca is not None and type(
                cl_open_new_window_ca) != types.BooleanType:
            cl_open_new_window_ca = unicodedata.normalize(
                'NFKD', gwcps.cl_open_new_window_ca).encode('utf-8',
                                                            errors='ignore')
        cl_enable_ca = gwcps.cl_enable_ca
        if cl_enable_ca is not None and type(
                cl_enable_ca) != types.BooleanType:
            cl_enable_ca = unicodedata.normalize(
                'NFKD', gwcps.cl_enable_ca).encode('utf-8', errors='ignore')
        cl_title_es = gwcps.cl_title_es
        if cl_title_es is not None and type(cl_title_es) != types.BooleanType:
            cl_title_es = unicodedata.normalize(
                'NFKD', gwcps.cl_title_es).encode('utf-8', errors='ignore')
        cl_url_es = gwcps.cl_url_es
        cl_img_es = gwcps.cl_img_es
        if cl_img_es is not None and type(cl_img_es) != types.BooleanType:
            cl_img_es = unicodedata.normalize('NFKD', gwcps.cl_img_es).encode(
                'utf-8', errors='ignore')
        cl_open_new_window_es = gwcps.cl_open_new_window_es
        if cl_open_new_window_es is not None and type(
                cl_open_new_window_es) != types.BooleanType:
            cl_open_new_window_es = unicodedata.normalize(
                'NFKD', gwcps.cl_open_new_window_es).encode('utf-8',
                                                            errors='ignore')
        cl_enable_es = gwcps.cl_enable_es
        if cl_enable_es is not None and type(
                cl_enable_es) != types.BooleanType:
            cl_enable_es = unicodedata.normalize(
                'NFKD', gwcps.cl_enable_es).encode('utf-8', errors='ignore')
        cl_title_en = gwcps.cl_title_en
        if cl_title_en is not None and type(cl_title_en) != types.BooleanType:
            cl_title_en = unicodedata.normalize(
                'NFKD', gwcps.cl_title_en).encode('utf-8', errors='ignore')
        cl_url_en = gwcps.cl_url_en
        cl_img_en = gwcps.cl_img_en
        if cl_img_en is not None and type(cl_img_en) != types.BooleanType:
            cl_img_en = unicodedata.normalize('NFKD', gwcps.cl_img_en).encode(
                'utf-8', errors='ignore')
        cl_open_new_window_en = gwcps.cl_open_new_window_en
        if cl_open_new_window_en is not None and type(
                cl_open_new_window_en) != types.BooleanType:
            cl_open_new_window_en = unicodedata.normalize(
                'NFKD', gwcps.cl_open_new_window_en).encode('utf-8',
                                                            errors='ignore')
        cl_enable_en = gwcps.cl_enable_en
        if cl_enable_en is not None and type(
                cl_enable_en) != types.BooleanType:
            cl_enable_en = unicodedata.normalize(
                'NFKD', gwcps.cl_enable_en).encode('utf-8', errors='ignore')

        output = """Títol del web amb HTML tags (negretes) [CA]: {}<br/>
                     Títol del web amb HTML tags (negretes) [ES]: {}<br/>
                     Títol del web amb HTML tags (negretes) [EN]: {}<br/>
                     Signatura de la unitat [CA]: {}<br/>
                     Signatura de la unitat [ES]: {}<br/>
                     Signatura de la unitat [EN]: {}<br/>
                     Mostrar logo dret: {}<br/>
                     Text alternatiu del logo dret: {}<br/>
                     Meta author tag content: {}<br/>
                     ID contacte de la unitat: {}<br/>
                     Pàgina de contacte alternativa: {}<br/>
                     Adreça de contacte al peu: {}<br/>
                     Directori UPC a les eines: {}<br/>
                     Filtrat per unitat?: {}<br/>
                     Desactivar UPCmaps: {}<br/>
                     Seleccionar l'adreça d'enviament: {}<br/>
                     Contact emails: {}<br/>
                     Color específic 1: {}<br/>
                     Color específic 2: {}<br/>
                     Treu la imatge de la capçalera: {}<br/>
                     Treu el menú horitzontal: {}<br/>
                     Treu les icones per compartir en xarxes socials: {}<br/>
                     Amaga l'enllaç d'identificació de les eines: {}<br/>
                     Idiomes publicats al web: {}<br/>
                     Redireccionar a l'arrel del lloc al clicar sobre els idiomes del portal: {}<br/>
                     id_estudi: {}<br/>
                     Crear informació general del màster: {}<br/>
                     Link title [CA]: {}<br/>
                     Enllaç per al menú superior: {}<br/>
                     Enllaç per a la icona del menú superior: {}<br/>
                     Obre en una nova finestra: {}<br/>
                     Publica l'enllaç customitzat: {}<br/>
                     Link title [ES]: {}<br/>
                     Enllaç per al menú superior: {}<br/>
                     Enllaç per a la icona del menú superior: {}<br/>
                     Obre en una nova finestra: {}<br/>
                     Publica l'enllaç customitzat: {}<br/>
                     Link title [EN]: {}<br/>
                     Enllaç per al menú superior: {}<br/>
                     Enllaç per a la icona del menú superior: {}<br/>
                     Obre en una nova finestra: {}<br/>
                     Publica l'enllaç customitzat: {}<br/>
                     Nom 'De' del lloc: {}<br/>
                     Adreça 'De' del lloc: {}<br/>
                     Javascript per al suport d'estadístiques web: {}<br/></br>
                     """.format(
            html_title_ca, html_title_es, html_title_en, signatura_unitat_ca,
            signatura_unitat_es, signatura_unitat_en, right_logo_enabled,
            right_logo_alt, meta_author, contacte_id, contacte_BBDD_or_page,
            contacte_al_peu, directori_upc, directori_filtrat,
            contacte_no_upcmaps, contacte_multi_email, contact_emails_table,
            especific1, especific2, treu_imatge_capsalera,
            treu_menu_horitzontal, treu_icones_xarxes_socials,
            amaga_identificacio, idiomes_publicats, languages_link_to_root,
            idestudi_master, create_packet, cl_title_ca, cl_url_ca, cl_img_ca,
            cl_open_new_window_ca, cl_enable_ca, cl_title_es, cl_url_es,
            cl_img_es, cl_open_new_window_es, cl_enable_es, cl_title_en,
            cl_url_en, cl_img_en, cl_open_new_window_en, cl_enable_en, name,
            email, ga)
        return output
Esempio n. 2
0
def setupVarious(context):

    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('upc.genwebupc_various.txt') is None:
        return

    # Add additional setup code here
    #
    portal = context.getSite()
    transforms = getToolByName(portal, 'portal_transforms')
    transform = getattr(transforms, 'safe_html')
    valid = transform.get_parameter_value('valid_tags')
    nasty = transform.get_parameter_value('nasty_tags')
    # GW4 Valid tags
    gw4_valid = ['script', 'object', 'embed', 'param', 'iframe', 'applet']
    for tag in gw4_valid:
        # Acceptar a la llista de valides
        valid[tag] = 1
        # Eliminar de la llista no desitjades
        if tag in nasty:
            del nasty[tag]

    stripped = transform.get_parameter_value('stripped_attributes')
    # GW4 remove some stripped
    for tag in ['cellspacing', 'cellpadding', 'valign']:
        if tag in stripped:
            stripped.remove(tag)

    kwargs = {}
    kwargs['valid_tags'] = valid
    kwargs['nasty_tags'] = nasty
    kwargs['stripped_attributes'] = stripped

    for k in list(kwargs):
        if isinstance(kwargs[k], dict):
            v = kwargs[k]
            kwargs[k + '_key'] = v.keys()
            kwargs[k + '_value'] = [str(s) for s in v.values()]
            del kwargs[k]
    transform.set_parameters(**kwargs)
    transform._p_changed = True
    transform.reload()
    try:
            manage_addPloneLDAPMultiPlugin(
                portal.acl_users,
                "ldapUPC",
                title="ldapUPC", use_ssl=1, login_attr="cn", uid_attr="cn", local_groups=0,
                users_base="ou=Users,dc=upc,dc=edu", users_scope=2,
                roles="Authenticated", groups_base="ou=Groups,dc=upc,dc=edu",
                groups_scope=2, read_only=True, binduid="cn=ldap.upc,ou=Users,dc=upc,dc=edu", bindpwd=LDAP_PASSWORD,
                rdn_attr="cn", LDAP_server="ldap.upc.edu", encryption="SSHA")
            portal.acl_users.ldapUPC.acl_users.manage_edit(
                "ldapUPC", "cn", "cn", "ou=Users,dc=upc,dc=edu", 2, "Authenticated",
                "ou=Groups,dc=upc,dc=edu", 2, "cn=ldap.upc,ou=Users,dc=upc,dc=edu", LDAP_PASSWORD, 1, "cn",
                "top,person", 0, 0, "SSHA", 1, '')
            plugin = portal.acl_users['ldapUPC']

            plugin.manage_activateInterfaces(['IGroupEnumerationPlugin', 'IGroupsPlugin', 'IPropertiesPlugin', 'IGroupIntrospection', 'IAuthenticationPlugin', 'IRolesPlugin', 'IUserEnumerationPlugin', 'IRoleEnumerationPlugin'])
            #Comentem la linia per a que no afegeixi
            #LDAPUserFolder.manage_addServer(portal.acl_users.ldapUPC.acl_users, "ldap.upc.edu", '636', use_ssl=1)

            LDAPUserFolder.manage_deleteLDAPSchemaItems(portal.acl_users.ldapUPC.acl_users, ldap_names=['sn'], REQUEST=None)
            LDAPUserFolder.manage_addLDAPSchemaItem(portal.acl_users.ldapUPC.acl_users, ldap_name='sn', friendly_name='Last Name', public_name='name')

            # Move the ldapUPC to the top of the active plugins.
            # Otherwise member.getProperty('email') won't work properly.
            from Products.PluggableAuthService.interfaces.plugins import IPropertiesPlugin
            portal.acl_users.plugins.movePluginsUp(IPropertiesPlugin, ['ldapUPC'])
            #portal.acl_users.plugins.manage_movePluginsUp('IPropertiesPlugin', ['ldapUPC'], context.REQUEST.RESPONSE)
    except:
            pass

    #try:
            # Fora el sistema de cookies que fan buscar al LDAP cn=*
    #        portal.acl_users.manage_delObjects('credentials_cookie_auth')
    #except:
    #        pass

    plugin = portal.acl_users['ldapUPC']
    plugin.ZCacheable_setManagerId('RAMCache')

    portal_role_manager = portal.acl_users['portal_role_manager']
    portal_role_manager.assignRolesToPrincipal(["Manager"], "UPC.Plone.Admins")
    portal_role_manager.assignRolesToPrincipal(["Manager"], "UPCnet.Plone.Admins")
    portal_role_manager.assignRolesToPrincipal(["Manager"], "UPCnet.ATIC")
    portal_role_manager.assignRolesToPrincipal(["Manager"], "UPCNET.Frontoffice.2n.nivell")

    # deshabilitem inline editing
    site_properties = ISiteSchema(portal)
    site_properties.enable_inline_editing = False

    # configurem pagina per defecte
    portal.setLayout("homepage")

    # configurem els estats del calendari
    pct = getToolByName(portal, 'portal_calendar')
    pct.calendar_states = ('published', 'intranet')
    # Fixem el primer dia de la setmana com dilluns (0)
    pct.firstweekday = 0
    transaction.commit()
Esempio n. 3
0
def setupVarious(context):

    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('genweb.core_various.txt') is None:
        return

    # Add additional setup code here
    #
    portal = context.getSite()
    logger = logging.getLogger(__name__)
    transforms = getToolByName(portal, 'portal_transforms')
    transform = getattr(transforms, 'safe_html')
    valid = transform.get_parameter_value('valid_tags')
    nasty = transform.get_parameter_value('nasty_tags')

    # GW4 Valid tags
    gw4_valid = ['script', 'object', 'embed', 'param', 'iframe', 'applet', 'button']
    for tag in gw4_valid:
        # Acceptar a la llista de valides
        valid[tag] = 1
        # Eliminar de la llista no desitjades
        if tag in nasty:
            del nasty[tag]

    stripped = transform.get_parameter_value('stripped_attributes')
    # GW4 remove some stripped
    for tag in ['cellspacing', 'cellpadding', 'valign']:
        if tag in stripped:
            stripped.remove(tag)

    kwargs = {}
    kwargs['valid_tags'] = valid
    kwargs['nasty_tags'] = nasty
    kwargs['stripped_attributes'] = stripped
    for k in list(kwargs):
        if isinstance(kwargs[k], dict):
            v = kwargs[k]
            kwargs[k + '_key'] = v.keys()
            kwargs[k + '_value'] = [str(s) for s in v.values()]
            del kwargs[k]
    transform.set_parameters(**kwargs)
    transform._p_changed = True
    transform.reload()

    # deshabilitem inline editing
    site_properties = ISiteSchema(portal)
    site_properties.enable_inline_editing = False

    # configurem els estats del calendari
    pct = getToolByName(portal, 'portal_calendar')
    pct.calendar_states = ('published', 'intranet')
    # Fixem el primer dia de la setamana com dilluns (0)
    pct.firstweekday = 0

    # Mark the home page
    if getattr(portal, 'front-page', False):
        alsoProvides(portal['front-page'], IHomePage)
        portal['front-page'].reindexObject()

    # Set mailhost
    mh = getToolByName(portal, 'MailHost')
    mh.smtp_host = 'localhost'
    portal.email_from_name = 'Genweb Administrator'
    portal.email_from_address = '*****@*****.**'

    # Set default TimeZone (p.a.event)
    api.portal.set_registry_record('plone.app.event.portal_timezone', 'Europe/Madrid')
    api.portal.set_registry_record('plone.app.event.first_weekday', 0)

    transaction.commit()

    add_catalog_indexes(portal, logger)
Esempio n. 4
0
 def get_webstats_js(self):
     site = getSite()
     return ISiteSchema(site).webstats_js
Esempio n. 5
0
def setupVarious(context):

    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('genweb.core_various.txt') is None:
        return

    # Add additional setup code here
    #
    portal = context.getSite()
    logger = logging.getLogger(__name__)
    transforms = getToolByName(portal, 'portal_transforms')
    transform = getattr(transforms, 'safe_html')
    valid = transform.get_parameter_value('valid_tags')
    nasty = transform.get_parameter_value('nasty_tags')

    # GW4 Valid tags
    gw4_valid = ['script', 'object', 'embed', 'param', 'iframe', 'applet', 'button']
    for tag in gw4_valid:
        # Acceptar a la llista de valides
        valid[tag] = 1
        # Eliminar de la llista no desitjades
        if tag in nasty:
            del nasty[tag]

    stripped = transform.get_parameter_value('stripped_attributes')
    # GW4 remove some stripped
    for tag in ['cellspacing', 'cellpadding', 'valign']:
        if tag in stripped:
            stripped.remove(tag)

    kwargs = {}
    kwargs['valid_tags'] = valid
    kwargs['nasty_tags'] = nasty
    kwargs['stripped_attributes'] = stripped
    for k in list(kwargs):
        if isinstance(kwargs[k], dict):
            v = kwargs[k]
            kwargs[k + '_key'] = v.keys()
            kwargs[k + '_value'] = [str(s) for s in v.values()]
            del kwargs[k]
    transform.set_parameters(**kwargs)
    transform._p_changed = True
    transform.reload()

    # deshabilitem inline editing
    site_properties = ISiteSchema(portal)
    site_properties.enable_inline_editing = False

    # configurem els estats del calendari
    pct = getToolByName(portal, 'portal_calendar')
    pct.calendar_states = ('published', 'intranet')
    # Fixem el primer dia de la setamana com dilluns (0)
    pct.firstweekday = 0

    # Mark the home page
    if getattr(portal, 'front-page', False):
        alsoProvides(portal['front-page'], IHomePage)
        portal['front-page'].reindexObject()

    # Set mailhost
    if portal.email_from_address in ('*****@*****.**', '*****@*****.**'):
        mh = getToolByName(portal, 'MailHost')
        mh.smtp_host = 'localhost'
        portal.email_from_name = 'Genweb Administrator'
        portal.email_from_address = '*****@*****.**'

    # Set default TimeZone (p.a.event)
    api.portal.set_registry_record('plone.app.event.portal_timezone', 'Europe/Madrid')
    api.portal.set_registry_record('plone.app.event.first_weekday', 0)

    transaction.commit()

    add_catalog_indexes(portal, logger)