Пример #1
0
class IBandoCollectionPortlet(ICollectionPortlet):
    """A portlet which renders the results of a collection object.
    """

    show_more_text = schema.TextLine(
        title=_(u"Other text"),
        description=_(u"Alternative text to show in 'other' link."),
        required=True,
        default=u"Altro\u2026",
    )

    show_more_path = schema.Choice(
        title=_(u"Internal link"),
        description=_(
            u"Insert an internal link. This field override external link field"
        ),
        required=False,
        source=CatalogSource(),
    )

    show_description = schema.Bool(title=u"Mostra descrizione",
                                   required=True,
                                   default=False)

    show_tipologia_bando = schema.Bool(title=u"Mostra tipologia bando",
                                       required=True,
                                       default=False)

    show_effective = schema.Bool(title=u"Mostra data di pubblicazione",
                                 required=True,
                                 default=False)

    show_scadenza_bando = schema.Bool(title=u"Mostra data di scadenza",
                                      required=True,
                                      default=False)
Пример #2
0
    def getBandoState(self, bando):
        """
        return corretc bando state
        """
        scadenza_bando = bando.scadenza_bando
        chiusura_procedimento_bando = bando.chiusura_procedimento_bando
        state = ("open", translate(_(u"Open"), context=self.request))
        if scadenza_bando and scadenza_bando.isPast():
            if (chiusura_procedimento_bando
                    and chiusura_procedimento_bando.isPast()):
                state = (
                    "closed",
                    translate(_(u"Closed"), context=self.request),
                )
            else:
                state = (
                    "inProgress",
                    translate(_(u"In progress"), context=self.request),
                )
        else:
            if (chiusura_procedimento_bando
                    and chiusura_procedimento_bando.isPast()):
                state = (
                    "closed",
                    translate(_(u"Closed"), context=self.request),
                )

        return state
Пример #3
0
    def getBandoState(self):
        """
        return right bando state
        """
        scadenza_bando = getattr(self.context, "scadenza_bando", None)
        chiusura_procedimento_bando = getattr(self.context,
                                              "chiusura_procedimento_bando",
                                              None)

        state = ("open", translate(_(u"Open"), context=self.request))
        if not scadenza_bando and not chiusura_procedimento_bando:
            return state
        scadenza_tz = getattr(scadenza_bando, "tzinfo", None)
        if scadenza_bando and scadenza_bando < datetime.now(scadenza_tz):
            if chiusura_procedimento_bando and (chiusura_procedimento_bando <
                                                datetime.now().date()):
                state = (
                    "closed",
                    translate(_(u"Closed"), context=self.request),
                )
            else:
                state = (
                    "inProgress",
                    translate(_(u"In progress"), context=self.request),
                )
        elif chiusura_procedimento_bando and (chiusura_procedimento_bando <
                                              datetime.now().date()):
            state = ("closed", translate(_(u"Closed"), context=self.request))
        return state
Пример #4
0
class EditForm(formhelper.EditForm):
    """Portlet edit form.

    This is registered with configure.zcml. The form_fields variable tells
    zope.formlib which fields to display.
    """

    schema = IBandoCollectionPortlet

    label = _(u"Edit Bandi Portlet")
    description = _(
        u"This portlet display a listing of bandi from a Collection.")
Пример #5
0
class AddForm(formhelper.AddForm):
    """Portlet add form.

    This is registered in configure.zcml. The form_fields variable tells
    zope.formlib which fields to display. The create() method actually
    constructs the assignment that is being added.
    """

    schema = IBandoCollectionPortlet

    label = _(u"Add Bandi Portlet")
    description = _(
        u"This portlet display a listing of bandi from a Collection.")

    def create(self, data):
        return Assignment(**data)
