def competence_index_view(context, request): """ Index view to go to a competence grid Both admin and user view :param obj request: The pyramid request """ competence_js.need() # Don't return list of users to the template if we come here through the # user menu if not request.has_permission('admin_competences'): user_options = [] else: user_options = get_users_options(roles=['contractor']) deadlines = CompetenceDeadline.query().all() if 'deadline' in request.POST: logger.debug(request.POST) appstruct = validate_competence_grid_query(request) if appstruct is not None: return redirect_to_competence_grid(request, appstruct) return { 'title': u'Évaluation des compétences', 'user_options': user_options, 'deadlines': deadlines, }
def competence_grid_view(context, request): """ The competence grid base view """ request.actionmenu.add( widgets.ViewLink( u"Page précédente", "admin_competences", path="competences", ) ) competence_js.need() # loadurl : The url to load the options loadurl = request.route_path( 'competence_grid', id=context.id, _query=dict(action='options'), ) # contexturl : The url to load datas about the context in json format contexturl = request.current_route_path() title = u"Évaluation des compétences de {0} pour la période \"{1}\"".format( context.contractor.label, context.deadline.label ) return { 'title': title, "loadurl": loadurl, "contexturl": contexturl }
def competence_index_view(request): """ Index view to go to a competence grid """ competence_js.need() user_options = get_users_options(roles=['contractor']) deadlines = CompetenceDeadline.query().all() if 'deadline' in request.POST or 'sheet' in request.POST: logger.debug(request.POST) schema = CompetenceGridQuerySchema.bind(request=request) try: appstruct = schema.deserialize(request.POST) except colander.Invalid: logger.exception(u"Erreur dans le routage de la page de \ compétences : POSSIBLE BREAK IN ATTEMPT") else: # On récupère l'id du user pour l'évaluation contractor_id = appstruct['contractor_id'] # L'id de la période d'évaluation deadline_id = appstruct['deadline'] # On redirige vers la page appropriée grid = get_competence_grid( request, contractor_id, deadline_id ) url = request.route_path("competence_grid", id=grid.id) return HTTPFound(url) return { 'title': u'Évaluation des compétences', 'user_options': user_options, 'deadlines': deadlines, }
def competence_grid_view(context, request): """ The competence grid base view """ request.actionmenu.add( widgets.ViewLink( u"Page précédente", "view", path="competences", ) ) competence_js.need() # loadurl : The url to load the options loadurl = request.route_path( 'competence_grid', id=context.id, _query=dict(action='options'), ) # contexturl : The url to load datas about the context in json format contexturl = request.current_route_path() title = u"Évaluation des compétences de {0} pour la période \"{1}\"".format( context.contractor.label, context.deadline.label ) return { 'title': title, "loadurl": loadurl, "contexturl": contexturl }