Beispiel #1
0
 def is_valid(self):
     if (not self.is_empty()):
         self.user = QueryUser().getUserById(self.tutorId)
         if self.user.isTutor(): return True
         else: return False
     else:
         return False
Beispiel #2
0
def listadoProfesores(request, user=None):
    grupos = [
        {'campo': "Coordinadors", 'lista': QueryUser().getListOfCoordinator()},
        {'campo': "Tutors", 'lista': QueryUser().getListOfTutor()},
        {'campo': "Profesors", 'lista': QueryUser().getListOfProfessor()}
    ]
    anyadir = True
    editar = True
    return render_to_response('profesorListado.html', locals())
Beispiel #3
0
def index(request, login):
    teacher = QueryUser().getUserByUserUJI(login)
    if teacher:
        if teacher.isCoordinator():
            return HttpResponseRedirect('/coordinacio/projectes/')
        else:
            return HttpResponseRedirect('/professorat/projectes/')

    student = QueryStudent().getStudentByUserUJI(login)
    if student:
        return HttpResponseRedirect('/valoracio/' + login + '/')
    else:
        return HttpResponseNotFound()
Beispiel #4
0
def index(request, login):
    teacher = QueryUser().getUserByUserUJI(login)
    if teacher :
        if teacher.isCoordinator():
            return HttpResponseRedirect('/coordinacio/projectes/')
        else:
            return HttpResponseRedirect('/professorat/projectes/')
        
    student = QueryStudent().getStudentByUserUJI(login)
    if student:
        return HttpResponseRedirect('/valoracio/'+login+'/')
    else:
        return HttpResponseNotFound()
        
Beispiel #5
0
 def editaUsuario(self):
     usuarioDB = QueryUser().getUserByUserUJI(self.profesorid)
     usuarioDB.nombre = self.usuario.nombre
     usuarioDB.apellidos = self.usuario.apellidos
     usuarioDB.usuarioUJI = self.usuario.usuarioUJI
     usuarioDB.rol = self.usuario.rol
     usuarioDB.save()
Beispiel #6
0
    def __init__(self, request, studentUserUJI):
        self.numberOfJudgeMembers = NUMBER_OF_JUDGE_MEMBERS

        self.request = request

        self.project, self.judgeMembers = None, None

        if studentUserUJI:
            self.project = QueryProject().getProjectByCourseAndStudent(
                QueryCourse().getCourseSelected(self.request),
                QueryStudent().getStudentByUserUJI(studentUserUJI))
            self.judgeMembers = QueryJudgeMembers().getListMembersByProject(
                self.project)

        self.forms = []
        self.id_members = []
        for i in xrange(self.numberOfJudgeMembers):
            if request.method == 'POST':
                id_member = request.POST.get("miembro" + str(i) + "-miembro",
                                             '')
                form = MemberJudgeForm(request.POST, prefix="miembro" + str(i))
                if id_member:
                    self.id_members.append({
                        'id': i + 1,
                        'id_member': id_member
                    })
            else:
                form = MemberJudgeForm(prefix="miembro" + str(i))
                form.fields["miembro"].queryset = QueryUser().getListOfUser()
                if self.judgeMembers:
                    form.initial["miembro"] = self.judgeMembers[i].miembro
            self.forms.append(form)
Beispiel #7
0
 def is_valid(self):
     if (not self.is_empty()) :
         self.user = QueryUser().getUserById(self.tutorId)
         if self.user.isTutor() : return True
         else: return False
     else:
         return False
Beispiel #8
0
 def __init__(self, request, accion="nuevo", profesorid=""):
     self.usuario = Usuario()
     self.accion = accion
     self.request= request
     self.profesorid = profesorid
     self.obligatorios = ["nombre", "apellidos", "usuarioUJI", "rol"]
     
     self.usuarioForm = UsuarioForm()
     if self.accion == "editar" :
         self.usuarioForm = UsuarioForm(instance = QueryUser().getUserByUserUJI(profesorid))
         
     if (request.method == "POST" ):
         self.usuarioForm = UsuarioForm(request.POST, instance=self.usuario)
