示例#1
0
class IRelevantAceContentItemsTile(ISearchAceContentTile):

    show_share_btn = Bool(
        title=_(u"Show the share button"),
        default=False,
    )

    combine_results = Bool(
        title=_(u"Show listing results, in addition to assigned items"),
        default=False,
    )

    uuids = Dict(
        title=_(u"Elements"),
        key_type=TextLine(),
        value_type=Dict(
            key_type=TextLine(),
            value_type=TextLine(),
        ),
        required=False,
    )

    sortBy = Choice(
        title=_(u"Sort order for results and assigned items"),
        vocabulary=sortby_vocabulary,
    )

    form.omitted("uuids")
class ICaseStudy(IAceMeasure):
    """ Case study
    """
    # location - a clickable map, not provided if is "Adaptation option" type

    location_lat = Decimal(title=_(u"Location latitude"), required=True)
    location_lon = Decimal(title=_(u"Location longitude"), required=True)
示例#3
0
class IAceVideo(IAceItem):
    """Video schema"""

    embed_url = TextLine(title=_(u"Video URL"),
                         description=u"Enter the video URL",
                         required=True)

    video_height = TextLine(
        title=_(u"Video Height"),
        description=u"Enter the video height",
        required=False,
        default=u"480",
    )

    publication_date = Date(
        title=_(u"Date of video's release"),
        description=u"The date refers to the moment in which the video has "
        u"been released. Please use the Calendar icon to add day/month/year. "
        u"If you want to add only the year, please select \"day: 1\", "
        u"\"month: January\" and then the year",
        required=True,
    )

    related_documents_presentations = RichText(
        title=_(u"Related documents and presentations"),
        required=False,
        default=None)
示例#4
0
class IFormTile(IPersistentCoverTile):

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

    form_uuid = schema.TextLine(title=_(u'Form UUID'), required=True)
class IShareInfoTile(IPersistentCoverTile):

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

    shareinfo_type = schema.Choice(title=_(u"Share info type"),
                                   vocabulary="eea.climateadapt.cca_types",
                                   required=False)
示例#6
0
class IGenericViewTile(IPersistentCoverTile):

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

    view_name = schema.TextLine(
        title=_(u'View name'),
        required=True,
    )
示例#7
0
class ICountrySelectTile(IPersistentCoverTile):

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

    image_uuid = schema.TextLine(
        title=_(u'Image UUID'),
        required=False,
    )
示例#8
0
class IEnhancedPersonalPreferencesSchema(prefs.IPersonalPreferences):
    """ Use all the fields from the default user personal preferences schema,
        and add the thematic_sectors field.
    """
    thematic_sectors = List(
        title=_(u'Professional thematic domain'),
        description=_(u"Select the sectors for which you want to receive a "
                      u"notification email when an item is modified."),
        required=True,
        value_type=Choice(
            vocabulary=thematic_sectors))
示例#9
0
class IFilteringSchema(form.Schema):
    impact = Choice(
        title=_(u"Climate impact"),
        vocabulary="eea.climateadapt.aceitems_climateimpacts",
        required=False,
    )

    sector = Choice(
        title=_(u"Sector"),
        vocabulary="eea.climateadapt.aceitems_sectors",
        required=False,
    )
示例#10
0
class ICardsTile(IPersistentCoverTile):

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

    uuid = schema.TextLine(
        title=_(u"UUID"),
        required=False,
        readonly=True,
    )
示例#11
0
class ISectionNavTile(IPersistentCoverTile):

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

    uuid = schema.TextLine(
        title=_(u'UUID'),
        required=False,
        readonly=True,
    )
示例#12
0
class IASTHeaderTile(IPersistentCoverTile):

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

    step = schema.Int(
        title=_(u"AST Step"),
        required=True,
        default=1,
    )
