Exemplo n.º 1
0
    def action_infomrations(self, action, context, request=None, **args):
        action_id = action.behavior_id
        view_title = action.title
        view = DEFAULTMAPPING_ACTIONS_VIEWS.get(action._class_, None)
        if view:
            view_title = getattr(view, 'title', view_title)

        action_oid = 'start'
        context_oid = get_oid(context)
        try:
            action_oid = get_oid(action)
        except Exception:
            pass

        action_id = action_id + str(action_oid) + '_' + str(context_oid)
        if action_oid == 'start':
            after_url = self.afterexecution_viewurl(
                request=request,
                isstart=True,
                context_uid=str(context_oid),
                pd_id=action.node.process.id,
                action_id=action.node.__name__,
                behavior_id=action.behavior_id)
            actionurl_update = self.updateaction_viewurl(
                request=request,
                isstart=True,
                context_uid=str(context_oid),
                pd_id=action.node.process.id,
                action_id=action.node.__name__,
                behavior_id=action.behavior_id)
        else:
            after_url = self.afterexecution_viewurl(
                request=request,
                action_uid=str(action_oid),
                context_uid=str(context_oid))
            actionurl_update = self.updateaction_viewurl(
                request=request,
                action_uid=str(action_oid),
                context_uid=str(context_oid))

        informations = {}
        informations.update({'action': action,
                             'action_id': action_id,
                             'actionurl_update': actionurl_update,
                             'actionurl_after': after_url,
                             'view_title': view_title
                             })

        return informations
Exemplo n.º 2
0
        filter_data['filter_message'] = self.title
        filter_body = self.filter_instance.get_body(filter_data)
        result_body, result = render_listing_objs(self.request,
                                                  batch,
                                                  user,
                                                  display_state=getattr(
                                                      self, 'display_state',
                                                      True))
        if filter_form:
            result = merge_dicts(
                {
                    'css_links': filter_form['css_links'],
                    'js_links': filter_form['js_links']
                }, result)

        values = {
            'bodies': result_body,
            'batch': batch,
            'filter_body': filter_body,
            'sort_body': sort_body
        }
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update({SeeMyContents: SeeMyContentsView})

FILTER_SOURCES.update({SeeMyContentsView.name: SeeMyContentsView})
Exemplo n.º 3
0
    viewid = 'unpincommentform'
    validate_behaviors = False

    def before_update(self):
        self.action = self.request.resource_url(
            self.context, 'novaideoapi',
            query={'op': 'update_action_view',
                   'node_id': Unpin.node_definition.id})
        formwidget = deform.widget.FormWidget(css_class='comment-un-pin-form deform')
        formwidget.template = 'novaideo:views/templates/ajax_form.pt'
        self.schema.widget = formwidget