Beispiel #9
0
def accesoFormularioPublico(request, clave):
    formForm = QueryForm().getFormByKey(clave)
    if not formForm: return HttpResponseNotFound()
    access = True
    user = None
    if formForm.needUJIAuthentication():
        access = False
        login, redirect = loginFromEujierlogin(request)
        if not login:
            return redirect
        if QueryProject().isUserRolinProject(formForm.proyecto, formForm.rol,
                                             login):
            access = True
            user = QueryUser().getUserByUserUJI(login)
        else:
            coordinador = QueryUser().getUserCoordinatorByUserUJI(login)
            user = coordinador
            if coordinador: access = True

    if access:
        return formularioPublico(request, formForm, user)
    else:
        return HttpResponseForbidden()
Beispiel #10
0
 def wrapped(*args, **kwargs):
     request = args[0]
     (auth, redirect) = lsm.login(request)
     if not auth :
         return redirect
     (login, redirect) = lsm.get_login(request)
     if not login :
         return redirect
     
     coordinator = QueryUser().getUserCoordinatorByUserUJI(login)
     if not coordinator:
         return HttpResponseForbidden()
     
     return f(user=coordinator, *args, **kwargs)
Beispiel #11
0
def estadoValoracion(request, login, course, alumnoid):
    evaluationSystem = QueryEvaluationSystem().getEvaluationSystemByCourse(
        course)
    if not evaluationSystem:
        return HttpResponseNotFound()

    if not evaluationSystem.isActive():
        return HttpResponseNotFound()

    student = QueryStudent().getStudentByUserUJI(alumnoid)
    if not student: return HttpResponseNotFound()

    project = QueryProject().getProjectByCourseAndStudent(course, student)
    if not (project): return HttpResponseNotFound()
    coordinator = False
    if login == alumnoid:
        rol = "A"
    else:
        if login in QueryProject().getloginByRol(
                project, "TU") and "professorat" in request.path:
            rol = "TU"
            user = QueryUser().getUserByUserUJI(login)
            if not user: return HttpResponseForbidden()
        else:
            coordinator = QueryUser().getUserCoordinatorByUserUJI(login)
            if not coordinator: return HttpResponseForbidden()
            user = coordinator
            rol = "C"

    hitos = QueryEvaluationSystemTreeCompleteOfProject(project, True,
                                                       rol).getList()

    grupos = True
    activar = project.isUnresolved()
    cursoActual = QueryCourse().getLastCourse() == course
    return render_to_response("sistemaEvaluacionValoradoListado.html",
                              locals())
Beispiel #12
0
    class Tutor():
        def __init__(self, tutorId):
            self.tutorId = tutorId
            self.user = None

        def is_valid(self):
            if (not self.is_empty()):
                self.user = QueryUser().getUserById(self.tutorId)
                if self.user.isTutor(): return True
                else: return False
            else:
                return False

        def is_empty(self):
            return self.tutorId == ''
Beispiel #13
0
 class Tutor():
     def __init__(self, tutorId):
         self.tutorId = tutorId
         self.user = None
         
     def is_valid(self):
         if (not self.is_empty()) :
             self.user = QueryUser().getUserById(self.tutorId)
             if self.user.isTutor() : return True
             else: return False
         else:
             return False
     
     def is_empty(self):
         return self.tutorId == ''
Beispiel #14
0
 def getloginByRol(self, project, rol):
     if rol == "A":
         yield project.alumno.usuarioUJI
     elif rol == "TU":
         yield project.tutor.usuarioUJI
     elif rol == "C":
         coordinators = QueryUser().getListOfCoordinator()
         for coordinator in coordinators:
             yield coordinator.usuarioUJI
     elif "TR" in rol:
         listTribunal = QueryJudgeMembers().getListMembersByProject(project)
         for member in listTribunal:
             yield member.miembro.usuarioUJI
     else:
         yield None