示例#13
0
class IHealthObservatoryMetadata(model.Schema):
    model.fieldset(
        "health_inclusion",
        label=u"Inclusion in the Health Observatory",
        fields=["include_in_observatory", "health_impacts"],
    )

    include_in_observatory = Bool(title=_(u"Include in observatory"),
                                  required=False,
                                  default=False)
    health_impacts = List(
        title=_(u"Health impacts"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.health_impacts"),
    )
示例#14
0
class IRelevantAceContentItemsTile(ISearchAceContentTile):

    search_type = schema.Choice(
        title=_(u"Aceitem type"),
        vocabulary="eea.climateadapt.search_types_vocabulary",
        required=True)

    nr_items = schema.Int(
        title=_(u"Nr of items to show"),
        required=True,
        default=5,
    )

    show_share_btn = schema.Bool(
        title=_(u"Show the share button"),
        default=False,
    )
class IRichTextWithTitle(IRichTextTile):
    """
    """

    title = schema.TextLine(
        title=_(u'Title'),
        required=False,
    )
示例#16
0
class IIndicator(IAceItem):
    """ Indicator Interface"""

    # directives.omitted(IEditForm, 'year')
    # directives.omitted(IAddForm, 'year')
    directives.omitted(IEditForm, "featured")
    directives.omitted(IAddForm, "featured")

    map_graphs = Text(title=_(u"Map/Graphs"), required=False)

    publication_date = Date(
        title=_(u"Date of item's publication"),
        description=u"The date refers to the latest date of publication of "
        u"the item."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u"add only the year, please select \"day: 1\", \"month: January\" "
        u"and then the year",
        required=True,
    )
class IMapGraphDataset(IAceItem):
    """Maps, Graphs and Datasets Interface"""

    gis_layer_id = TextLine(
        title=_(u"GIS Layer ID"),
        description=u"Enter the layer id for the map-viewer "
        u"(250 character limit)",
        required=False,
        default=u"",
    )
示例#18
0
class IRichTextWithTitle(IRichTextTile):
    """
    """

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

    dont_strip = schema.Bool(
        title=_(u"Don't sanitize HTML"),
        description=_(u"Use with care!"),
        default=False,
    )

    title_level = schema.Choice(
        title=_(u"Change header style."),
        default="h1",
        vocabulary="eea.climateadapt.rich_header_level",
    )
示例#19
0
    def populate_with_uuids(self, uuids):
        """Add a list of elements to the list of items. This method will
        append new elements to the already existing list of items
        :param uuids: The list of objects' UUIDs to be used
        :type uuids: List of strings
        """

        if not self.isAllowedToEdit():
            raise Unauthorized(
                _("You are not allowed to add content to this tile"))
        # self.set_limit()
        data_mgr = ITileDataManager(self)

        old_data = data_mgr.get()

        if old_data["uuids"] is None:
            # If there is no content yet, just assign an empty dict
            old_data["uuids"] = dict()

        uuids_dict = old_data.get("uuids")

        if not isinstance(uuids_dict, dict):
            # Make sure this is a dict
            uuids_dict = old_data["uuids"] = dict()

        # if uuids_dict and len(uuids_dict) > self.limit:
        #     # Do not allow adding more objects than the defined limit
        #     return

        order_list = [
            int(val.get("order", 0)) for key, val in uuids_dict.items()
        ]

        if len(order_list) == 0:
            # First entry
            order = 0
        else:
            # Get last order position and increment 1
            order_list.sort()
            order = order_list.pop() + 1

        for uuid in uuids:
            if uuid not in uuids_dict.keys():
                entry = dict()
                entry[u"order"] = unicode(order)
                uuids_dict[uuid] = entry
                order += 1

        old_data["uuids"] = uuids_dict

        # Whenever we insert an (or rearange), remove the alpha sort
        old_data["sortBy"] = ""
        data_mgr.set(old_data)
示例#20
0
class ISearchAceContentTile(IPersistentCoverTile):

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

    search_text = schema.TextLine(
        title=_(u'Search Text'),
        required=False,
        default=u"",
    )

    element_type = schema.Choice(
        title=_(u"Element type"),
        vocabulary="eea.climateadapt.element_types_vocabulary",
        required=False)

    sector = schema.Choice(title=_(u"Sector"),
                           vocabulary="eea.climateadapt.aceitems_sectors",
                           required=False)

    special_tags = schema.List(
        title=_(u"Special tags"),
        required=False,
        value_type=schema.Choice(
            vocabulary="eea.climateadapt.special_tags_vocabulary"))

    countries = schema.List(
        title=_(u"Countries"),
        required=False,
        value_type=schema.Choice(vocabulary="eea.climateadapt.ace_countries"))
示例#21
0
class IAdaptationOption(IAceMeasure):
    """ Adaptation Option
    """

    directives.omitted(IEditForm, 'featured')
    directives.omitted(IAddForm, 'featured')

    # directives.omitted(IEditForm, 'year')
    # directives.omitted(IAddForm, 'year')

    form.widget(category="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    category = List(
        title=_(u"General category"),
        description=_(u"Select one or more categories of adaptation options. "
                      u"The 3 options are:"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_category",),
    )

    form.widget(ipcc_category="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    ipcc_category = List(
        title=_(u"IPCC adaptation options categories"),
        description=_(u"Select one or more categories of adaptation options. "
                      u"The options are:"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_ipcc_category",),
    )

    casestudies = RelationList(
        title=u"Case studies implemented in the adaption",
        default=[],
        description=_(u"Select one or more case study that this item "
                      u"relates to:"),
        value_type=RelationChoice(
            title=_(u"Related"),
            vocabulary="eea.climateadapt.case_studies"
            # source=ObjPathSourceBinder(),
            # source=CatalogSource(portal_type='eea.climateadapt.adaptionoption'),
        ),
        required=False,
    )

    publication_date = Date(
        title=_(u"Date of item's creation"),
        description=u"The date refers to the moment in which the item "
        u"has been prepared or  updated by contributing "
        u"experts to be submitted for the publication in "
        u"Climate ADAPT."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u"add only the year, please select \"day: 1\", \"month: January\" "
        u"and then the year",
        required=True
    )
 def replace_with_uuids(self, uuids):
     """ Replaces the whole list of items with a new list of items
     :param uuids: The list of objects' UUIDs to be used
     :type uuids: List of strings
     """
     if not self.isAllowedToEdit():
         raise Unauthorized(
             _('You are not allowed to add content to this tile'))
     data_mgr = ITileDataManager(self)
     old_data = data_mgr.get()
     # Clean old data
     old_data['uuids'] = dict()
     data_mgr.set(old_data)
     # Repopulate with clean list
     self.populate_with_uuids(uuids)
示例#23
0
    def replace_with_uuids(self, uuids):
        """Replaces the whole list of items with a new list of items
        :param uuids: The list of objects' UUIDs to be used
        :type uuids: List of strings
        """

        if not self.isAllowedToEdit():
            raise Unauthorized(
                _("You are not allowed to add content to this tile"))
        data_mgr = ITileDataManager(self)
        old_data = data_mgr.get()
        # Clean old data
        old_data["uuids"] = dict()
        data_mgr.set(old_data)
        # Repopulate with clean list
        self.populate_with_uuids(uuids)
    def populate_with_uuids(self, uuids):
        """ Add a list of elements to the list of items. This method will
        append new elements to the already existing list of items
        :param uuids: The list of objects' UUIDs to be used
        :type uuids: List of strings
        """
        if not self.isAllowedToEdit():
            raise Unauthorized(
                _('You are not allowed to add content to this tile'))
        #self.set_limit()
        data_mgr = ITileDataManager(self)

        old_data = data_mgr.get()
        if old_data['uuids'] is None:
            # If there is no content yet, just assign an empty dict
            old_data['uuids'] = dict()

        uuids_dict = old_data.get('uuids')
        if not isinstance(uuids_dict, dict):
            # Make sure this is a dict
            uuids_dict = old_data['uuids'] = dict()

        # if uuids_dict and len(uuids_dict) > self.limit:
        #     # Do not allow adding more objects than the defined limit
        #     return

        order_list = [int(val.get('order', 0))
                      for key, val in uuids_dict.items()]
        if len(order_list) == 0:
            # First entry
            order = 0
        else:
            # Get last order position and increment 1
            order_list.sort()
            order = order_list.pop() + 1

        for uuid in uuids:
            if uuid not in uuids_dict.keys():
                entry = dict()
                entry[u'order'] = unicode(order)
                uuids_dict[uuid] = entry
                order += 1

        old_data['uuids'] = uuids_dict
        data_mgr.set(old_data)
示例#25
0
class IPublicationReport(IAceItem):
    """Publication Report Interface"""

    # directives.omitted(IEditForm, 'year')
    # directives.omitted(IAddForm, 'year')
    directives.omitted(IEditForm, "featured")
    directives.omitted(IAddForm, "featured")

    publication_date = Date(
        title=_(u"Date of item's publication"),
        description=u"The date refers to the latest date of publication"
        u" of the item (different from the date of item's"
        u" publication in Climate ADAPT)."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u"add only the year, please select \"day: 1\", \"month: January\" "
        u"and then the year",
        required=True,
    )
示例#26
0
class IUrbanASTNavigationTile(IPersistentCoverTile):

    title = schema.TextLine(
        title=_(u'Title'),
        required=False,
    )
class IAceMeasure(form.Schema, IImageScaleTraversable):
    """
    Defines content-type schema for Ace Measure
    """

    # company - this is always liferay in the data
    # group - same value for all

    # title - Provided by behaviour. Imported value comes from name column
    title = TextLine(title=_(u"Title"), required=True)

    # description - Provided by behaviour. Imported value comes from
    #               description column
    dexteritytextindexer.searchable('long_description')
    long_description = RichText(title=_(u"description"), required=True)

    implementation_type = Choice(
        title=_(u"Implementation Type"), required=False, default=None,
        vocabulary="eea.climateadapt.acemeasure_implementationtype"
    )

    dexteritytextindexer.searchable('implementation_time')
    implementation_time = RichText(
        title=_(u"Implementation Time"), required=False, default=None,
    )

    dexteritytextindexer.searchable('challenges')
    challenges = RichText(
        title=_(u"Challenges"), required=False, default=None,
    )

    dexteritytextindexer.searchable('lifetime')
    lifetime = RichText(title=_(u"Lifetime"), required=False, default=u"")

    spatial_layer = TextLine(
        title=_(u"Spatial Layer"), required=False, default=u"")

    spatial_values = List(title=_(u"Countries"),
                          description=_(u"European countries"),
                          required=False,
                          value_type=Choice(
                              vocabulary="eea.climateadapt.ace_countries"))

    dexteritytextindexer.searchable('legal_aspects')
    legal_aspects = RichText(title=_(u"Legal aspects"),
                             required=False,
                             default=u"")

    dexteritytextindexer.searchable('stakeholder_participation')
    stakeholder_participation = RichText(
        title=_(u"Stakeholder participation"), required=False,
        default=u"")

    dexteritytextindexer.searchable('contact')
    contact = RichText(title=_(u"Contact"), required=False, default=u"")

    dexteritytextindexer.searchable('success_limitations')
    success_limitations = RichText(
        title=_(u"Success / limitations"), required=False, default=u"")

    dexteritytextindexer.searchable('cost_benefit')
    cost_benefit = RichText(
        title=_(u"Cost / Benefit"), required=False, default=u"")

    websites = List(title=_(u"Websites"),
                    description=_(u"A list of relevant website links"),
                    required=False,
                    value_type=URI(title=_("A link")),
                    )

    # keywords = List(title=_(u"Keywords"),
    #                description=_(u"Keywords related to the project"),
    #                required=False,
    #                value_type=TextLine(title=_(u"Tag"))
    # )

    keywords = RichText(title=_(u"Keywords"),
                   description=_(u"Keywords related to the project"),
                   required=False,
    )

    # TODO: startdate, enddate, publicationdate have no values in DB
    # TODO: specialtagging is not used in any view jsp, only in add and edit
    # views

    sectors = List(title=_(u"Sectors"),
                   description=_(u"TODO: Sectors description here"),
                   required=False,
                   value_type=Choice(
                       vocabulary="eea.climateadapt.aceitems_sectors",),
                   )

    elements = List(title=_(u"Elements"),
                    description=_(u"TODO: Elements description here"),
                    required=False,
                    value_type=Choice(
                        vocabulary="eea.climateadapt.aceitems_elements",),
                    )

    climate_impacts = List(
        title=_(u"Climate impacts"),
        description=_(u"TODO: Climate impacts description here"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_climateimpacts",),
    )

    dexteritytextindexer.searchable('source')
    source = RichText(title=_(u"Source"), required=True,)
    # TODO: special tagging implement as related

    geochars = Text(title=_(u"Geographic characterization"),
                    required=False, default=u"")

    measure_type = Choice(title=_(u"Measure Type"),
                          required=True,
                          default="A",
                          vocabulary="eea.climateadapt.acemeasure_types")

    comments = TextLine(title=_(u"Comments"), required=False, default=u"")

    important = Bool(title=_(u"High importance"), required=False,
                     default=False)

    rating = Int(title=_(u"Rating"), required=True, default=0)

    dexteritytextindexer.searchable('objectives')
    objectives = RichText(title=_(u"Objectives"), required=False, default=u"")

    dexteritytextindexer.searchable('solutions')
    solutions = RichText(title=_(u"Solutions"), required=False, default=u"")

    adaptationoptions = List(
        title=_(u"Adaptation Options"),
        required=False,
        value_type=Int(),   # TODO:  leave it like that, until we figure it out
    )   # TODO: reimplement as list
    relevance = List(
        title=_(u"Relevance"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_relevance",),
        )
    primephoto = RelationChoice(
        title=_(u"Prime photo"),
        source=ObjPathSourceBinder(object_provides=IImage.__identifier__),
        required=False,
    )
    supphotos = RelationList(
        title=u"Gallery",
        default=[],
        value_type=RelationChoice(
            title=_(u"Related"),
            source=ObjPathSourceBinder(
                object_provides=IImage.__identifier__)
            ),
        required=False,
    )
示例#28
0
class IUrbanMenuTile(IPersistentCoverTile):

    title = schema.TextLine(
        title=_(u'Title'),
        required=False,
    )
示例#29
0
class IAceMeasure(form.Schema, IImageScaleTraversable):
    """
    Defines content-type schema for Ace Measure
    """

    dexteritytextindexer.searchable("challenges")
    dexteritytextindexer.searchable("climate_impacts")
    dexteritytextindexer.searchable("contact")
    dexteritytextindexer.searchable("cost_benefit")
    dexteritytextindexer.searchable("geochars")
    dexteritytextindexer.searchable("implementation_time")
    dexteritytextindexer.searchable("important")
    dexteritytextindexer.searchable("keywords")
    dexteritytextindexer.searchable("legal_aspects")
    dexteritytextindexer.searchable("lifetime")
    dexteritytextindexer.searchable("long_description")
    dexteritytextindexer.searchable("description")
    dexteritytextindexer.searchable("measure_type")
    dexteritytextindexer.searchable("objectives")
    dexteritytextindexer.searchable("sectors")
    dexteritytextindexer.searchable("solutions")
    dexteritytextindexer.searchable("source")
    dexteritytextindexer.searchable("spatial_layer")
    dexteritytextindexer.searchable("spatial_values")
    dexteritytextindexer.searchable("special_tags")
    dexteritytextindexer.searchable("stakeholder_participation")
    dexteritytextindexer.searchable("success_limitations")
    dexteritytextindexer.searchable("title")
    dexteritytextindexer.searchable("websites")
    # dexteritytextindexer.searchable('year')
    dexteritytextindexer.searchable("publication_date")

    form.fieldset(
        "default",
        label=u"Item Description",
        fields=[
            "publication_date",
            "title",
            "long_description",
            "description",
            "climate_impacts",
            "keywords",
            "sectors",
            "featured",  # 'year',
        ],
    )

    form.fieldset(
        "additional_details",
        label=u"Additional Details",
        fields=[
            "stakeholder_participation",
            "success_limitations",
            "cost_benefit",
            "legal_aspects",
            "implementation_time",
            "lifetime",
        ],
    )

    # form.fieldset('inclusion_health_observatory',
    #              label=u'Inclusion in health observatory',
    #              fields=['include_in_observatory', 'health_impacts']
    #              )

    form.fieldset(
        "reference_information",
        label=u"Reference information",
        fields=["websites", "source", "special_tags",
                "comments"],  # 'contact',
    )

    # richtext fields in database:
    # set(['legalaspects', 'implementationtime', 'description', 'source',
    # 'objectives', 'stakeholderparticipation', 'admincomment', 'comments',
    # 'challenges', 'keywords', 'contact', 'solutions', 'costbenefit',
    # 'succeslimitations', 'lifetime'])

    form.fieldset(
        "geographic_information",
        label=u"Geographic Information",
        fields=["governance_level", "geochars"],
    )

    form.fieldset(
        "categorization",
        label=u"Inclusion in the Health Observatory",
        fields=["include_in_observatory", "health_impacts"],
    )

    # -----------[ "default" fields ]------------------

    title = TextLine(
        title=_(u"Title"),
        description=_(u"Name of the case study clearly "
                      u"identifying its scope and location "
                      u"(250 character limit)"),
        required=True,
    )

    long_description = RichText(
        title=_(u"Description"),
        required=True,
    )

    description = Text(
        title=_(u"Short summary"),
        required=False,
        description=u"Enter a short summary that will be used in listings.",
    )

    form.widget(
        climate_impacts="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    climate_impacts = List(
        title=_(u"Climate impacts"),
        missing_value=[],
        default=None,
        description=_(u"Select one or more climate change impact topics that "
                      u"this item relates to:"),
        required=True,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_climateimpacts", ),
    )

    keywords = Tuple(
        title=_(u"Keywords"),
        description=_(u"Describe and tag this item with relevant keywords. "
                      u"Press Enter after writing your keyword. "
                      u"Use specific and not general key words (e.g. avoid "
                      u"words as: adaption, climate change, measure, "
                      u"integrated approach, etc.):"),
        required=False,
        value_type=TextLine(),
        missing_value=(None),
    )

    form.widget(sectors="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    sectors = List(
        title=_(u"Sectors"),
        description=_(u"Select one or more relevant sector policies"
                      u" that this item relates to:"),
        required=True,
        missing_value=[],
        default=None,
        value_type=Choice(vocabulary="eea.climateadapt.aceitems_sectors", ),
    )

    # year = Year(title=_(u"Year"),
    # description=u"Date of publication/release/update of the items "
    # u"related source",
    # required=False,)

    publication_date = Date(
        title=_(u"Date of item's creation"),
        description=u"The date refers to the moment in which the item "
        u"has been prepared by contributing expeerts to be "
        u"submitted for the publication in Climate "
        u"ADAPTPublication/last update date."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u'add only the year, please select "day: 1", "month: January" '
        u"and then the year",
        required=True,
    )

    featured = Bool(
        title=_(u"Featured"),
        description=u"Feature in search and Case Study Search Tool",
        required=False,
        default=False,
    )

    # -----------[ "additional_details" fields ]------------------

    dexteritytextindexer.searchable("stakeholder_participation")
    stakeholder_participation = RichText(
        title=_(u"Stakeholder participation"),
        required=False,
        default=u"",
        description=_(u"Describe the Information about actors involved, the "
                      u"form of participation and the participation process. "
                      u" Focus should be on the level of participation needed "
                      u"and/or adopted already (from information, to full "
                      u"commitment in the deliberation/implementation "
                      u"process), with useful notes e.g. regarding "
                      u"motivations. (5,000 character limit)"),
    )

    dexteritytextindexer.searchable("success_limitations")
    success_limitations = RichText(
        title=_(u"Success / limitations"),
        required=False,
        default=u"",
        description=_(u"Describe factors that are decisive for a successful "
                      u"implementation and expected challenges or limiting "
                      u"factors which may hinder the process and need to be "
                      u"considered (5,000 character limit)"),
    )

    dexteritytextindexer.searchable("cost_benefit")
    cost_benefit = RichText(
        title=_(u"Cost / Benefit"),
        required=False,
        default=u"",
        description=_(u"Describe costs (possibly providing quantitative "
                      u"estimate) and funding sources. Describe benefits "
                      u"provided by implemented solutions, i.e.: positive "
                      u"outcomes related climate change adaptation, "
                      u"co-benefits in other areas, quantitative estimation "
                      u"of benefits and related methodologies (e.g. "
                      u"monetization of benefits for cost benefit analysis, "
                      u"indicators of effectiveness of actions implemented, "
                      u"etc.) (5,000 characters limit)"),
    )

    dexteritytextindexer.searchable("legal_aspects")
    legal_aspects = RichText(
        title=_(u"Legal aspects"),
        required=False,
        default=u"",
        description=_(u"Describe the Legislation "
                      u"framework from which the case "
                      u"originated, relevant institutional"
                      u" opportunities and constrains, "
                      u"which determined the case as it "
                      u"is (5000 character limit):"),
    )

    dexteritytextindexer.searchable("implementation_time")
    implementation_time = RichText(
        title=_(u"Implementation Time"),
        required=False,
        default=None,
        description=_(u"Describe the time needed to implement the measure. "
                      u"Include: Time frame, e.g. 5-10 years, Brief "
                      u"explanation(250 char limit)"),
    )

    dexteritytextindexer.searchable("lifetime")
    lifetime = RichText(
        title=_(u"Lifetime"),
        required=False,
        default=u"",
        description=u"Describe the lifetime of the measure: "
        u"Time frame, e.g. 5-10 years, Brief explanation "
        u"(250 char limit)",
    )

    # -----------[ "reference_information" fields ]------------------

    directives.widget("websites", TextLinesWidget)
    websites = Tuple(
        title=_(u"Websites"),
        description=_(u"List the Websites where the option can be found"
                      u" or is described. Note: may refer to the original "
                      u"document describing a measure and does not have to "
                      u"refer back to the project e.g. collected measures. "
                      u"NOTE: Add http:// in front of every website link."),
        required=False,
        value_type=URI(),
        missing_value=(),
    )

    dexteritytextindexer.searchable("source")
    source = RichText(
        title=_(u"References"),
        required=False,
        description=_(
            u"Describe the references (projects, a tools reports, etc.) "
            u"related to this item, providing further information about "
            u"it or its source."),
    )

    # -----------[ "geographic_information" fields ]------------------

    form.widget(
        governance_level="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    governance_level = List(
        title=_(u"Governance Level"),
        description=_(u"Select the one governance level that relates to this "
                      u"adaptation option"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_governancelevel", ),
    )

    form.widget(geochars="eea.climateadapt.widgets.geochar.GeoCharFieldWidget")
    geochars = Text(
        title=_(u"Geographic characterisation"),
        required=True,
        default=u"""{
                    "geoElements":{"element":"GLOBAL",
                    "macrotrans":null,"biotrans":null,"countries":[],
                    "subnational":[],"city":""}}""",
        description=u"Select the characterisation for this item",
    )

    comments = Text(
        title=_(u"Comments"),
        required=False,
        default=u"",
        description=_(u"Comments about this database item "
                      u"[information entered below will not be "
                      u"displayed on the public pages of "
                      u"climate-adapt]"),
    )

    origin_website = List(
        title=_(u"Item from third parties"),
        description=_(u"Used only to highlight items "
                      u"provided by Third parties. "
                      u"<br>Please don't compile "
                      u"this field if you are a Climate-ADAPT expert "
                      u"creating a new item."),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.origin_website"),
    )

    logo = NamedBlobImage(
        title=_(u"Logo"),
        description=_(
            u"Upload a representative picture or logo for the item."
            u" Recommended size: at least 360/180 px, aspect ratio 2x"),
        required=False,
    )

    image = NamedBlobImage(
        title=_(u"Thumbnail"),
        description=_(
            u"Upload a representative picture or logo for the item. "
            u"Recommended size: at least 360/180 px, aspect ratio 2x. "
            u"This image will be used in the search result page - cards view. "
            u"If this image doesn't exist, then the logo image will be used."),
        required=False,
    )

    contributor_list = RelationList(
        title=u"Contributor(s)",
        default=[],
        description=_(u"Select from the Climate ADAPT Organisation items the "
                      u"organisations contributing to/ involved in this item"),
        value_type=RelationChoice(
            title=_(u"Related"),
            vocabulary="eea.climateadapt.organisations"
            # source=ObjPathSourceBinder(),
            # source=CatalogSource(portal_type='eea.climateadapt.adaptionoption'),
        ),
        required=False,
    )

    # TODO: this will be a widget
    other_contributor = Text(
        title=_(u"Other contributor(s)"),
        required=False,
        default=u"",
        description=_(u"Please first verify if the contributor is "
                      u"already part of the Climate ADAPT Database."
                      u" If not, it is suggested to first create a "
                      u"new Organisation item (%s). As last"
                      u" alternative please add the new "
                      u"contributor(s) in the following box, using "
                      u"the official name" % ADD_ORGANISATION_URL),
    )

    # -----------[ "omitted" fields ]------------------

    # for name in [
    #         'implementation_type',
    #         'spatial_layer',
    #         'spatial_values',
    #         'elements',
    #         'measure_type',
    #         'important',
    #         'rating',
    #         'modification_date',
    #         'creation_date',
    #         'id'
    # ]:
    #     directives.omitted(IEditForm, name)
    #     directives.omitted(IAddForm, name)

    directives.omitted(IEditForm, "implementation_type")
    directives.omitted(IAddForm, "implementation_type")
    directives.omitted(IEditForm, "spatial_layer")
    directives.omitted(IAddForm, "spatial_layer")
    directives.omitted(IEditForm, "spatial_values")
    directives.omitted(IAddForm, "spatial_values")
    directives.omitted(IEditForm, "elements")
    directives.omitted(IAddForm, "elements")
    directives.omitted(IEditForm, "measure_type")
    directives.omitted(IAddForm, "measure_type")
    directives.omitted(IEditForm, "important")
    directives.omitted(IAddForm, "important")
    directives.omitted(IEditForm, "rating")
    directives.omitted(IAddForm, "rating")
    directives.omitted(IAddForm, "modification_date")
    directives.omitted(IEditForm, "modification_date")
    directives.omitted(IAddForm, "creation_date")
    directives.omitted(IEditForm, "creation_date")
    directives.omitted(IAddForm, "id")
    directives.omitted(IEditForm, "id")
    # end

    implementation_type = Choice(
        title=_(u"Implementation Type"),
        required=False,
        default=None,
        vocabulary="eea.climateadapt.acemeasure_implementationtype",
    )

    spatial_layer = TextLine(title=_(u"Spatial Layer"),
                             required=False,
                             default=u"")

    spatial_values = List(
        title=_(u"Countries"),
        description=_(u"European countries"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.ace_countries"),
    )

    # TODO: startdate, enddate, publicationdate have no values in DB
    # TODO: specialtagging is not used in any view jsp, only in add and edit
    # views

    form.widget(elements="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    elements = List(
        title=_(u"Elements"),
        description=_(u"TODO: Elements description here"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.aceitems_elements", ),
    )

    measure_type = Choice(
        title=_(u"Measure Type"),
        required=True,
        default="A",
        vocabulary="eea.climateadapt.acemeasure_types",
    )

    health_impacts = List(
        title=_(u"Health impacts"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.health_impacts"),
    )

    include_in_observatory = Bool(title=_(u"Include in observatory"),
                                  required=False,
                                  default=False)

    important = Bool(title=_(u"High importance"),
                     required=False,
                     default=False)

    rating = Int(title=_(u"Rating"), required=True, default=0)

    special_tags = Tuple(
        title=_(u"Special tagging"),
        description=_(
            u"Used only by Climate-ADAPT administrator. Please don't "
            u"compile this field if you are a Climate-ADAPT expert creating a new "
            u"item."),
        required=False,
        value_type=TextLine(),
        missing_value=(None),
    )

    creation_date = Datetime(
        title=_(u"Created"),
        required=False,
    )

    modification_date = Datetime(
        title=_(u"Last Modified"),
        required=False,
    )

    id = TextLine(
        title=_(u"Object ID"),
        required=False,
    )

    publication_date = Date(
        title=_(u"Date of item's creation"),
        description=u"The date refers to the moment in which the item "
        u"has been prepared or  updated by contributing "
        u"experts to be submitted for the publication in "
        u"Climate ADAPT."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u'add only the year, please select "day: 1", "month: January" '
        u"and then the year",
        required=True,
    )
示例#30
0
class IAceProject(form.Schema, IImageScaleTraversable):
    """
    Defines content-type schema for Ace Project
    """

    dexteritytextindexer.searchable("acronym")
    dexteritytextindexer.searchable("title")
    dexteritytextindexer.searchable("lead")
    dexteritytextindexer.searchable("partners")
    dexteritytextindexer.searchable("keywords")
    dexteritytextindexer.searchable("sectors")
    dexteritytextindexer.searchable("climate_impacts")
    dexteritytextindexer.searchable("elements")
    dexteritytextindexer.searchable("funding")
    dexteritytextindexer.searchable("duration")

    dexteritytextindexer.searchable("websites")
    dexteritytextindexer.searchable("source")

    dexteritytextindexer.searchable("geochars")

    # dexteritytextindexer.searchable('specialtagging')
    dexteritytextindexer.searchable("special_tags")
    dexteritytextindexer.searchable("important")
    dexteritytextindexer.searchable("spatial_layer")
    dexteritytextindexer.searchable("spatial_values")

    form.fieldset(
        "default",
        label=u"Item Description",
        fields=[
            "acronym",
            "title",
            "lead",
            "long_description",
            "partners",
            "keywords",
            "sectors",
            "climate_impacts",
            "elements",
            "funding",
            "funding_programme",
            "duration",
            "featured",
        ],
    )

    form.fieldset(
        "reference_information",
        label=u"Reference information",
        fields=["websites", "source", "special_tags", "partners_source_link"],
    )

    form.fieldset(
        "geographic_information",
        label=u"Geographic Information",
        fields=["geochars", "comments"],
    )

    form.fieldset(
        "categorization",
        label=u"Inclusion in the Health Observatory",
        fields=["include_in_observatory", "health_impacts"],
    )

    # -----------[ "default" fields ]------------------

    # These fields are richtext in the db:
    # set(['keywords', 'partners', 'admincomment', 'abstracts', 'source'])
    origin_website = List(
        title=_(u"Item from third parties"),
        description=_(u"Used only to highlight items "
                      u"provided by Third parties."
                      u"<br>Please don't compile "
                      u"this field if you are a Climate-ADAPT expert "
                      u"creating a new item."),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.origin_website"),
    )
    logo = NamedBlobImage(
        title=_(u"Logo"),
        description=_(
            u"Upload a representative picture or logo for the item."
            u" Recommended size: at least 360/180 px, aspect ratio 2x"),
        required=False,
    )

    image = NamedBlobImage(
        title=_(u"Thumbnail"),
        description=_(
            u"Upload a representative picture or logo for the item. "
            u"Recommended size: at least 360/180 px, aspect ratio 2x. "
            u"This image will be used in the search result page - cards view. "
            u"If this image doesn't exist, then the logo image will be used."),
        required=False,
    )

    contributor_list = RelationList(
        title=u"Contributor(s)",
        default=[],
        description=_(u"Select from the Climate ADAPT Organisation items the "
                      u"organisations contributing to/ involved in this item"),
        value_type=RelationChoice(
            title=_(u"Related"),
            vocabulary="eea.climateadapt.organisations"
            # source=ObjPathSourceBinder(),
            # source=CatalogSource(portal_type='eea.climateadapt.adaptionoption'),
        ),
        required=False,
    )

    funding_programme = Choice(
        title=_(u"Funding Programme"),
        required=False,
        # value_type = Choice(
        vocabulary="eea.climateadapt.funding_programme"
        #    )
    )

    acronym = TextLine(
        title=_(u"Acronym"),
        description=_(u"Acronym of the project"),
        required=True,
    )

    title = TextLine(
        title=_(u"Title"),
        description=_(u"Project title or name"),
        required=True,
    )

    dexteritytextindexer.searchable("long_description")
    long_description = RichText(
        title=_(u"Abstracts"),
        description=_(u"Provide information focusing on project output. "
                      u"Possibly on specific Website features."),
        required=True,
    )

    lead = TextLine(
        title=_(u"Lead"),
        description=_(u"Lead organisation or individual of the project"),
        required=True,
    )

    dexteritytextindexer.searchable("partners")
    partners = RichText(
        title=_(u"Partners"),
        description=_(u"Provide information about project partners "
                      u"(organisation names)."),
        required=True,
    )

    dexteritytextindexer.searchable("keywords")
    keywords = Tuple(
        title=_(u"Keywords"),
        description=_(u"Provide Keywords related to the project. "
                      u"Press Enter after writing your keyword."),
        required=False,
        value_type=TextLine(),
        missing_value=(None),
    )

    health_impacts = List(
        title=_(u"Health impacts"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.health_impacts"),
    )

    publication_date = Date(
        title=_(u"Date of item's creation"),
        description=u"The date refers to the moment in which the item "
        u"has been prepared by contributing expeerts to be "
        u"submitted for the publication in Climate "
        u"ADAPTPublication/last update date."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u'add only the year, please select "day: 1", "month: January" '
        u"and then the year",
        required=True,
    )

    include_in_observatory = Bool(title=_(u"Include in observatory"),
                                  required=False,
                                  default=False)

    form.widget(sectors="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    sectors = List(
        title=_(u"Sectors"),
        description=_(u"Select one or more relevant sector policies that "
                      u"this item relates to."),
        required=True,
        missing_value=[],
        default=None,
        value_type=Choice(vocabulary="eea.climateadapt.aceitems_sectors", ),
    )

    form.widget(
        climate_impacts="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    climate_impacts = List(
        title=_(u"Climate impacts"),
        description=_(u"Select one or more climate change impact topics that "
                      u"this item relates to."),
        missing_value=[],
        default=None,
        required=True,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_climateimpacts", ),
    )

    form.widget(elements="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    elements = List(
        title=_(u"Elements"),
        description=_(u"Select one or more elements."),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.aceitems_elements", ),
    )

    funding = TextLine(
        title=_(u"Further information on the funding"),
        description=_(u"Provide source of funding"),
        required=False,
    )

    duration = TextLine(
        title=_(u"Duration"),
        description=_(
            u"Provide duration of project - Start and end date [yr]"),
        required=False,
    )

    featured = Bool(
        title=_(u"Featured"),
        required=False,
        default=False,
    )

    # -----------[ "reference_information" fields ]------------------
    directives.widget("websites", TextLinesWidget)
    websites = Tuple(
        title=_(u"Websites"),
        description=_(u"List the Websites where the item can be found or is "
                      u"described. Please place each website on a new line"),
        required=False,
        value_type=URI(),
        missing_value=(),
    )

    dexteritytextindexer.searchable("source")
    source = TextLine(
        title=_(u"Reference"),
        description=_(u"Provide source from which project was retrieved (e.g. "
                      u"specific DB) "),
        required=False,
    )

    # -----------[ "geographic_information" fields ]------------------
    form.widget(geochars="eea.climateadapt.widgets.geochar.GeoCharFieldWidget")
    geochars = Text(
        title=_(u"Geographic characterisation"),
        required=True,
        default=unicode(json.dumps(GEOCHARS)),
        description=u"Select the characterisation for this item",
    )

    comments = Text(
        title=_(u"Source"),
        description=_(u"Comments about this database item [information entered"
                      u" below will not be displayed on the public pages of "
                      u"climate-adapt]"),
        required=False,
    )

    # -----------[ "omitted" fields ]------------------

    directives.omitted(IEditForm, "specialtagging")
    directives.omitted(IAddForm, "specialtagging")
    # directives.omitted(IEditForm, 'special_tags')
    # directives.omitted(IAddForm, 'special_tags')
    directives.omitted(IEditForm, "important")
    directives.omitted(IAddForm, "important")
    directives.omitted(IEditForm, "rating")
    directives.omitted(IAddForm, "rating")
    directives.omitted(IEditForm, "spatial_layer")
    directives.omitted(IAddForm, "spatial_layer")
    directives.omitted(IEditForm, "spatial_values")
    directives.omitted(IAddForm, "spatial_values")
    directives.omitted(IAddForm, "modification_date")
    directives.omitted(IEditForm, "modification_date")
    directives.omitted(IAddForm, "creation_date")
    directives.omitted(IEditForm, "creation_date")
    directives.omitted(IAddForm, "id")
    directives.omitted(IEditForm, "id")

    # end

    creation_date = Datetime(
        title=_(u"Created"),
        required=False,
    )

    modification_date = Datetime(
        title=_(u"Last Modified"),
        required=False,
    )

    id = TextLine(
        title=_(u"Object ID"),
        required=False,
    )

    specialtagging = TextLine(
        title=_(u"Special Tagging"),
        description=
        _(u"Used only by Climate-ADAPT administrator. Please don't compile this field if you are a Climate-ADAPT expert creating a new item"
          ),
        required=False,
    )

    # special_tags = TextLine(
    #     title=_(u"Special Tagging"),
    #     description=_(u"Special tags that allow for linking the item"),
    #     required=False,
    #     )

    special_tags = Tuple(
        title=_(u"Special tagging"),
        description=_(
            u"Used only by Climate-ADAPT administrator. Please don't "
            u"compile this field if you are a Climate-ADAPT expert creating a new "
            u"item."),
        required=False,
        value_type=TextLine(),
        missing_value=(None),
    )

    important = Bool(
        title=_(u"Important"),
        required=False,
        default=False,
    )

    rating = Int(title=_(u"Rating"), required=True, default=0)

    spatial_layer = TextLine(
        title=_(u"Spatial Layer"),
        required=False,
        default=u"",
    )

    spatial_values = List(
        title=_(u"Countries"),
        description=_(u"European countries"),
        required=False,
        value_type=Choice(vocabulary="eea.climateadapt.ace_countries"),
    )

    partners_source_link = URI(
        title=_(u"Partners Source Link"),
        description=(u"Provide URL from project partners"),
        required=False,
    )
class ITransRegionalSelectTile(IPersistentCoverTile):

    title = schema.TextLine(
        title=_(u'Title'),
        required=False,
    )
示例#32
0
class ICaseStudy(IAceMeasure):  # , IGeolocatable):
    """Case study"""

    directives.omitted(IEditForm, "featured")
    directives.omitted(IAddForm, "featured")
    directives.omitted(IEditForm, "primephoto")
    directives.omitted(IAddForm, "primephoto")
    directives.omitted(IEditForm, "supphotos")
    directives.omitted(IAddForm, "supphotos")

    # directives.omitted(IEditForm, 'year')
    # directives.omitted(IAddForm, 'year')
    # directives.omitted(IEditForm, 'relatedItems')
    # directives.omitted(IAddForm, 'relatedItems')

    challenges = RichText(
        title=_(u"Challenges"),
        required=True,
        default=None,
        description=_(
            u"Describe what are the main climate change "
            u"impacts/risks and related challenges addressed by the "
            u"adaptation solutions proposed by the case study. "
            u"Possibly include quantitate scenarios/projections of "
            u"future climate change considered by the case study "
            u"(5,000 characters limit):"
        ),
    )

    objectives = RichText(
        title=_(u"Objectives"),
        required=True,
        default=None,
        description=_(
            u"Describe the objectives which triggered the "
            u"adaptation measures (5,000 characters limit):"
        ),
    )

    solutions = RichText(
        title=_(u"Solutions"),
        required=True,
        default=None,
        description=_(
            u"Describe the climate change adaptation solution(s) "
            u"implemented (5,000 characters limit):"
        ),
    )

    form.widget(relevance="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    relevance = List(
        title=_(u"Relevance"),
        required=True,
        missing_value=[],
        default=None,
        description=_(
            u"Select only one category below that best describes "
            u"how relevant this case study is to climate change "
            u"adaptation:"
        ),
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_relevance",
        ),
    )

    contact = RichText(
        title=_(u"Contact"),
        required=True,
        default=u"",
        description=_(
            u"Contact of reference (institution and persons) who is "
            u"directly involved in the development and "
            u"implementation of the case. (500 char limit) "
        ),
    )

    adaptationoptions = RelationList(
        title=u"Adaptation measures implemented in the case:",
        default=[],
        description=_(
            u"Select one or more adaptation options that this item " u"relates to:"
        ),
        value_type=RelationChoice(
            title=_(u"Related"),
            vocabulary="eea.climateadapt.adaptation_options"
            # source=ObjPathSourceBinder(),
            # source=CatalogSource(portal_type='eea.climateadapt.adaptionoption'),
        ),
        required=False,
    )

    primary_photo = NamedBlobImage(
        title=_(u"Primary photo"),
        required=False,
    )

    primary_photo_copyright = TextLine(
        title=_(u"Primary Photo Copyright"),
        required=False,
        default=u"",
        description=_(
            u"Copyright statement or other rights information for  "
            u"the primary photo."
        ),
    )

    # BBB fields, only used during migration
    primephoto = RelationChoice(
        title=_(u"Prime photo"),
        source=ObjPathSourceBinder(object_provides=IImage.__identifier__),
        required=False,
    )
    supphotos = RelationList(
        title=u"Gallery",
        default=[],
        value_type=RelationChoice(
            title=_(u"Related"),
            source=ObjPathSourceBinder(object_provides=IImage.__identifier__),
        ),
        required=False,
    )