Exemplo n.º 1
0
class IJobTimeTransaction(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=True,
    )

    from_user = RelationChoice(
        title=_(u"From user"),
        source=ObjPathSourceBinder(),
        required=True,
    )

    to_user = RelationChoice(
        title=_(u"To user"),
        source=ObjPathSourceBinder(),
        required=True,
    )

    job = RelationChoice(
        title=_(u"Job"),
        source=ObjPathSourceBinder(object_provides=IJobTime),
        required=True,
    )

    minutes_amount = schema.Int(
        title=_(u"Amount"),
        default=0,
    )
Exemplo n.º 2
0
class IJobTimeBalance(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=False,
    )

    minutes_balance = schema.Int(title=_("Balance"), default=0)
Exemplo n.º 3
0
class IJobTimeBank(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=True,
    )

    description = schema.Text(
        title=_(u"Description"),
        required=False,
    )
Exemplo n.º 4
0
    def __call__(self):
        self.display_form = True

        self.messages = list()
        request = self.request
        data = request.form

        if request.method == 'POST':
            logger.debug("Creating new time request")

            # TODO: better time value management (ie: hours + minutes)
            minutes_amount = data.get('amount')

            item = JobTimeItem(title=data.get('title'),
                               description=data.get('description'),
                               job_type='REQUEST',
                               details=data.get('details'),
                               minutes_amount=minutes_amount)

            try:
                job = item.register()
            except Exception, e:
                logger.error("Unable to create Time Job Request %s" % e)
                raise Exception

            self.messages.append(_(u"Request created"))
            self.display_form = False
Exemplo n.º 5
0
class IJobTimeBid(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=True,
    )

    description = schema.Text(
        title=_(u"Description"),
        required=False,
    )

    job = RelationChoice(
        title=_(u"Job"),
        source=ObjPathSourceBinder(object_provides=IJobTime),
        required=True,
    )
Exemplo n.º 6
0
class IJobTime(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=True,
    )

    description = schema.Text(
        title=_(u"Description"),
        required=False,
    )

    type = schema.Choice(
        title=_(u"Type"),
        vocabulary=types,
        required=False,
    )

    minutes_amount = schema.Int(
        title=_(u"Amount"),
        default=0,
    )
Exemplo n.º 7
0
    def __call__(self):

        self.display_confirm = True
        self.transaction_done = False

        self.messages = list()
        request = self.request

        if request.form.get('confirm'):
            transaction = JobTimeTransactionItem(bid=self.context)
            transaction = transaction.register()
            self.display_confirm = False
            self.messages.append(_(u"Transaction completed!"))
            self.transaction_done = True

        return self.render()
Exemplo n.º 8
0
class IJobTimeSkill(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=True,
    )
Exemplo n.º 9
0
from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
from plone.formwidget.contenttree import ObjPathSourceBinder
import logging

logger = logging.getLogger(__name__)


class ICollectiveTimebankLayer(IDefaultBrowserLayer):
    """Marker interface that defines a browser layer."""


types = SimpleVocabulary([
    SimpleTerm(value=u'REQUEST', title=_(u'Request')),
    SimpleTerm(value=u'OFFER', title=_(u'Offer')),
])


class IJobTime(Interface):

    title = schema.TextLine(
        title=_(u"Title"),
        required=True,
    )

    description = schema.Text(
        title=_(u"Description"),
        required=False,
    )