Beispiel #15
0
 def save(self, project):
     if not self.project:
         self.project = QueryProject().getProjectByCourseAndStudent(
             QueryCourse().getCourseSelected(self.request), self.student)
     self.judgeMembers = QueryJudgeMembers().getListMembersByProject(
         project)
     for member in self.id_members:
         user = QueryUser().getUserById(member['id_member'])
         memberDB = MiembroTribunal()
         if self.judgeMembers:
             for judgeMember in self.judgeMembers:
                 if judgeMember.idMiembro == member['id']:
                     memberDB = judgeMember
         memberDB.proyecto = project
         memberDB.idMiembro = member['id']
         memberDB.miembro = user
         memberDB.save()
Beispiel #16
0
def listadoProyectosCoordinadorProfesor(request, user, course, profesorid):
    user = QueryUser().getUserByUserUJI(profesorid)
    if not user:
        return HttpResponseNotFound()

    titulo = "Projectes que tutoritza " + user.nombre
    enCurso = gruposProyectosEnCursoProfesor(course, user)
    finalizados = QueryProject().getListProjectByCourseStatusTutor(
        course, "F", user)
    anyadir = isEditable(course)
    editar = isEditable(course)
    grupos = enCurso
    vacio = not enCurso and not finalizados
    cursos = QueryCourse().getListCourse(request)
    fechaTope = course.fechaTope.strftime(
        '%d/%m/%Y') if course.fechaTope else None
    return render_to_response('proyectoListado.html', locals())
Beispiel #17
0
def emailAvisoProyectoEnRevision(project, item, warningCoordinators):
    subject = u"Necesitat d'intervenció en el projecte de l'alumne " + unicode(
        project.alumno.nombreCompleto()) + " per activar" + unicode(
            item).lower()
    if warningCoordinators:
        to = QueryUser().getMailCoordinator()
    else:
        to = project.tutor.getMail()
    email = EvaluaMailMessage(to, subject)
    body = ""
    body += u"El projecte de l'alumne " + project.alumno.nombreCompleto(
    ) + u" necesita una revisió de la teva part per activar " + unicode(
        item).lower() + ".\n"
    body += "\n"
    body += u"Per favor, accedeix a l'administració del projecte y introduiex les dades necessàries.\n"
    body += "http://" + SERVER_NAME + "/professorat/projectes/" + project.alumno.usuarioUJI + "/edita/" + ' \n'

    email.defineMessage(body)
    email.send()
Beispiel #18
0
def cambiaTutoresAProfesores():
    listadoTutores = QueryUser().getListOfTutor()
    for tutor in listadoTutores:
        tutor.rol = "P"
        tutor.save()
Beispiel #19
0
def gestionProyectos(request,
                     user,
                     course,
                     accion="nuevo",
                     alumnoid="",
                     profesorid=""):
    project = None
    errors = None
    camposErrores = None
    tutor = None

    if not isEditable(course):
        return HttpResponseForbidden()

    profesor = QueryUser().getUserByUserUJI(profesorid) if profesorid else None

    if profesorid and not profesor:
        return HttpResponseNotFound()

    coordinator = False
    if alumnoid:
        student = QueryStudent().getStudentByUserUJI(alumnoid)
        if student:
            project = QueryProject().getProjectByCourseAndStudent(
                course, student)
            revision = QueryProjectUnresolvedInCourse(
            ).getProjectUnresolvedByProject(project)
            if revision:
                errors = mensajeError(revision)
                camposErrores = revision.campos.split(",")
            if user == project.tutor:
                tutor = user if "professorat" in request.path else None
            else:
                if profesor:
                    if profesor != project.tutor:
                        return HttpResponseNotFound()
                if not user.isCoordinator():
                    return HttpResponseNotFound()
        else:
            if accion != "nuevo":
                return HttpResponseNotFound()
    else:
        tutor = user if "professorat" in request.path else None

    if (request.method == "POST"):
        form = ProyectoAlumnoForm(request, accion, alumnoid, tutor)
        if (form.is_valid()):
            form.save()
            if tutor:
                ruta = '/professorat/projectes/'
            else:
                if profesorid:
                    ruta = '/coordinacio/projectes/' + profesorid + '/'
                else:
                    ruta = '/coordinacio/projectes/'
            return HttpResponseRedirect(ruta)
    else:
        form = ProyectoAlumnoForm(request, accion, alumnoid, tutor)

    ocultaCurso = True

    return render_to_response('proyectoGestion.html', locals())