Пример #6
0
class IBandoSettings(Interface):
    """
    Settings used for announcements default value
    """

    default_ente = schema.Tuple(
        title=_(u"default_ente"),
        required=False,
        value_type=schema.TextLine(),
        missing_value=None,
        default=(u'Regione Emilia-Romagna',),
    )

    default_destinatari = schema.Tuple(
        title=_(u"default_destinatari_bandi"),
        required=False,
        value_type=schema.TextLine(),
        missing_value=None,
        default=(
            u'Cittadini|Cittadini',
            u'Imprese|Imprese',
            u'Enti locali|Enti locali',
            u'Associazioni|Associazioni',
            u'Altro|Altro',
        ),
    )

    tipologie_bando = schema.Tuple(
        title=_(u"Announcement types"),
        description=_(
            u"These values will extend bandi.xml vocabulary on filesystem"
        ),
        required=False,
        value_type=schema.TextLine(),
        missing_value=None,
        default=(
            u'beni_servizi|Acquisizione beni e servizi',
            u'agevolazioni|Agevolazioni, finanziamenti, contributi',
            u'altro|Altro',
        ),
    )
Пример #7
0
class View(BrowserView):

    display_name = _('bandi_layout', default='Layout Bandi')
Пример #8
0
class IBandoAgidSchema(IBandoSchema, IDesignPloneContentType):
    """A Dexterity schema for Annoucements"""

    # ridefinito, così usiamo il campo dei blocchi
    text = BlocksField(
        title=_("text_label", default="Testo"),
        description=_(
            "text_help",
            default="",
        ),
        required=False,
    )
    tipologia_bando = schema.Choice(
        title=_rtbando("tipologia_bando_label", default="Announcement type"),
        description=_rtbando("tipologia_bando_help", default=""),
        vocabulary="redturtle.bandi.tipologia.vocabulary",
        required=True,
    )
    destinatari = schema.List(
        title=_rtbando("destinatari_label", default="Recipients"),
        description=_rtbando("destinatari_help", default=""),
        required=False,
        value_type=schema.Choice(
            vocabulary="redturtle.bandi.destinatari.vocabulary"),
    )
    ente_bando = schema.Tuple(
        title=_rtbando("ente_label", default="Authority"),
        description=_rtbando("ente_help", default="Select some authorities."),
        required=False,
        defaultFactory=getDefaultEnte,
        value_type=schema.TextLine(),
        missing_value=None,
    )
    scadenza_domande_bando = schema.Datetime(
        title=_(
            "scadenza_domande_bando_label",
            default="Termine per le richieste di chiarimenti",
        ),
        description=_(
            "scadenza_domande_bando_help",
            default="Data entro la quale sarà possibile far pervenire domande"
            " e richieste di chiarimento a chi eroga il bando",
        ),
        required=False,
    )
    scadenza_bando = schema.Datetime(
        title=_rtbando("scadenza_bando_label",
                       default="Expiration date and time"),
        description=_rtbando(
            "scadenza_bando_help",
            default="Deadline to participate in the announcement",
        ),
        required=False,
    )

    chiusura_procedimento_bando = schema.Date(
        title=_rtbando(
            "chiusura_procedimento_bando_label",
            default="Closing date procedure",
        ),
        description=_rtbando("chiusura_procedimento_bando_help", default=""),
        required=False,
    )

    riferimenti_bando = BlocksField(
        title=_("riferimenti_bando_agid_label",
                default="Ulteriori informazioni"),
        description=_(
            "riferimenti_bando_agid_help",
            default="Ulteriori informazioni non previste negli altri campi;"
            " si può trattare di contatti o note informative la cui conoscenza"
            " è indispensabile per la partecipazione al bando",
        ),
        required=False,
    )

    ufficio_responsabile = RelationList(
        title=_(
            "ufficio_responsabile_bando_label",
            default="Ufficio responsabile del bando",
        ),
        description=_(
            "ufficio_responsabile_bando_help",
            default="Seleziona l'ufficio responsabile di questo bando.",
        ),
        required=False,
        default=[],
        value_type=RelationChoice(
            title=_("Ufficio responsabile"),
            vocabulary="plone.app.vocabularies.Catalog",
        ),
    )

    area_responsabile = RelationList(
        title=_(
            "area_responsabile_label",
            default="Area responsabile del documento",
        ),
        description=_(
            "area_responsabile_help",
            default="Seleziona l'area amministrativa responsabile del "
            "documento.",
        ),
        required=False,
        default=[],
        value_type=RelationChoice(title=_("Area"),
                                  vocabulary="plone.app.vocabularies.Catalog"),
    )

    # widgets
    directives.widget(
        "ente_bando",
        AjaxSelectFieldWidget,
        vocabulary="redturtle.bandi.enti.vocabulary",
    )
    directives.widget(destinatari=CheckBoxFieldWidget)
    directives.widget(tipologia_bando=RadioFieldWidget)
    form.widget(
        "ufficio_responsabile",
        RelatedItemsFieldWidget,
        vocabulary="plone.app.vocabularies.Catalog",
        pattern_options={
            "maximumSelectionSize": 1,
            "selectableTypes": ["UnitaOrganizzativa"],
        },
    )
    form.widget(
        "area_responsabile",
        RelatedItemsFieldWidget,
        vocabulary="plone.app.vocabularies.Catalog",
        pattern_options={
            "maximumSelectionSize": 1,
            "selectableTypes": ["UnitaOrganizzativa"],
        },
    )
    form.widget(
        "scadenza_domande_bando",
        DatetimeFieldWidget,
        default_timezone=default_timezone,
    )
    model.fieldset(
        "correlati",
        label=_("correlati_label", default="Contenuti collegati"),
        fields=["area_responsabile", "ufficio_responsabile"],
    )
