def __call__(self):
        msg_type = 'info'

        if IListingCollection.providedBy(self.context):
            # Deactivate ListingCollection viewlet.
            noLongerProvides(self.context, IListingCollection)
            self.context.reindexObject(idxs=['object_provides', ])
            msg = _(u"'Listing Collection' viewlet deactivated.")
        elif IPossibleListingCollection.providedBy(self.context):
            alsoProvides(self.context, IListingCollection)
            self.context.reindexObject(idxs=['object_provides', ])
            msg = _(u"'Listing Collection' viewlet activated.")
        else:
            msg = _(
                u'The \'Listing Collection\' viewlet does\'t work with this '
                u'content type. Add \'IPossibleListingCollection\' to the '
                u'provided interfaces to enable this feature.'
            )
            msg_type = 'error'

        self.context.plone_utils.addPortalMessage(msg, msg_type)
        self.request.response.redirect(self.context.absolute_url())
예제 #2
0
    def __call__(self):
        msg_type = "info"

        if IListingSearch.providedBy(self.context):
            # Deactivate ListingSearch viewlet.
            noLongerProvides(self.context, IListingSearch)
            self.context.reindexObject(idxs=["object_provides"])
            msg = _(u"'Listing Search' viewlet deactivated.")
        elif IPossibleListingSearch.providedBy(self.context):
            alsoProvides(self.context, IListingSearch)
            self.context.reindexObject(idxs=["object_provides"])
            msg = _(u"'Listing Search' viewlet activated.")
        else:
            msg = _(
                u"The 'Listing Search' viewlet does't work with this "
                u"content type. Add 'IPossibleListingSearch' to the "
                u"provided interfaces to enable this feature."
            )
            msg_type = "error"

        self.context.plone_utils.addPortalMessage(msg, msg_type)
        self.request.response.redirect(self.context.absolute_url())
예제 #3
0
    def __call__(self):
        """Perform the toggle."""
        msg_type = 'info'

        if ILocalAgencyInfo.providedBy(self.context):
            # Deactivate local agency information.
            noLongerProvides(self.context, ILocalAgencyInfo)
            self.context.reindexObject(idxs=['object_provides', ])
            msg = _(u'Local agency information deactivated.')
        elif IPossibleLocalAgencyInfo.providedBy(self.context):
            alsoProvides(self.context, ILocalAgencyInfo)
            self.context.reindexObject(idxs=['object_provides', ])
            msg = _(u'Local agency information activated.')
        else:
            msg = _(
                u'The local agency information don\'t work with this '
                u'content type. Add \'IPossibleLocalAgencyInfo\' to the '
                u'provided interfaces to enable this feature.'
            )
            msg_type = 'error'

        self.context.plone_utils.addPortalMessage(msg, msg_type)
        self.request.response.redirect(self.context.absolute_url())
예제 #4
0
 def getContent(self):
     registry = getUtility(IRegistry)
     try:
         return registry.forInterface(  # noqa
             self.schema,
             prefix=self.schema_prefix,
         )
     except KeyError:
         self.ignoreContext = True
         self.fields = field.Fields()
         registry.registerInterface(self.schema)
         self.status = _(
             u'Registry has been updated. Please reload this page.'
         )
         return None
예제 #5
0
# local imports
from plone.mls.listing.browser.interfaces import IListingDetails
from plone.mls.listing.i18n import _

# starting from 0.6.0 version plone.z3cform has IWrappedForm interface
try:
    from plone.z3cform.interfaces import IWrappedForm
    HAS_WRAPPED_FORM = True
except ImportError:
    HAS_WRAPPED_FORM = False

from plone.formwidget.captcha.widget import CaptchaFieldWidget
from plone.formwidget.captcha.validator import CaptchaValidator

MSG_PORTLET_DESCRIPTION = _(
    u'This portlet shows a form to contact the corresponding agent for a '
    u'given listing via email.'
)

EMAIL_TEMPLATE = _(
    u'agent_contact_email',
    default=u'Enquiry from: {name} <{sender_from_address}>\n'
    u'Listing URL: {url}\n'
    u'\n'
    u'Phone Number: {phone}\n'
    u'\n'
    u'Message:\n'
    u'{message}'
)