Beispiel #20
0
    def __init__(self, request, action="nuevo", alumnoUserUJI="", tutor=None):
        self.alumno = Alumno()
        self.proyecto = Proyecto()
        self.tutor = None
        self.action = action
        self.request = request
        self.alumnoid = alumnoUserUJI
        self.estado = None
        self.course = QueryCourse().getCourseSelected(self.request)

        self.tutorForm = None
        self.tribunalForm = None
        self.dateForm = None

        coordinator = tutor == None

        if action != "nuevo":
            self.alumno = QueryStudent().getStudentByUserUJI(alumnoUserUJI)
            self.proyecto = QueryProject().getProjectByCourseAndStudent(
                QueryCourse().getCourseSelected(self.request), self.alumno)

            self.estado = self.proyecto.estado
            if coordinator:
                statusProject = QueryStatusProjectInCourse(
                ).getProjectByProject(self.proyecto)
                item = statusProject.hito if statusProject else None
                if self.proyecto.estado == "L":
                    nextItem = QueryItem().getNextItem(
                        item) if item else QueryItem().getFirstItemCourse(
                            self.proyecto.curso)
                else:
                    nextItem = item
                if QueryItem().hasTribunalEvaluationThisItem(nextItem):
                    self.tribunalForm = TribunalForm(request, alumnoUserUJI)

        self.alumnoForm = AlumnoForm(prefix='alumno', instance=self.alumno)
        self.proyectoForm = ProyectoForm(prefix='proyecto',
                                         instance=self.proyecto)
        self.dateForm = EstimateDateItemForm(
            request, alumnoUserUJI) if self.estado != "P" else None

        if coordinator:
            if action != "nuevo":
                self.tutor = self.proyecto.tutor
            self.tutorForm = TutorForm(prefix='tutor')
            self.tutorForm.fields["tutor"].queryset = QueryUser(
            ).getListOfTutorCoordinator()
            self.tutorForm.initial["tutor"] = self.tutor
        else:
            self.tutor = tutor

        if request.method == 'POST':  # Leer los datos
            if action != "nuevo":
                if coordinator:
                    statusProject = QueryStatusProjectInCourse(
                    ).getProjectByProject(self.proyecto)
                    item = statusProject.hito if statusProject else None
                    if self.estado == "L":
                        nextItem = QueryItem().getNextItem(
                            item) if item else QueryItem().getFirstItemCourse(
                                self.proyecto.curso)
                    else:
                        nextItem = item

                    if QueryItem().hasTribunalEvaluationThisItem(nextItem):
                        self.tribunalForm = TribunalForm(
                            request, alumnoUserUJI)

            self.alumnoForm = AlumnoForm(request.POST,
                                         prefix='alumno',
                                         instance=self.alumno)
            self.proyectoForm = ProyectoForm(request.POST,
                                             prefix='proyecto',
                                             instance=self.proyecto)
            self.dateForm = EstimateDateItemForm(
                request, alumnoUserUJI) if self.estado != "P" else None
            if coordinator:
                self.tutorId = self.proyectoForm.data["tutor-tutor"]
            else:
                self.tutorId = self.tutor.id
Beispiel #21
0
 def getListProjectByCourseSelectedAndTutorUserUJI(self, request,
                                                   tutorUserUJI):
     tutor = QueryUser().getUserByUserUJI(tutorUserUJI)
     return self.getListProjectByCourseAndTutor(
         Course().getByCourseSelected(request), tutor)