Пример #9
0
class IBandoSchema(model.Schema):
    """ A Dexterity schema for Annoucements """

    # fields
    riferimenti_bando = RichText(
        title=_("riferimenti_bando_label", default=u"References"),
        description=_("riferimenti_bando_help", default=u""),
        required=False,
    )

    chiusura_procedimento_bando = schema.Date(
        title=_(
            "chiusura_procedimento_bando_label",
            default=u"Closing date procedure",
        ),
        description=_("chiusura_procedimento_bando_help", default=u""),
        required=False,
    )

    scadenza_bando = schema.Datetime(
        title=_("scadenza_bando_label", default=u"Expiration date and time"),
        description=_(
            "scadenza_bando_help",
            default=u"Deadline to participate in the announcement",
        ),
        required=False,
    )

    ente_bando = schema.Tuple(
        title=_(u"ente_label", default=u"Authority"),
        description=_(u"ente_help", default=u"Select some authorities."),
        required=False,
        defaultFactory=getDefaultEnte,
        value_type=schema.TextLine(),
        missing_value=None,
    )

    destinatari = schema.List(
        title=_("destinatari_label", default=u"Recipients"),
        description=_("destinatari_help", default=""),
        required=True,
        value_type=schema.Choice(
            vocabulary="redturtle.bandi.destinatari.vocabulary"),
    )

    tipologia_bando = schema.Choice(
        title=_("tipologia_bando_label", default=u"Announcement type"),
        description=_("tipologia_bando_help", default=""),
        vocabulary="redturtle.bandi.tipologia.vocabulary",
        required=True,
    )

    # order
    form.order_after(riferimenti_bando="IRichText.text")
    form.order_after(chiusura_procedimento_bando="IRichText.text")
    form.order_after(scadenza_bando="IRichText.text")
    form.order_after(ente_bando="IRichText.text")
    form.order_after(destinatari="IRichText.text")
    form.order_after(tipologia_bando="IRichText.text")

    #  widgets
    directives.widget(
        "ente_bando",
        AjaxSelectFieldWidget,
        vocabulary="redturtle.bandi.enti.vocabulary",
    )
    directives.widget(
        "chiusura_procedimento_bando",
        DateFieldWidget,
        default_timezone=default_timezone,
    )
    directives.widget(
        "scadenza_bando",
        DatetimeFieldWidget,
        default_timezone=default_timezone,
    )
    directives.widget(destinatari=CheckBoxFieldWidget)
    directives.widget(tipologia_bando=RadioFieldWidget)