EMAIL_TEMPLATE_RL = _(
    u'agent_contact_email_rl',
예제 #6
0
 def __call__(self, context):
     items = []
     items.append(SimpleTerm('1', '1', _(u'Yes')))
     items.append(SimpleTerm('0', '0', _(u'No')))
     items.append(SimpleTerm('--NOVALUE--', '--NOVALUE--', _(u'All')))
     return SimpleVocabulary(items)
예제 #7
0
from zope.component import getUtility, queryMultiAdapter
from zope.globalrequest import getRequest
from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary

# local imports
from plone.mls.core import api
from plone.mls.listing import AnnotationStorage
from plone.mls.listing.i18n import _
from plone.mls.listing.api import search_options
from plone.mls.listing.browser import listing_search
from plone.mls.listing.interfaces import IMLSVocabularySettings

ROOM_VALUES = [
    ('--MINVALUE--', _(u'Min')),
    (1, '1'),
    (2, '2'),
    (3, '3'),
    (4, '4'),
    (5, '5'),
    (6, '6'),
    (7, '7'),
    (8, '8'),
    (9, '9'),
    ('--MAXVALUE--', _(u'Max')),
]

LOT_SIZE_VALUES = [
    ('--MINVALUE--', _(u'Min')),
    (500, u'500 m²'),
예제 #8
0
# -*- coding: utf-8 -*-
"""Propertyshelf MLS Embedding interfaces."""

# zope imports
from plone.directives import form
from plone.supermodel.directives import fieldset
from zope import schema
from zope.interface import Interface

# local imports
from plone.mls.listing.i18n import _

MSG_PRIORITY_DESCRIPTION = _(
    u'Items in this vocabulary are sorted by priority key (if available) '
    u'and value otherwise. Enter one item per line. Possible values are: %s'
)

POSSIBLE_GEOGRAPHIC_TYPES = ', '.join([
    'cloud_forest', 'dry_forest', 'highland_forest', 'rain_forest',
    'swamp_forest',
])

POSSIBLE_LISTING_TYPES = ', '.join(['cl', 'cs', 'll', 'rl', 'rs', ])

POSSIBLE_LOCATION_TYPES = ', '.join([
    'lakefront', 'mountain', 'oceanfront', 'oceanvicinity', 'riverfront',
    'rural', 'urban',
])

POSSIBLE_OBJECT_TYPES = ', '.join([
    'agricultural_land', 'apartment', 'bar_nightclub', 'commercial_condo',
# -*- coding: utf-8 -*-
""" Photo Wall Portlet """
from plone.app.portlets.portlets import base
from plone.portlets.interfaces import IPortletDataProvider
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.interface import implementer
from zope import formlib, schema
from zope.schema.fieldproperty import FieldProperty

# local imports
from plone.mls.listing.i18n import _

MSG_PORTLET_DESCRIPTION = _(u'This portlet let includes a Listing PhotoWall.')


class IPhotoWallPortlet(IPortletDataProvider):
    """ A PhotoWall portlet """
    heading = schema.TextLine(
        description=_(u'Portlet Title'),
        required=False,
        title=_(u'Portlet Title'),
    )


@implementer(IPhotoWallPortlet)
class Assignment(base.Assignment):
    """PhotoWall Portlet Assignment."""

    heading = FieldProperty(IPhotoWallPortlet['heading'])
    title = _(u'PhotoWall Portlet')
예제 #10
0
from zope.schema.fieldproperty import FieldProperty

# local imports
from plone.mls.listing.browser import listing_search
from plone.mls.listing.browser.valuerange.widget import ValueRangeFieldWidget
from plone.mls.listing.i18n import _

# starting from 0.6.0 version plone.z3cform has IWrappedForm interface
try:
    from plone.z3cform.interfaces import IWrappedForm
    HAS_WRAPPED_FORM = True
except ImportError:
    HAS_WRAPPED_FORM = False


MSG_PORTLET_DESCRIPTION = _(u'This portlet shows a listing quick search form.')

#: Definition of available fields in the given ``rows``.
FIELD_ORDER = {
    'row_listing_type': [
        'listing_type',
    ],
    'row_location': [
        'location_state',
        'location_county',
        'location_district',
        'location_city',
    ],
    'row_beds_baths': [
        'beds',
        'baths',
from plone.portlets.interfaces import IPortletRetriever
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope import schema
from zope.component import getMultiAdapter
from zope.component import getUtility
from zope.interface import implementer
from zope.schema.fieldproperty import FieldProperty


if PLONE_4:
    from zope.formlib import form


MSG_PORTLET_DESCRIPTION = _(
    u'This portlet shows the corresponding agent information for a given '
    u'listing. Note that this portlet is only available for the detail view '
    u'of a listing.',
)


class IAgentInformationPortlet(IPortletDataProvider):
    """A portlet displaying agent information for a listing."""

    heading = schema.TextLine(
        description=_(
            u'Custom title for the portlet. If no title is provided, the '
            u'default title is used.'),
        required=False,
        title=_(u'Portlet Title'),
    )
    def format_data_for_email(self, data):
        """Add the submitted form data to the mail message."""
        items = []
        tpl = u'{0}: {1}\n'
        if 'country' in data:
            items.append(
                tpl.format(
                    translate(_(u'Country'), context=self.request),
                    data['country'],
                ),
            )
        if 'zipcode' in data:
            items.append(
                tpl.format(
                    translate(_(u'ZIP'), context=self.request),
                    data['zipcode'],
                ),
            )
        if 'phone' in data:
            items.append(
                tpl.format(
                    translate(_(u'Phone Number'), context=self.request),
                    data['phone'],
                ),
            )

        if 'arrival_date' in data:
            items.append(
                tpl.format(
                    translate(_(u'Arrival Date'), context=self.request),
                    data['arrival_date'],
                ),
            )
        if 'departure_date' in data:
            items.append(
                tpl.format(
                    translate(_(u'Departure Date'), context=self.request),
                    data['departure_date'],
                ),
            )
        if 'adults' in data:
            items.append(
                tpl.format(
                    translate(_(u'Adults'), context=self.request),
                    data['adults'],
                ),
            )
        if 'children' in data:
            items.append(
                tpl.format(
                    translate(_(u'Children'), context=self.request),
                    data['children'],
                ),
            )
        if 'accept_tcs' in data:
            items.append(
                tpl.format(
                    translate(
                        _(u'Terms & Conditions accepted'),
                        context=self.request,
                    ),
                    data['accept_tcs'],
                ),
            )
        return u''.join(items)
 def title(self):
     return self.data.heading or _(u'Agent Contact')
try:
    from plone.z3cform.interfaces import IWrappedForm
    HAS_WRAPPED_FORM = True
except ImportError:
    HAS_WRAPPED_FORM = False

if PLONE_5:
    from plone.app.vocabularies.catalog import CatalogSource
elif PLONE_4:
    from plone.app.form.widgets.uberselectionwidget import UberSelectionWidget
    from plone.app.vocabularies.catalog import SearchableTextSourceBinder
    from zope import formlib


MSG_PORTLET_DESCRIPTION = _(
    u'This portlet shows a form to contact the corresponding agent for a '
    u'given listing via email.',
)

EMAIL_TEMPLATE = _(
    u'agent_contact_email',
    default=u'Enquiry from: {name} <{sender_from_address}>\n'
    u'Listing URL: {url}\n'
    u'\n'
    u'{form_data}\n'
    u'\n'
    u'Message:\n'
    u'{message}\n',
)

EMAIL_TEMPLATE_AGENT = _(
    u'agent_contact_email_agent',
    # try to extend plone.mls.listing QuickSearch Renderer
    from plone.mls.listing.browser import (
        listing_collection,
        listing_search,
        recent_listings,
    )
    PLONE_MLS_LISTING = True

except ImportError:
    # define fallbacks if plone.mls.listing is not installed
    PLONE_MLS_LISTING = False

# local imports
from plone.mls.listing.i18n import _

MSG_PORTLET_DESCRIPTION = _(u'This portlet shows a AjaxFilter for MLS Listings.')  # noqa

#: Definition of available fields in the given ``rows``.
FIELD_ORDER = {
    'row_listing_type': [
        'listing_type',
    ],
    'row_beds': [
        'beds',
    ],

    'row_view_type': [
        'view_type',
    ],
    'row_price_sale': [
        'price_sale',
 def title(self):
     return self.data.heading or _(u'Agent Information')
예제 #17
0
def validate_email(value):
    if value:
        if not check_email(value):
            raise Invalid(_(u'Invalid email address'))
    return True
# -*- coding: utf-8 -*-
"""Vocabulary definitions."""

from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary

from plone.mls.listing.i18n import _

LISTINGTYPE_VALUES = [
    ('rental', _(u'Rental')),
    ('sale', _(u'Sale')),
    ('home', _(u'Home')),
    ('condo', _(u'Condo')),
    ('lot', _(u'Lot')),
]

BEDROOM_VALUES = [
    (1, '1'),
    (2, '2'),
    (3, '3'),
    (4, '4'),
    (5, '5'),
    (6, '6+'),
]

VIEW_VALUES = [
    ('ocean_view', _(u'Ocean View')),
    ('oceanfront', _(u'Ocean Front')),
    ('garden_view', _(u'Garden View')),
]
예제 #19
0
def contains_nuts(value):
    """Check for traces of nuts, like urls or other spammer fun things"""
    if value:
        if check_for_url(value):
            raise Invalid(_(u'No Urls allowed'))
    return True
예제 #20
0
# -*- coding: utf-8 -*-
"""View adapter."""

# plone imports
from z3c.form.widget import StaticWidgetAttribute

# local imports
from plone.mls.listing import browser
from plone.mls.listing.i18n import _

PleaseSelectLCC = StaticWidgetAttribute(
    _(u'All'), view=browser.listing_collection.ListingCollectionConfiguration)
PleaseSelectLSF = StaticWidgetAttribute(
    _(u'All'), view=browser.listing_search.ListingSearchForm)
PleaseSelectRLC = StaticWidgetAttribute(
    _(u'All'), view=browser.recent_listings.RecentListingsConfiguration)


PleaseSelectState = StaticWidgetAttribute(
    _(u'All'), field=browser.listing_search.IListingSearchForm['location_state'])
PleaseSelectCounty = StaticWidgetAttribute(
    _(u'All'), field=browser.listing_search.IListingSearchForm['location_county'])
PleaseSelectDistrict = StaticWidgetAttribute(
    _(u'All'), field=browser.listing_search.IListingSearchForm['location_district'])