@view_config(
    name='unpincomment',
    context=Comment,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class UnpinView(MultipleView):
    title = _('Unpin comment')
    name = 'unpincomment'
    behaviors = [Unpin]
    viewid = 'unpincomment'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (UnpinViewStudyReport, UnpinForm)
    validators = [Unpin.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {Unpin: UnpinView})
Exemplo n.º 4
0
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


class RemoveOrganizationView(FormView):
    title = _('Remove')
    name = 'removeorganizationform'
    formid = 'formremoveorganization'
    behaviors = [RemoveOrganization, Cancel]
    validate_behaviors = False


@view_config(
    name='removeorganization',
    context=Organization,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class RemoveOrganizationViewMultipleView(MultipleView):
    title = _('Remove the organization')
    name = 'removeorganization'
    viewid = 'removeorganization'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    views = (RemoveOrganizationViewStudyReport, RemoveOrganizationView)
    validators = [RemoveOrganization.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {RemoveOrganization: RemoveOrganizationViewMultipleView})
    EditPeriodicAdvertising)
from lac.content.periodic_advertising import (
    PeriodicAdvertisingSchema, PeriodicAdvertising)
from lac import _


@view_config(
    name='editperiodicadvertising',
    context=PeriodicAdvertising,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class EditPeriodicAdvertisingView(FormView):

    title = _('Edit the periodical advertisement')
    schema = select(PeriodicAdvertisingSchema(factory=PeriodicAdvertising,
                                              editable=True),
                    ['title', 'visibility_dates',
                     'picture', 'format', 'position',
                     'request_quotation'])
    behaviors = [EditPeriodicAdvertising, Cancel]
    formid = 'formeditperiodicadvertising'
    name = 'editperiodicadvertising'
    requirements = {'css_links': [],
                    'js_links': ['lac:static/js/periodic_advertising.js']}

    def default_data(self):
        return self.context

DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {EditPeriodicAdvertising: EditPeriodicAdvertisingView})
Exemplo n.º 6
0
# licence: AGPL
# author: Amen Souissi

from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from novaideo.content.processes.work_mode_processes.correction_work_mode_process.behaviors import (
    CloseWork)
from novaideo.content.proposal import Proposal
from novaideo import _


@view_config(
    name='closecorrectionwork',
    context=Proposal,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class CloseWorkView(BasicView):
    title = _('Close the work')
    name = 'closecorrectionwork'
    behaviors = [CloseWork]
    viewid = 'closecorrectionwork'

    def update(self):
        results = self.execute(None)
        return results[0]

DEFAULTMAPPING_ACTIONS_VIEWS.update({CloseWork: CloseWorkView})
Exemplo n.º 7
0
from pontus.form import FormView
from pontus.schema import select

from lac.content.processes.services_processes.behaviors import (
    EditImportService)
from lac.content.service import (
    ImportServiceSchema, ImportService)
from lac import _


@view_config(
    name='editimportservice',
    context=ImportService,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class EditImportServiceView(FormView):

    title = _('Edit a import service')
    schema = select(ImportServiceSchema(factory=ImportService,
                                        editable=True),
               ['title', 'sources'])
    behaviors = [EditImportService, Cancel]
    formid = 'formeditimportservice'
    name = 'editimportservice'

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update({EditImportService: EditImportServiceView})
Exemplo n.º 8
0
    name = 'submitideaform'
    formid = 'formsubmitidea'
    behaviors = [SubmitIdea, Cancel]
    validate_behaviors = False

    def before_update(self):
        self.action = self.request.resource_url(
            self.context, 'novaideoapi',
            query={'op': 'update_action_view',
                   'node_id': SubmitIdea.node_definition.id})
        self.schema.widget = deform.widget.FormWidget(
            css_class='deform novaideo-ajax-form')


@view_config(
    name='submitidea',
    context=Idea,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class PublishIdeaViewMultipleView(MultipleView):
    title = _('Submit for publication')
    name = 'submitidea'
    viewid = 'submitidea'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (SubmitIdeaViewStudyReport, SubmitIdeaView)
    validators = [SubmitIdea.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {SubmitIdea: PublishIdeaViewMultipleView})
Exemplo n.º 9
0
    behaviors = [ArchiveIdea, Cancel]
    validate_behaviors = False

    def before_update(self):
        self.action = self.request.resource_url(
            self.context,
            'novaideoapi',
            query={
                'op': 'update_action_view',
                'node_id': ArchiveIdea.node_definition.id
            })
        self.schema.widget = deform.widget.FormWidget(
            css_class='material-form deform novaideo-ajax-form')


@view_config(
    name='archiveidea',
    context=Idea,
    renderer='pontus:templates/views_templates/grid.pt',
)
class ArchiveIdeaViewMultipleView(MultipleView):
    title = _('Archive the idea')
    name = 'archiveidea'
    viewid = 'archiveidea'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (ArchiveIdeaViewStudyReport, ArchiveIdeaView)
    validators = [ArchiveIdea.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update({ArchiveIdea: ArchiveIdeaViewMultipleView})
Exemplo n.º 10
0
                obj,
                'current_user':
                user,
                'state':
                get_states_mapping(user, obj,
                                   getattr(obj, 'state_or_none', [None])[0])
            }
            body = self.content(args=render_dict,
                                template=obj.templates['default'])['body']
            result_body.append(body)

        result = {}
        values = {
            'bodies': result_body,
            'batch': batch,
            'filter_body': filter_body
        }
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        result['css_links'] = filter_form['css_links']
        result['js_links'] = filter_form['js_links']
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {SeeContentsToModerate: SeeContentsToModerateView})

FILTER_SOURCES.update(
    {SeeContentsToModerateView.name: SeeContentsToModerateView})
Exemplo n.º 11
0
# licence: AGPL
# author: Amen Souissi

from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from lac.content.processes.game_management.behaviors import (SystemPublishGame)
from lac.content.game import Game
from lac import _


@view_config(
    name='systempublishgame',
    context=Game,
    renderer='pontus:templates/views_templates/grid.pt',
)
class SystemPublishGameView(BasicView):
    title = _('SystemPublishGame')
    name = 'alertforsystempublishgame'
    behaviors = [SystemPublishGame]
    viewid = 'alertforsystempublishgame'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update({SystemPublishGame: SystemPublishGameView})
Exemplo n.º 12
0
    behaviors = [CorrectItem]
    viewid = 'correctallitems'

    def __call__(self):
        vote = self.params('vote')
        for item, data in self.context.corrections.items():
            self.execute({
                'item': item,
                'vote': vote,
                'content': data.get('content')
            })

        user = get_current()
        values = {
            'title': self.context.get_adapted_title(get_current()),
            'text': self.context.get_adapted_text(get_current()),
            'description': self.context.get_adapted_description(user),
        }
        body = self.content(args=values, template=self.template)['body']
        result = {'body': body}
        if self.behaviors_instances.values():
            action = list(self.behaviors_instances.values())[0]
            result.update(
                get_components_data(**get_all_updated_data(
                    action, self.request, self.context, self)))

        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update({CorrectItem: CorrectItemView})
Exemplo n.º 13
0
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.default_behavior import Cancel
from pontus.form import FormView
from pontus.schema import select

from novaideo.connectors.google.content.behaviors import CreateConnector
from novaideo.connectors.google import GoogleConnectorSchema, GoogleConnector
from novaideo.content.novaideo_application import NovaIdeoApplication
from novaideo import _


@view_config(
    name='creategoogleconnector',
    context=NovaIdeoApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class CreateGoogleConnectorView(FormView):

    title = _('Add a Google connector')
    schema = select(
        GoogleConnectorSchema(factory=GoogleConnector, editable=True),
        ['auth_conf'])
    behaviors = [CreateConnector, Cancel]
    formid = 'formcreategoogleconnector'
    name = 'creategoogleconnector'
    css_class = 'panel-transparent'


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {CreateConnector: CreateGoogleConnectorView})
Exemplo n.º 14
0
    validate_behaviors = False

    def before_update(self):
        self.action = self.request.resource_url(
            self.context,
            'novaideoapi',
            query={
                'op': 'update_action_view',
                'node_id': WithdrawUser.node_definition.id
            })
        self.schema.widget = deform.widget.FormWidget(
            css_class='deform novaideo-ajax-form')


@view_config(
    name='withdrawuser',
    context=Person,
    renderer='pontus:templates/views_templates/grid.pt',
)
class WithdrawView(MultipleView):
    title = _('Withdraw user from the organization')
    name = 'withdrawuser'
    behaviors = [WithdrawUser]
    viewid = 'withdrawuser'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (WithdrawViewStudyReport, WithdrawForm)
    validators = [WithdrawUser.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update({WithdrawUser: WithdrawView})
Exemplo n.º 15
0
@view_config(
    name='createbrief',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class CreateBriefView(FormView):

    title = _('Create a news flash')
    schema = select(
        BriefSchema(factory=Brief, editable=True, omit=('metadata', )), [
            'title', 'picture', 'tree', 'details', 'informations',
            'publication_number',
            ('metadata', ['accessibility', 'object_labels', 'connections_to'])
        ])
    behaviors = [CreateBrief, Cancel]
    formid = 'formcreatebrief'
    name = 'createbrief'

    def before_update(self):
        site = get_site_folder(True)
        services = site.get_all_services(kinds=['extractionservice'],
                                         delegation=False)
        has_extraction = 'extractionservice' in services and\
            getattr(services['extractionservice'][0], 'has_periodic', False)
        if not has_extraction:
            self.schema = omit(self.schema, ['publication_number'])


DEFAULTMAPPING_ACTIONS_VIEWS.update({CreateBrief: CreateBriefView})
Exemplo n.º 16
0
        validator=colander.Length(max=600),
        widget=LimitedTextAreaWidget(rows=5, 
                                     cols=30, 
                                     limit=600),
        title=_("Justification")
        )


@view_config(
    name='directsubmitamendmentform',
    context=Amendment,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class DirectSubmitAmendmentFormView(FormView):
    title = _('Submit the amendment')
    schema = SubmitSchema()
    behaviors = [DirectSubmitAmendment, Cancel]
    formid = 'formdirectsubmitamendment'
    name = 'directsubmitamendmentform'

    def before_update(self):
        self.action = self.request.resource_url(
            self.context, 'novaideoapi',
            query={'op': 'update_action_view',
                   'node_id': DirectSubmitAmendment.node_definition.id})
        self.schema.widget = deform.widget.FormWidget(
            css_class='deform novaideo-ajax-form')


DEFAULTMAPPING_ACTIONS_VIEWS.update({DirectSubmitAmendment: DirectSubmitAmendmentFormView})
Exemplo n.º 17
0
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


class DoubloonArtistView(FormView):
    title = _('Remove')
    name = 'removeartistform'
    formid = 'formremoveartist'
    behaviors = [ManageDuplicates]
    validate_behaviors = False


@view_config(
    name='potentialduplicatesartist',
    context=ArtistInformationSheet,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class DoubloonArtistViewMultipleView(MultipleView):
    title = _('Duplicate detection')
    name = 'potentialduplicatesartist'
    viewid = 'potentialduplicatesartist'
    template = 'daceui:templates/mergedmultipleview.pt'
    views = (DoubloonArtistViewStudyReport, DoubloonArtistView)
    validators = [ManageDuplicates.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {ManageDuplicates: DoubloonArtistViewMultipleView})
Exemplo n.º 18
0
        result['coordinates'] = {self.coordinates: [item]}
        return result


class ArchiveArtistInformationSheetView(FormView):
    title = _('Archive')
    name = 'archiveartistinformationsheetform'
    formid = 'formarchiveartistinformationsheet'
    behaviors = [ArchiveArtistInformationSheet, Cancel]
    validate_behaviors = False


@view_config(
    name='archiveartistinformationsheet',
    context=ArtistInformationSheet,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class ArchiveArtistInformationSheetViewMultipleView(MultipleView):
    title = _('Archive the artist information sheet')
    name = 'archiveartistinformationsheet'
    viewid = 'archiveartistinformationsheet'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    views = (ArchiveArtistInformationSheetViewStudyReport,
             ArchiveArtistInformationSheetView)
    validators = [ArchiveArtistInformationSheet.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {ArchiveArtistInformationSheet:
        ArchiveArtistInformationSheetViewMultipleView})
Exemplo n.º 19
0
from novaideo.content.correction import Correction, CorrectionSchema
from novaideo import _


@view_config(
    name='correctproposal',
    context=Proposal,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class CorrectProposalView(FormView):
    title = _('Correct the proposal')
    name = 'correctproposal'
    behaviors = [CorrectProposal, Cancel]
    viewid = 'correctproposal'
    formid = 'formcorrectproposal'
    schema = select(CorrectionSchema(factory=Correction,
                                     editable=True,
                                     widget=deform.widget.FormWidget(
                                                css_class='amendmentform')),
                    ['title', 'description', 'text'])
    requirements = {'css_links':[],
                    'js_links':['novaideo:static/js/action_confirmation.js']}

    def default_data(self):
        return {'title': self.context.title, 
                'text': self.context.text, 
                'description': self.context.description}


DEFAULTMAPPING_ACTIONS_VIEWS.update({CorrectProposal:CorrectProposalView})
Exemplo n.º 20
0
                     'image',
                     'text',
                     'deadline',
                     'attached_files'])
    behaviors = [EditChallenge, Cancel]
    formid = 'formeditchallenge'
    wrapper_template = 'pontus:templates/views_templates/simple_view_wrapper.pt'
    name = 'editChallenge'
    css_class = 'panel-transparent'

    def default_data(self):
        return self.context


@view_config(
    name='editchallenge',
    context=Challenge,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class EditChallengeView(MultipleView):
    title = _('Edit the challenge')
    name = 'editchallenge'
    wrapper_template = 'novaideo:views/templates/view_wrapper.pt'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (EditChallengeFormView, )
    requirements = {'css_links': [],
                    'js_links': ['novaideo:static/js/compare_challenge.js']}


DEFAULTMAPPING_ACTIONS_VIEWS.update({EditChallenge: EditChallengeView})
Exemplo n.º 21
0
            index = '*'

        self.title = _(CONTENTS_MESSAGES[index],
                       mapping={'number': len_result})
        filter_data['filter_message'] = self.title
        filter_body = self.filter_instance.get_body(filter_data)
        result_body, result = render_listing_objs(
            self.request, batch, user)
        if filter_form:
            result = merge_dicts(
                {'css_links': filter_form['css_links'],
                 'js_links': filter_form['js_links']
                }, result)

        values = {'bodies': result_body,
                  'batch': batch,
                  'filter_body': filter_body,
                  'sort_body': sort_body}
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {SeeOrderedProposal: SeeOrderedProposalView})


FILTER_SOURCES.update(
    {SeeOrderedProposalView.name: SeeOrderedProposalView})
Exemplo n.º 22
0
    def before_update(self):
        self.action = self.request.resource_url(
            self.context,
            'novaideoapi',
            query={
                'op': 'update_action_view',
                'node_id': Subscribe.node_definition.id
            })
        formwidget = deform.widget.FormWidget(
            css_class='channel-subscribe-form deform')
        formwidget.template = 'novaideo:views/templates/ajax_form.pt'
        self.schema.widget = formwidget


@view_config(
    name='subscribechannel',
    context=Channel,
    renderer='pontus:templates/views_templates/grid.pt',
)
class SubscribeView(MultipleView):
    title = _('Subscribe to the discussion')
    name = 'subscribechannel'
    behaviors = [Subscribe]
    viewid = 'subscribechannel'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (SubscribeViewStudyReport, SubscribeForm)
    validators = [Subscribe.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update({Subscribe: SubscribeView})
Exemplo n.º 23
0
    renderer='pontus:templates/views_templates/grid.pt',
    )
class SeeRegistrationView(BasicView):
    title = ''
    name = 'seeregistration'
    behaviors = [SeeRegistration]
    template = 'novaideo:views/user_management/templates/see_registration.pt'
    viewid = 'seeregistration'

    def update(self):
        self.execute(None)
        try:
            navbars = generate_navbars(self.request, self.context)
        except ObjectRemovedException:
            return HTTPFound(self.request.resource_url(getSite(), ''))

        values = {'registration': self.context,
                  'footer_body': navbars['footer_body'],
                  'navbar_body': navbars['navbar_body']}
        result = {}
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        item['messages'] = navbars['messages']
        item['isactive'] = navbars['isactive']
        result.update(navbars['resources'])
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update({SeeRegistration: SeeRegistrationView})
Exemplo n.º 24
0
from pontus.default_behavior import Cancel
from pontus.schema import select

from lac.content.processes.services_processes.\
    newsletter_management.behaviors import (
        ConfigureRecNewsletter)
from lac.content.newsletter import (NewsletterSchema, Newsletter)
from lac import _


@view_config(
    name='configurerecnewsletter',
    context=Newsletter,
    renderer='pontus:templates/views_templates/grid.pt',
)
class ConfigureRecNewsletterView(FormView):

    title = _('Configure the recurrence')
    schema = select(NewsletterSchema(editable=True),
                    ['recurrence', 'recurrence_nb', 'sending_date'])
    behaviors = [ConfigureRecNewsletter, Cancel]
    formid = 'formeconfigurerecnewsletter'
    name = 'configurerecnewsletter'

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {ConfigureRecNewsletter: ConfigureRecNewsletterView})
Exemplo n.º 25
0
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


class RemindView(FormView):
    title = _('Remove')
    name = 'remindform'
    formid = 'formremind'
    behaviors = [Remind, Cancel]
    validate_behaviors = False


@view_config(
    name='remind',
    context=Preregistration,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class RemindViewMultipleView(MultipleView):
    title = _('Remind the user')
    name = 'remind'
    viewid = 'remind'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    views = (RemindViewStudyReport, RemindView)
    validators = [Remind.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {Remind: RemindViewMultipleView})
Exemplo n.º 26
0
        if 'extractionservice' in services:
            self.schema.get('description').description = _(
                'Describe succinctly the event.'
                ' Only this part of the description will '
                'be included in the paper version of the magazine.')

    def default_data(self):
        schedules = []
        source = self.params('source')
        context = self.context
        if source:
            context = get_obj(int(source))

        result = context.get_data(self.schema)
        for schedule in result['schedules']:
            schedule_data = schedule.get_data(
                self.schema.get('schedules').children[0])
            schedules.append(schedule_data)

        result['artists'] = get_artist_data(
            result['artists'],
            self.schema.get('artists').children[0])
        picture = get_file_data(result['picture'], True)
        result.update(picture)
        result['schedules'] = schedules
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {DuplicateCulturalEvent: DuplicateCulturalEventView})
Exemplo n.º 27
0
    viewid = 'seefile'

    def update(self):
        self.execute(None)
        root = getSite()
        try:
            navbars = generate_navbars(self, self.context, self.request)
        except ObjectRemovedException:
            return HTTPFound(self.request.resource_url(root, ''))

        result = {}
        user = get_current()
        parent = self.context.__parent__
        can_access_parent = False
        if not (parent is root) and can_access(user, parent):
            can_access_parent = True

        values = {'object': self.context,
                  'navbar_body': navbars['navbar_body'],
                  'can_access_parent': can_access_parent}
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        item['messages'] = navbars['messages']
        item['isactive'] = navbars['isactive']
        result.update(navbars['resources'])
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update({SeeFile: SeeFileView})
Exemplo n.º 28
0
    def before_update(self):
        user = get_current()
        if getattr(user, 'email', ''):
            self.schema.get('email').widget = deform.widget.HiddenWidget()

    def default_data(self):
        user = get_current()
        return {'email': getattr(user, 'email', '')}


@view_config(
    name='improve',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class ImproveView(MultipleView):
    title = _('Votre avis')
    name = 'improve'
    viewid = 'improve'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    views = (ImproveStudyReport, ImproveFormView)
    validators = [Improve.get_validator()]
    requirements = {
        'css_links': [],
        'js_links': ['lac:static/js/questionnaire.js']
    }


DEFAULTMAPPING_ACTIONS_VIEWS.update({Improve: ImproveView})
Exemplo n.º 29
0
# author: Amen Souissi

from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from novaideo.content.processes.user_management.behaviors import (
    ModerationVote)
from novaideo.content.proposal import Proposal
from novaideo import _


@view_config(
    name='moderationvote',
    context=Proposal,
    renderer='pontus:templates/views_templates/grid.pt',
)
class ModerationVoteView(BasicView):
    title = _('Decision')
    name = 'moderationvote'
    behaviors = [ModerationVote]
    viewid = 'moderationvote'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update({ModerationVote: ModerationVoteView})
Exemplo n.º 30
0
# author: Amen Souissi

from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from lac.content.processes.user_management.behaviors import (
    Activate)
from lac.content.person import Person
from lac import _


@view_config(
    name='activate',
    context=Person,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class ActivateView(BasicView):
    title = _('Activate the profile')
    name = 'activate'
    behaviors = [Activate]
    viewid = 'activateview'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update({Activate: ActivateView})
Exemplo n.º 31
0
from pontus.schema import select

from lac.content.processes.services_processes.\
    newsletter_management.behaviors import (
        RedactNewsletter)
from lac.content.newsletter import (
    NewsletterSchema, Newsletter)
from lac import _


@view_config(
    name='redactnewsletter',
    context=Newsletter,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class RedactNewsletterView(FormView):

    title = _('Redact a newsletter')
    schema = select(NewsletterSchema(factory=Newsletter, editable=True),
                    ['subject', 'content'])
    behaviors = [RedactNewsletter, Cancel]
    formid = 'formredactnewsletter'
    name = 'redactnewsletter'

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {RedactNewsletter: RedactNewsletterView})
Exemplo n.º 32
0
            self.context, self.request.view_name,
            query=posted)
        batch = Batch(objects,
                      self.request,
                      url=url,
                      default_size=BATCH_DEFAULT_SIZE)
        batch.target = "#results"
        len_result = batch.seqlen
        index = str(len_result)
        if len_result > 1:
            index = '*'

        self.title = _(CONTENTS_MESSAGES[index],
                       mapping={'number': len_result})
        result_body, result = render_listing_objs(
            self.request, batch, user)
        values = {'bodies': result_body,
                  'batch': batch}
                  # 'sort_body': sort_body}
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update({Search: SearchView})


FILTER_SOURCES.update(
    {"search_source": SearchResultView})
Exemplo n.º 33
0
    behaviors = [SeeWebAdvertising]
    template = 'lac:views/web_advertising_management/templates/see_web_advertising.pt'

    def update(self):
        self.execute(None)
        try:
            navbars = generate_navbars(self, self.context, self.request)
        except ObjectRemovedException:
            return HTTPFound(self.request.resource_url(getSite(), ''))

        result = {}
        user = get_current()
        values = {
            'object': self.context,
            'state': get_states_mapping(
                user, self.context,
                getattr(self.context, 'state_or_none', [None])[0]),
            'navbar_body': navbars['navbar_body']
        }
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        item['messages'] = navbars['messages']
        item['isactive'] = navbars['isactive']
        result.update(navbars['resources'])
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {SeeWebAdvertising: SeeWebAdvertisingView})
Exemplo n.º 34
0
from novaideo import _
from novaideo.views.core import update_anonymous_schemanode


@view_config(
    name='createchallenge',
    context=NovaIdeoApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class CreateChallengeView(FormView):

    title = _('Create a challenge')
    schema = select(
        ChallengeSchema(factory=Challenge, editable=True,
                        omit=('anonymous', )),
        [
            'title', 'description', 'tree', 'image', 'text', 'is_restricted',
            'invited_users', 'deadline', 'attached_files', 'anonymous'
        ])
    behaviors = [CrateAndPublish, CreateChallenge, Cancel]
    formid = 'formcreatechallenge'
    name = 'createchallenge'
    css_class = 'panel-transparent'

    def before_update(self):
        self.schema = update_anonymous_schemanode(self.request.root,
                                                  self.schema)


DEFAULTMAPPING_ACTIONS_VIEWS.update({CreateChallenge: CreateChallengeView})
Exemplo n.º 35
0
    wrapper_template = 'pontus:templates/views_templates/simple_view_wrapper.pt'
    viewid = 'seecorrelation'

    def update(self):
        self.execute(None) 
        result = {}
        values = {
                'correlation': self.context,
               }
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates:[item]}
        return result


@view_config(
    name='seecorrelation',
    context=Correlation,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class SeeCorrelationView(MultipleView):
    title = _('Detail')
    name = 'seecorrelation'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (DetailCorrelation, CommentCorrelationView)
    requirements = {'css_links':[],
                    'js_links':['novaideo:static/js/comment.js']}


DEFAULTMAPPING_ACTIONS_VIEWS.update({SeeCorrelation:SeeCorrelationView})
Exemplo n.º 36
0
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


class RemoveRegistrationView(FormView):
    title = _('Remove')
    name = 'removeregistrationform'
    formid = 'formremoveregistration'
    behaviors = [RemoveRegistration, Cancel]
    validate_behaviors = False


@view_config(
    name='removeregistration',
    context=Preregistration,
    renderer='pontus:templates/views_templates/grid.pt',
)
class RemoveRegistrationViewMultipleView(MultipleView):
    title = _('Remove the registration')
    name = 'removeregistration'
    viewid = 'removeregistration'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    views = (RemoveRegistrationViewStudyReport, RemoveRegistrationView)
    validators = [RemoveRegistration.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {RemoveRegistration: RemoveRegistrationViewMultipleView})
Exemplo n.º 37
0
from pyramid.view import view_config


from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from lac.content.processes.game_management.behaviors import (
    Draw)
from lac.content.game import Game
from lac import _


@view_config(
    name='draw',
    context=Game,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class DrawView(BasicView):
    title = _('Draw')
    name = 'draw'
    behaviors = [Draw]
    viewid = 'alertfordraw'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update({Draw: DrawView})
Exemplo n.º 38
0
from pontus.schema import select

from novaideo.content.processes.amendment_management.behaviors import (
    EditAmendment)
from novaideo.content.amendment import AmendmentSchema, Amendment
from novaideo import _


@view_config(
    name='editamendment',
    context=Amendment,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class EditAmendmentView(FormView):
    title = _('Edit the amendment')
    schema = select(AmendmentSchema(factory=Amendment,
                                    editable=True),
                    ['title',
                     'text'])
    behaviors = [EditAmendment, Cancel]
    formid = 'formeditamendment'
    name = 'editamendment'
    css_class = 'panel-transparent'

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {EditAmendment: EditAmendmentView})
Exemplo n.º 39
0
    context=Answer,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class OpposeAnswerView(BasicView):
    title = _('Oppose')
    name = 'opposeanswer'
    behaviors = [OpposeAnswer]
    viewid = 'opposeanswer'

    def update(self):
        results = self.execute(None)
        return results[0]


@view_config(
    name='opposeansweranonymous',
    context=Answer,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class OpposeAnswerAnonymousView(ActionAnonymousView):
    behaviors = [OpposeAnswerAnonymous]
    name = 'opposeansweranonymous'


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {OpposeAnswerAnonymous: OpposeAnswerAnonymousView})


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {OpposeAnswer: OpposeAnswerView})
Exemplo n.º 40
0
from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from lac.content.processes.advertising_management.behaviors import (
    WithdrawAdvertising)
from lac.core import Advertising
from lac import _


@view_config(
    name='withdrawadvertising',
    context=Advertising,
    renderer='pontus:templates/views_templates/grid.pt',
)
class WithdrawAdvertisingView(BasicView):
    title = _('Withdraw the  advertising')
    name = 'withdrawadvertising'
    behaviors = [WithdrawAdvertising]
    viewid = 'withdrawadvertising'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {WithdrawAdvertising: WithdrawAdvertisingView})
Exemplo n.º 41
0
            return super(PayReviewView, self).update()

    def before_update(self):
        formwidget = deform.widget.FormWidget(css_class='compareform')
        formwidget.template = 'lac:views/templates/pay_form.pt'
        cancel_url = self.request.resource_url(self.context, '@@index')
        formwidget.cancel_url = cancel_url
        self.schema.widget = formwidget

    def default_data(self):
        #@TODO calcul de la signature et des valeur du formulaire
        return {'signature': 'testsignature'}


@view_config(
    name='payreview',
    context=BaseReview,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class PayReviewViewMultipleView(MultipleView):
    title = _('Pay the cultural event')
    name = 'payreview'
    viewid = 'payreview'
    template = 'daceui:templates/mergedmultipleview.pt'
    views = (PayReviewViewStudyReport, PayReviewView)
    validators = [PayReview.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {PayReview: PayReviewViewMultipleView})
Exemplo n.º 42
0
# author: Amen Souissi

from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from novaideo.content.processes.proposal_management.behaviors import (
    SupportProposal)
from novaideo.content.proposal import Proposal
from novaideo import _


@view_config(
    name='supportproposal',
    context=Proposal,
    renderer='pontus:templates/views_templates/grid.pt',
)
class SupportProposalView(BasicView):
    title = _('Support')
    name = 'supportproposal'
    behaviors = [SupportProposal]
    viewid = 'supportproposal'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update({SupportProposal: SupportProposalView})
Exemplo n.º 43
0
    context=Brief,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class EditBriefView(FormView):

    title = _('Edit the news flash')
    schema = select(BriefSchema(factory=Brief,
                                editable=True,
                                omit=('metadata', )),
                    ['title', 'picture', 'tree', 'details',
                     'informations', 'publication_number',
                     ('metadata', ['accessibility', 'object_labels', 'connections_to'])])
    behaviors = [EditBrief, Cancel]
    formid = 'formeditbrief'
    name = 'editbrief'

    def before_update(self):
        site = get_site_folder(True)
        services = site.get_all_services(
            kinds=['extractionservice'], delegation=False)
        has_extraction = 'extractionservice' in services and\
            getattr(services['extractionservice'][0], 'has_periodic', False)
        if not has_extraction:
            self.schema = omit(self.schema, ['publication_number'])

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update({EditBrief: EditBriefView})
Exemplo n.º 44
0
    validators = [AddCinemagoerExtractionValidator]


@view_config(
    name='addcinemagoer',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class AddCinemagoerMultipleView(MultipleView):
    title = _('Add cinema sessions')
    name = 'addcinemagoer'
    viewid = 'addcinemagoer'
    template = 'daceui:templates/mergedmultipleview.pt'
    views = (CinemagoerViewStudyReport, AddCinemagoerView,
             AddCinemagoerExtractionView)
    validators = [AddCinemagoer.get_validator()]
    requirements = {
        'css_links': [],
        'js_links': [
            'lac:static/js/addresse_management.js',
            'lac:static/js/cultural_event_management.js',
            'lac:static/js/contact_management.js',
            'lac:static/js/artist_management.js',
            'lac:static/js/contextual_help_cinema_sessions.js',
            'lac:static/js/cinemagoer.js'
        ]
    }


DEFAULTMAPPING_ACTIONS_VIEWS.update({AddCinemagoer: AddCinemagoerMultipleView})
Exemplo n.º 45
0
@view_config(
    name='createbrief',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class CreateBriefView(FormView):

    title = _('Create a news flash')
    schema = select(BriefSchema(factory=Brief,
                                editable=True,
                                omit=('metadata',)),
                    ['title', 'picture', 'tree', 'details',
                     'informations', 'publication_number',
                     ('metadata', ['accessibility', 'object_labels', 'connections_to'])])
    behaviors = [CreateBrief, Cancel]
    formid = 'formcreatebrief'
    name = 'createbrief'

    def before_update(self):
        site = get_site_folder(True)
        services = site.get_all_services(
            kinds=['extractionservice'], delegation=False)
        has_extraction = 'extractionservice' in services and\
            getattr(services['extractionservice'][0], 'has_periodic', False)
        if not has_extraction:
            self.schema = omit(self.schema, ['publication_number'])


DEFAULTMAPPING_ACTIONS_VIEWS.update({CreateBrief: CreateBriefView})
Exemplo n.º 46
0
from pontus.schema import select

from lac.content.processes.services_processes.behaviors import (
    EditModerationService)
from lac.content.service import (ModerationServiceSchema, ModerationService)
from lac import _


@view_config(
    name='editmoderationservice',
    context=ModerationService,
    renderer='pontus:templates/views_templates/grid.pt',
)
class EditModerationServiceView(FormView):

    title = _('Edit a moderation service')
    schema = select(
        ModerationServiceSchema(factory=ModerationService,
                                editable=True,
                                omit=('delegate', )), ['title', 'delegate'])
    behaviors = [EditModerationService, Cancel]
    formid = 'formeditmoderationservice'
    name = 'editmoderationservice'

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {EditModerationService: EditModerationServiceView})
Exemplo n.º 47
0
    name = 'disactivateform'
    formid = 'formdisactivate'
    behaviors = [Deactivate, Cancel]
    validate_behaviors = False

    def before_update(self):
        self.action = self.request.resource_url(
            self.context, 'novaideoapi',
            query={'op': 'update_action_view',
                   'node_id': Deactivate.node_definition.id})
        self.schema.widget = deform.widget.FormWidget(
            css_class='deform novaideo-ajax-form')


@view_config(
    name='disactivate',
    context=Person,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class DeactivateViewMultipleView(MultipleView):
    title = _('Disactivate the profile')
    name = 'disactivate'
    viewid = 'disactivate'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (DeactivateViewStudyReport, DeactivateView)
    validators = [Deactivate.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {Deactivate: DeactivateViewMultipleView})
Exemplo n.º 48
0
from lac.content.smart_folder import (SmartFolderSchema, SmartFolder)
from lac.content.lac_application import (CreationCulturelleApplication)
from lac import _


@view_config(
    name='addsmartfolder',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class AddSmartFolderView(FormView):

    title = _('Add smart folder')
    schema = select(SmartFolderSchema(factory=SmartFolder, editable=True), [
        'title', 'description', 'filters', 'view_type', 'classifications',
        'icon_data', 'style', 'add_as_a_block'
    ])
    behaviors = [AddSmartFolder, Cancel]
    formid = 'formaddsmartfolder'
    name = 'addsmartfolder'
    requirements = {
        'css_links': [],
        'js_links': [
            'lac:static/js/smart_folder_management.js',
            'lac:static/js/contextual_help_smart_folder.js'
        ]
    }


DEFAULTMAPPING_ACTIONS_VIEWS.update({AddSmartFolder: AddSmartFolderView})
Exemplo n.º 49
0
                    'js_links': ['novaideo:static/js/comment.js']}

    def get_message(self):
        message = (PRESENT_MESSAGE['0']).format()
        if self.validated_children:
            message = getattr(self.validated_children[0], 'message', message)

        return message

    def before_update(self):
        self.viewid = 'present'
        super(PresentIdeaView, self).before_update()


@view_config(
    name='presentanonymous',
    context=Idea,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class PresentIdeaAnonymousView(ActionAnonymousView):
    behaviors = [PresentIdeaAnonymous]
    name = 'presentanonymous'


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {PresentIdeaAnonymous: PresentIdeaAnonymousView})


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {PresentIdea: PresentIdeaView})
Exemplo n.º 50
0
    template = 'novaideo:views/novaideo_view_manager/templates/search_result.pt'
    viewid = 'seefiles'
    wrapper_template = 'novaideo:views/templates/simple_wrapper.pt'
    css_class = 'panel-transparent'

    def update(self):
        self.execute(None)
        user = get_current()
        objects = find_entities(user=user,
                                interfaces=[IFile],
                                sort_on='release_date',
                                reverse=True)
        batch = Batch(objects, self.request, default_size=BATCH_DEFAULT_SIZE)
        batch.target = "#results_files"
        len_result = batch.seqlen
        is_portalmanager = has_role(user=user, role=('PortalManager', )),
        result_body, result = render_listing_objs(
            self.request, batch, user, is_portalmanager=is_portalmanager)
        values = {
            'bodies': result_body,
            'length': len_result,
            'batch': batch,
        }
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


DEFAULTMAPPING_ACTIONS_VIEWS.update({SeeFiles: SeeFilesView})
Exemplo n.º 51
0
from pontus.form import FormView
from pontus.schema import select

from lac.content.processes.services_processes.behaviors import (
    EditExtractionService)
from lac.content.service import (
    ExtractionServiceSchema, ExtractionService)
from lac import _


@view_config(
    name='editextractionservice',
    context=ExtractionService,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class EditExtractionServiceView(FormView):

    title = _('Edit a extraction service')
    schema = select(ExtractionServiceSchema(factory=ExtractionService,
                                            editable=True),
               ['title', 'has_periodic'])
    behaviors = [EditExtractionService, Cancel]
    formid = 'formeditextractionservice'
    name = 'editextractionservice'

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update({EditExtractionService: EditExtractionServiceView})
Exemplo n.º 52
0
from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from lac.content.processes.cultural_event_management.behaviors import (
    WithdrawCulturalEvent)
from lac.content.cultural_event import (CulturalEvent)
from lac import _


@view_config(
    name='withdrawculturalevent',
    context=CulturalEvent,
    renderer='pontus:templates/views_templates/grid.pt',
)
class WithdrawCulturalEventView(BasicView):
    title = _('Withdraw the cultural event')
    name = 'withdrawculturalevent'
    behaviors = [WithdrawCulturalEvent]
    viewid = 'withdrawculturalevent'

    def update(self):
        results = self.execute(None)
        return results[0]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {WithdrawCulturalEvent: WithdrawCulturalEventView})
Exemplo n.º 53
0
from lac.content.lac_application import (
    CreationCulturelleApplication)
from lac import _


@view_config(
    name='createinterview',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class CreateInterviewView(FormView):

    title = _('Create an interview')
    schema = select(InterviewSchema(factory=Interview,
                                    editable=True,
                                    omit=('artists', 'artists_ids', 'metadata')),
               ['title', 'review', 'tree', 'artists_ids', 'artists',
                'picture', 'article',
                'signature', 'informations',
                'showcase_review',
                ('metadata', ['accessibility', 'object_labels', 'connections_to'])])
    behaviors = [CreateInterview, Cancel]
    formid = 'formcreateinterview'
    name = 'createinterview'
    requirements = {'css_links': [],
                    'js_links': ['lac:static/js/contextual_help_interview.js',
                                 'lac:static/js/artist_management.js']}


DEFAULTMAPPING_ACTIONS_VIEWS.update({CreateInterview: CreateInterviewView})
Exemplo n.º 54
0
    title = _('Edit the invitation')
    schema = select(InvitationSchema(editable=True), [
        'title', 'user_title', 'roles', 'first_name', 'last_name', 'email',
        'organization'
    ])
    behaviors = [EditInvitation, Cancel]
    formid = 'formeditinvitation'
    name = 'editinvitation'

    def before_update(self):
        if not has_role(role=('Moderator', )):
            self.schema = select(
                InvitationSchema(editable=True),
                ['title', 'user_title', 'first_name', 'last_name', 'email'])

        self.action = self.request.resource_url(
            self.context,
            'novaideoapi',
            query={
                'op': 'update_action_view',
                'node_id': EditInvitation.node_definition.id
            })
        self.schema.widget = deform.widget.FormWidget(
            css_class='deform novaideo-ajax-form')

    def default_data(self):
        return self.context


DEFAULTMAPPING_ACTIONS_VIEWS.update({EditInvitation: EditInvitationView})
Exemplo n.º 55
0
from pontus.default_behavior import Cancel
from pontus.form import FormView
from pontus.schema import select

from lac.content.processes.lac_file_management.behaviors import (
    CreateFile)
from lac.core import FileSchema, FileEntity
from lac.content.lac_application import (
    CreationCulturelleApplication)
from lac import _


@view_config(
    name='createfile',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class CreateFileView(FormView):

    title = _('Create a file')
    schema = select(FileSchema(factory=FileEntity, editable=True),
                    ['title',
                     'description',
                     'text'])
    behaviors = [CreateFile, Cancel]
    formid = 'formcreatefile'
    name = 'createfile'


DEFAULTMAPPING_ACTIONS_VIEWS.update({CreateFile: CreateFileView})
Exemplo n.º 56
0
        values = {'context': self.context}
        body = self.content(args=values, template=self.template)['body']
        item = self.adapt_item(body, self.viewid)
        result['coordinates'] = {self.coordinates: [item]}
        return result


class PublishGameView(FormView):
    title = _('Publish')
    name = 'publishgameform'
    formid = 'formpublishgame'
    behaviors = [PublishGame, Cancel]
    validate_behaviors = False


@view_config(
    name='publishgame',
    context=Game,
    renderer='pontus:templates/views_templates/grid.pt',
)
class PublishGameViewMultipleView(MultipleView):
    title = _('Publish the advertisement')
    name = 'publishgame'
    viewid = 'publishgame'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    views = (PublishGameViewStudyReport, PublishGameView)
    validators = [PublishGame.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update({PublishGame: PublishGameViewMultipleView})
Exemplo n.º 57
0
                                activable=True,
                                button_css_class="pull-right",
                                picto_css_class="glyphicon glyphicon-link",
                                button_title=_("Associate"))
        formwidget.template = 'novaideo:views/templates/ajax_form.pt'
        self.schema.widget = formwidget


@view_config(
    name='associate',
    context=Idea,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class AssociateView(MultipleView):
    title = _('Associate the idea')
    name = 'associate'
    template = 'daceui:templates/simple_mergedmultipleview.pt'
    wrapper_template = 'novaideo:views/idea_management/templates/panel_item.pt'
    views = (RelatedContentsView, AssociateFormView)
    description = _("Associate the idea to an other content")

    def get_message(self):
        message = (ASSOCIATION_MESSAGES['0']).format()
        if self.validated_children:
            message = getattr(self.validated_children[0], 'message', message)

        return message


DEFAULTMAPPING_ACTIONS_VIEWS.update({Associate:AssociateView})
Exemplo n.º 58
0
    formid = 'formreport'
    name = 'formreport'
    css_class = 'panel-transparent'

    def before_update(self):
        self.action = self.request.resource_url(
            self.context, 'novaideoapi',
            query={'op': 'update_action_view',
                   'node_id': Report.node_definition.id})
        self.schema.widget = deform.widget.FormWidget(
            css_class='deform novaideo-ajax-form')


@view_config(
    name='report',
    context=SignalableEntity,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class ReportView(MultipleView):
    title = _('Report')
    name = 'report'
    behaviors = [Report]
    viewid = 'reportentity'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    views = (ReportViewStudyReport, ReportFormView)
    validators = [Report.get_validator()]


DEFAULTMAPPING_ACTIONS_VIEWS.update(
    {Report: ReportView})
Exemplo n.º 59
0
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from lac.content.processes.user_management.behaviors import (
    LogOut)
from lac.content.lac_application import (
    CreationCulturelleApplication)
from lac import _

@view_config(
    name='logout',
    context=CreationCulturelleApplication,
    renderer='pontus:templates/views_templates/grid.pt',
    )
class LogoutView(BasicView):
    title = _('Log out')
    name = 'logout'
    behaviors = [LogOut]
    viewid = 'logout'

    def update(self):
        self.execute(None)
        headers = forget(self.request)
        return HTTPFound(
            location=self.request.resource_url(self.request.context),
            headers=headers)


DEFAULTMAPPING_ACTIONS_VIEWS.update({LogOut: LogoutView})
Exemplo n.º 60
0
    def before_update(self):
        user = get_current(self.request)
        self.schema = update_anonymous_schemanode(self.request.root,
                                                  self.schema)
        self.schema = update_challenge_schemanode(self.request, user,
                                                  self.schema)
        ideas_widget = ideas_choice(self.context, self.request)
        ideas_widget.item_css_class = 'hide-bloc'
        ideas_widget.css_class = 'controlled-items'
        self.schema.get('related_ideas').widget = ideas_widget


@view_config(
    name='createproposal',
    context=NovaIdeoApplication,
    renderer='pontus:templates/views_templates/grid.pt',
)
class CreateProposalView(MultipleView):
    title = _('Create a proposal')
    name = 'createproposal'
    template = 'pontus:templates/views_templates/simple_multipleview.pt'
    requirements = {
        'css_links': [],
        'js_links': ['novaideo:static/js/ideas_management.js']
    }
    views = (CreateProposalFormView, IdeaManagementView)


DEFAULTMAPPING_ACTIONS_VIEWS.update({CreateProposal: CreateProposalView})