Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 798 → Rev 808

/impl/conf/language/MessageResourcesProfile.properties
103,3 → 103,16
 
profile.record.publisher.all=Instituição / Empresa / Conferência / Workshop / Revista
profile.record.publisher.paper=Conferência / Workshop / Revista
 
 
profile.autoBlockMode=Modo de Bloqueio
profile.autoBlockMode.true=Modo de Bloqueio Automatico
profile.autoBlockMode.false=Modo de Bloqueio Manual
 
profile.autoBlock=Em Automático
profile.autoBlock.true=Bloqueado
profile.autoBlock.false=Desbloqueado
 
profile.manualBlock=Em Manual
profile.manualBlock.true=Bloqueado
profile.manualBlock.false=Desbloqueado
/impl/conf/language/MessageResourcesAssessments.properties
New file
0,0 → 1,155
################################################################################
#
# Assessment MESSAGE RESOURCES - Filipe Matos
#
################################################################################
 
# SERVICE ZONE
assessments=Provas de avaliação
assessment.create.assessment=Criar Prova de Avaliação
assessment.list.assessments=Listar Provas de Avaliação
 
# SUBMIT ASSESSMENT
assessment.submit.form.title=Título
assessment.submit.form.type=Tipo
assessment.submit.form.courseUnit=Unidade Curricular
assessment.submit.form.questions=Questões
assessment.submit.form.delete.question=Apagar questão
assessment.submit.form.question=Questão
assessment.submit.form.add.hoption=Adicionar opção horizontal
assessment.submit.form.add.voption=Adicionar opção vertical
assessment.submit.form.add.question=Adicionar questão
assessment.submit.form.quotation.question=Cotação
assessment.submit.form.question.image=Imagem
assessment.submit.form.question.correct=Correcta
assessment.submit.form.evaluationtime=Época de avaliação
assessment.submit.schedule.start.date=Data de inicio
assessment.submit.schedule.end.date=Data de fim
assessment.submit.schedule.assessment.date=Data da prova
assessment.submit.schedule.targetStudents=Estudantes para responder à prova
assessment.submit.schedule.time=Duração (hh:mm)
assessment.submit.schedule.extraTime=Tempo extra (hh:mm)
 
# SUBMIT ASSESSMENTS selects
assessments.type.evaluation=Avaliação final
assessments.type.self-evaluation=Auto-avaliação
assessments.question.type.radio=Escolha múltipla radio
assessments.question.type.check=Escolha múltipla check
assessments.question.type.matrix=Escolha múltipla matriz
assessments.question.type.text=Questão de texto
assessments.question.type.practical=Questão de componente prática
assessments.evaluation.time.continuous=Avaliação Contínua
assessments.evaluation.time.firstexam=Exame Normal
assessments.evaluation.time.secondexam=Exame Recurso
assessments.evaluation.time.thirdexam=Exame Especial
 
#SUBMIT ASSESSMENTS errors
assessment.submit.form.error.need.date=A data de realização da prova é obrigatória
assessment.submit.form.error.need.start.date=A data em que começa a prova é obrigatória
assessment.submit.form.error.need.end.date=A data em que termina a prova é obrigatória
assessment.submit.form.error.need.time=O tempo de realização da prova é obrigatório
assessment.submit.form.error.need.students=Tem de ser selecionado pelo menos um estudante
assessment.submit.form.error.need.questions=É necessário adicionar pelo menos uma questão
assessment.submit.form.error.question.need.label=A {0}ª questão tem de ter texto
assessment.submit.form.error.question.need.quotation=A {0}ª questão tem de ter cotação
assessment.submit.form.error.question.need.hoption=A {0}ª questão tem de ter pelo menos uma opção horizontal
assessment.submit.form.error.question.need.voption=A {0}ª questão tem de ter pelo menos uma opção vertical
assessment.submit.form.error.question.options.need.labels=Todas as opções da {0}ª questão devem estar preenchidas
assessment.submit.form.error.question.need.correct.option=A {0}ª questão tem de ter definidas as opções correctas
assessment.submit.form.error.question.need.hoption.first=Primeiro tem de adicionar uma opção horizontal
assessment.submit.form.error.quotation.total=A cotação total da prova deve ser de 20 valores
assessment.submit.form.error.type.question.text=A prova de auto-avaliação nao pode conter questões de texto
assessment.submit.form.error.type.question.practical=A prova de auto-avaliação nao pode conter questões de componente prática
 
# ANSWER ASSESSMENT
assessment.answer.form.title=Título
assessment.answer.form.courseUnit=Unidade Curricular
assessment.answer.form.course=Curso
assessment.answer.form.owner=Docente
assessment.answer.form.uploadFile=Escolher ficheiro
 
# CORRECTION ASSESSMENT selects
assessments.evaluate.choices=Escolha como pretende efectuar a correcção
assessments.correctA.anonymous=Correcção anónima
assessments.correctA.notAnonymous=Correcção não anónima
assessments.correction.selection.question=Questão a questão
assessments.correction.selection.assessment=Prova a prova
assessment.correction.form.number.responses=Número de Respostas
assessment.correctTo=Corrigir a prova de
assessment.correctTo.anonymous=anónimo
assessment.correctTo.question=Corrigir a questão:
assessment.answer.file=Ficheiro entregue
assessment.answer.correct=Correcta
assessment.answer.incorrect=Errada
assessment.answer.imcomplete=Incompleta
assessment.answer.imcomplete.percentage=Pontuação
assessment.asnwer.note=Nota/Obs
assessment.responses.empty=Não existem mais provas para corrigir
assessment.answers.empty=Não existem mais questões para corrigir
assessment.answer.question=Questão:
assessment.answer.owner:Resposta de
assessment.answer.owner.anonymous:anónimo
 
# LIST ASSESSMENTS
assessment.list.form.title=Título
assessment.list.form.type=Tipo
assessment.list.form.evaluationtime=Época de avaliação
assessment.list.form.courseUnit=Unidade Curricular
assessment.list.form.year=Ano
assessment.list.form.semester=Semestre
assessment.list.form.start.date=Data de Início
assessment.list.form.end.date=Data de Fim
assessment.list.form.assessment.date=Data da prova
assessment.list.form.created.by=Criado por
assessment.list.form.number.responses=Nº Respostas/Inscrições
assessment.list.form.edit.inscriptions=Editar inscrições
assessment.list.form.number.evaluated=Nº de Correcções
assessment.list.form.status=Estado
assessment.list.form.percentage.symbol=%
assessment.list.form.empty=Não existem provas de avaliação
assessment.list.form.quotation=Nota
assessment.list.form.quotation.empty=Por corrigir
 
# LIST ASSESSMENTS options
assessment.list.form.option.edit=Editar
assessment.list.form.option.clone=Replicar
assessment.list.form.option.schedule=Calendarizar
assessment.list.form.option.correct=Corrigir
assessment.list.form.option.generate.evaluations.pdf=Gerar pauta
assessment.list.form.option.download.pdf=Download Pauta
assessment.list.form.option.download.assessment.pdf=Download Enunciado
assessment.list.form.option.download.assessment.response.pdf=Download Prova
 
# STATS
survey.stats.graph.axis.range.label=Nº de Respostas
survey.stats.graph.axis.domain.label=Itens
 
# General MESSAGES
assessment.message.created.success=Prova de avaliação criada com sucesso
assessment.message.edited.success=Prova de avaliação editada com sucesso
assessment.message.scheduled.success=Prova de avaliação calendarizada com sucesso
assessment.message.answered.success=Prova de avaliação respondida com sucesso
assessment.message.corrected.sucess=Prova de avaliação corrigida com sucesso
assessment.message.question.corrected.sucess=Questão corrigida com sucesso
assessment.message.evaluations.pdf.generated.sucess=Pauta gerada com sucesso
assessment.message.operation.started=Operação iniciada com sucesso
 
# TOPNAV
assessment.topnav.create.assessment=Criar Prova de Avaliação
assessment.topnav.list.assessments=Listar Provas de Avaliação
assessment.topnav.schedule.assessment=Calendarizar Prova de Avaliação
assessment.topnav.edit.schedule.assessment=Editar inscrições
assessment.topnav.configure.correct=Configurar Avaliação
assessment.topnav.to.correct=Para corrigir
assessment.topnav.correct.assessment.response=Corrigir resposta a prova de avaliação
assessment.topnav.correct.assessment.questions.responses=Corrigir resposta(s) a questão
assessment.topnav.response.assessment=a responder a prova de avaliação
 
# LIST STATUS
assessment.list.form.status.schedule.assessment=A calendarizar a prova, aguarde...
 
# TO.DO
module.Assessments=Provas de avaliação
assessment.type.todo=Para responder
 
 
/impl/conf/language/MessageResourcesAnnouncements.properties
39,6 → 39,8
announcement.internal.no=Público
announcement.courseunit.internal=Interno aos alunos e docentes da unidade
 
announcement.position=Prioridade do anúncio
 
announcements.type.news=Notícias
announcements.type.top.flash.news=Destaques
announcements.type.bottom.flash.news=Destaques Secundarios
/impl/conf/language/MessageResources.properties
134,8 → 134,8
user.role.sendMailMessages=Enviar Mensagens de Correio Electronico
 
user.role.admin,teacher=Admin e Professor
user.role.assessementsTester=Testador de Provas de Avaliação
 
 
#Filter Errors
fail.role=Lamentamos o incómodo, mas necessita de permissões especiais para aceder a esta área.
fail.owner=Lamentamos o incómodo, mas não tem permissões sobre o objecto ao qual tentou aceder.
335,6 → 335,7
logout.ok=Caro/a {0},<br> Obrigado por usar o nosso serviço.
authentication.first.time=Olá bem-vindo, é a primeira vez que que se esta a ligar
authenticate.already.authenticated=O seu usuário já está autênticado
authenticate.blocked=O seu usuário está bloqueado pelo sistema. Para mais informações contacte o Centro Informático.
username=Nome de Utilizador
password=Palavra Passe
password.again=Repita a password
/impl/conf/WEB-INF/struts/struts-default.xml
187,6 → 187,7
<set-property property="definitions-config"
value="
/WEB-INF/struts/tiles-default.xml,
/WEB-INF/struts/tiles-assessments.xml,
/WEB-INF/struts/tiles-announcements.xml,
/WEB-INF/struts/tiles-banners.xml,
/WEB-INF/struts/tiles-courseunits.xml,
/impl/conf/WEB-INF/web.xml
130,6 → 130,7
<param-name>config</param-name>
<param-value>
/WEB-INF/struts/struts-default.xml,
/WEB-INF/struts/struts-assessment.xml,
/WEB-INF/struts/struts-announcements.xml,
/WEB-INF/struts/struts-banners.xml,
/WEB-INF/struts/struts-courseunits.xml,
/impl/conf/app.properties
78,6 → 78,8
module.srusource=true
#Duarte Santos
module.surveys=true
#Filipe Matos
module.assessments=true
##################################################
# SMS
#
192,6 → 194,7
 
user.role.81=courseValidatePrograms
user.role.82=sendMailMessages
user.role.83=assessementsTester
 
 
 
553,3 → 556,23
srusource.path.condition.pattern.99=.
srusource.path.condition.template.99=(@collection@)
 
 
 
#########################################################################
# Assessments - Filipe Matos
#
assessments.type.0=evaluation
assessments.type.1=self-evaluation
assessments.question.type.0=radio
assessments.question.type.1=check
assessments.question.type.2=matrix
assessments.question.type.3=text
assessments.question.type.4=practical
assessments.evaluation.time.0=continuous
assessments.evaluation.time.1=firstexam
assessments.evaluation.time.2=secondexam
assessments.evaluation.time.3=thirdexam
assessments.correctA.0=anonymous
assessments.correctA.1=notAnonymous
assessments.correction.selection.0=question
assessments.correction.selection.1=assessment
/impl/conf/berserk/sd.xml
1718,4 → 1718,206
 
 
 
<!--Filipe Matos-->
<!--Assessments-->
<service>
<name>CreateEditAssessment</name>
<implementationClass>pt.estgp.estgweb.services.assessments.CreateEditAssessmentService</implementationClass>
<description>Create or edit assessment</description>
<isTransactional>true</isTransactional>
<defaultMethod>createEditAssessmentService</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Teachers"/>
</filterChains>
</service>
<service>
<name>LoadAssessment</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentService</implementationClass>
<description>Load assessment view</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadOwnedAssessments</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentsService</implementationClass>
<description>Load owned assessments</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadOwnedAssessments</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadOwnedResponses</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentResponsesService</implementationClass>
<description>Load owned assessments</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadOwnedResponses</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadEditAssessment</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentService</implementationClass>
<description>Load assessment to edit</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="CanEditAssessment"/>
</filterChains>
</service>
<service>
<name>LoadCloneAssessment</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentService</implementationClass>
<description>Load assessment view to clone</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="OwnersLoadAssessment"/>
</filterChains>
</service>
<service>
<name>LoadScheduleAssessment</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentService</implementationClass>
<description>Load assessment view to clone</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="OwnersLoadAssessment"/>
</filterChains>
</service>
<service>
<name>ScheduleAssessment</name>
<implementationClass>pt.estgp.estgweb.services.assessments.ScheduleAssessmentService</implementationClass>
<description>Schedule assessment</description>
<isTransactional>true</isTransactional>
<defaultMethod>scheduleAssessmentService</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessment"/>-->
</filterChains>
</service>
<service>
<name>LoadAssessmentResponse</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentResponseService</implementationClass>
<description>Load assessment response view</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="OwnersLoadAssessmentResponse"/>
</filterChains>
</service>
<service>
<name>LoadAssessmentResponses</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentResponsesService</implementationClass>
<description>Load assessment response view</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadAssessmentResponses</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessmentResponse"/>-->
</filterChains>
</service>
<service>
<name>LoadQuestionsResponses</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentResponsesService</implementationClass>
<description>Load assessment response view</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadQuestionsResponses</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessmentResponse"/>-->
</filterChains>
</service>
<service>
<name>LoadQuestionResponses</name>
<implementationClass>pt.estgp.estgweb.services.assessments.LoadAssessmentResponsesService</implementationClass>
<description>Load assessment response view</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadQuestionResponses</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessmentResponse"/>-->
</filterChains>
</service>
<service>
<name>InsertAssessmentAnswers</name>
<implementationClass>pt.estgp.estgweb.services.assessments.InsertAssessmentAnswersService</implementationClass>
<description>Insert assessments answers</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="OwnersLoadAssessmentResponse"/>
</filterChains>
</service>
<service>
<name>EvaluateAssessmentResponse</name>
<implementationClass>pt.estgp.estgweb.services.assessments.EvaluateAssessmentsService</implementationClass>
<description>Insert assessments answers</description>
<isTransactional>true</isTransactional>
<defaultMethod>evaluateAssessmentResponse</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessmentResponse"/>-->
</filterChains>
</service>
<service>
<name>EvaluateQuestionResponses</name>
<implementationClass>pt.estgp.estgweb.services.assessments.EvaluateAssessmentsService</implementationClass>
<description>Insert assessments answers</description>
<isTransactional>true</isTransactional>
<defaultMethod>evaluateQuestionResponses</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessmentResponse"/>-->
</filterChains>
</service>
<service>
<name>GenerateEvaluationsPdf</name>
<implementationClass>pt.estgp.estgweb.services.assessments.GeneratePdfService</implementationClass>
<description>Insert assessments answers</description>
<isTransactional>true</isTransactional>
<defaultMethod>generateEvaluationsPdf</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessmentResponse"/>-->
</filterChains>
</service>
<service>
<name>GenerateAssessmentPdf</name>
<implementationClass>pt.estgp.estgweb.services.assessments.GeneratePdfService</implementationClass>
<description>Insert assessments answers</description>
<isTransactional>true</isTransactional>
<defaultMethod>generateAssessmentPdf</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="OwnersLoadAssessment"/>-->
</filterChains>
</service>
 
 
</serviceDefinitions>
/impl/conf/berserk/fd.xml
205,5 → 205,16
<isTransactional>false</isTransactional>
</filter>
<!-- Duarte Santos -->
 
 
 
<!-- Filipe Matos -->
<filter>
<name>CanEditAssessmentClass</name>
<implementationClass>pt.estgp.estgweb.filters.filters.CanEditAssessmentClass</implementationClass>
<description>Checks if the requester can edit specified object</description>
<isTransactional>false</isTransactional>
</filter>
<!-- Filipe Matos -->
</filterDefinitions>
/impl/conf/berserk/fcd.xml
386,4 → 386,37
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass>
</filterChain>
 
 
 
 
<!--Filipe Matos-->
<filterChain>
<name>Teachers</name>
<expression>AuthenticatedUsers &amp;&amp; RoleUsers("teacher")</expression>
<description>Admins Control Chain</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass>
</filterChain>
<filterChain>
<name>CanEditAssessment</name>
<expression>CanEditAssessmentClass("serializable","pt.estgp.estgweb.domain.AssessmentImpl")</expression>
<description>Owner of an object Control Chain</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass>
</filterChain>
<filterChain>
<name>OwnersLoadAssessment</name>
<expression>OwnerUsersClass("serializable","pt.estgp.estgweb.domain.AssessmentImpl")</expression>
<description>Owner of an object Control Chain</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass>
</filterChain>
<filterChain>
<name>OwnersLoadAssessmentResponse</name>
<expression>OwnerUsersClass("serializable","pt.estgp.estgweb.domain.AssessmentResponseImpl")</expression>
<description>Owner of an object Control Chain</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass>
</filterChain>
<!--Filipe Matos-->
</filterChainsDefinitions>
/impl/src/java/pt/estgp/estgweb/utils/DatesUtils.java
206,6 → 206,7
 
public static void main(String [] args)
{
System.out.println(getImportYearIntranet("201213"));
System.out.println(getImportYearBefore("200001"));
System.out.println(getImportYear());
System.out.println(getImportYearFormatted("201314"));
/impl/src/java/pt/estgp/estgweb/Globals.java
237,9 → 237,14
public static final boolean MODULE_STATUS_PROFILE = ConfigProperties.getBooleanProperty("module.profile");
public static final boolean MODULE_STATUS_COURSEUNITS = ConfigProperties.getBooleanProperty("module.courseunits");
public static final boolean MODULE_STATUS_SMS = ConfigProperties.getBooleanProperty("module.sms");
// Duarte Santos
// Duarte Santos
public static final boolean MODULE_STATUS_SURVEYS = ConfigProperties.getBooleanProperty("module.surveys");
// Duarte Santos
 
//Filipe Matos
public static final boolean MODULE_STATUS_ASSESSMENTS = ConfigProperties.getBooleanProperty("module.assessments");
//Filipe Matos
 
public static final String SURVEY_TYPE_GENERAL = ConfigProperties.getProperty("surveys.type.0");
public static final String SURVEY_TYPE_PEDAGOGIC = ConfigProperties.getProperty("surveys.type.1");
public static final String SURVEY_PEDAGOGIC_STUDENT_COURSEUNIT = ConfigProperties.getProperty("surveys.target.pair.0");
249,6 → 254,23
public static final String SURVEY_QUESTION_TYPE_MATRIX = ConfigProperties.getProperty("surveys.question.type.2");
public static final String SURVEY_QUESTION_TYPE_TEXT = ConfigProperties.getProperty("surveys.question.type.3");
 
//Filipe Matos
public static final String ASSESSMENT_TYPE_EVALUATION = ConfigProperties.getProperty("assessments.type.0");
public static final String ASSESSMENT_TYPE_SELFEVALUATION = ConfigProperties.getProperty("assessments.type.1");
public static final String ASSESSMENT_QUESTION_TYPE_RADIO = ConfigProperties.getProperty("assessments.question.type.0");
public static final String ASSESSMENT_QUESTION_TYPE_CHECK = ConfigProperties.getProperty("assessments.question.type.1");
public static final String ASSESSMENT_QUESTION_TYPE_MATRIX = ConfigProperties.getProperty("assessments.question.type.2");
public static final String ASSESSMENT_QUESTION_TYPE_TEXT = ConfigProperties.getProperty("assessments.question.type.3");
public static final String ASSESSMENT_QUESTION_TYPE_PRACTICAL = ConfigProperties.getProperty("assessments.question.type.4");
public static final String ASSESSMENT_EVALUATION_TIME_CONTINUOUS = ConfigProperties.getProperty("assessments.evaluation.time.0");
public static final String ASSESSMENT_EVALUATION_TIME_FIRSTEXAM = ConfigProperties.getProperty("assessments.evaluation.time.1");
public static final String ASSESSMENT_EVALUATION_TIME_SECONDEXAM = ConfigProperties.getProperty("assessments.evaluation.time.2");
public static final String ASSESSMENT_EVALUATION_TIME_THIRDEXAM = ConfigProperties.getProperty("assessments.evaluation.time.3");
public static final String ASSESSMENT_ANSWER_CORRECT = ConfigProperties.getProperty("assessment.answer.correct");
public static final String ASSESSMENT_ANSWER_INCORRECT = ConfigProperties.getProperty("assessment.answer.incorrect");
public static final String ASSESSMENT_ANSWER_IMCOMPLETE = ConfigProperties.getProperty("assessment.answer.imcomplete");
//
public static final String TEMPLATE_COURSE_XSL_PATH = "/template/xsd/fragmentoCurso.xsl";
public static final String TEMPLATE_XSD_PATH = "/template/xsd";
public static final String TEMPLATE_EMAIL_PATH = "/template/email";
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitDirPackageService.java
41,11 → 41,12
{
if(importYear == null || importYear.trim().length() == 0)
importYear = DatesUtils.getImportYear();
String importYearIntranet = DatesUtils.getImportYearIntranet();
String importYearIntranet = DatesUtils.getImportYearIntranet(importYear);
String tmpName = BytesUtils.generateHexKey();
String tmpDir = Globals.TMP_DIR + "/" + tmpName;
new File(tmpDir).mkdirs();
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(importYear);
//List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(importYear);
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll();
try
{
FileWriter batRunner = new FileWriter(tmpDir + "/create.bat");
53,98 → 54,107
String back = "";
for(Course c: courses)
{
String couseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(c.getName()) + '.' + c.getCode();
File courseDir = new File(couseDirPath);
courseDir.mkdirs();
try
//O curso é sempre o mesmo ID mas muda de Ano consoante o ano de importação
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(),importYear);
if(courseUnits == null || courseUnits.size() == 0)
{
String courseImportYearPathDos = couseDirPath + "\\" + importYearIntranet;
String courseImportYearPath = couseDirPath + "/" + importYearIntranet;
File courseImportYearDir = new File(courseImportYearPath);
courseImportYearDir.mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A).mkdirs();
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_SETUP_FILE_NAME);
logger.info("Skipping course: " + c.getCode() + ":" + c.getName() + " zero units in " + importYear);
}
else{
String couseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(c.getName()) + '.' + c.getCode();
File courseDir = new File(couseDirPath);
courseDir.mkdirs();
try
{
 
String callPathS1 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_S1 + "\\").substring(tmpDir.length() + 1);
String callPathS2 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_S2 + "\\").substring(tmpDir.length() + 1);
String callPathA = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_A + "\\").substring(tmpDir.length() + 1);
batRunner.write("cd " + back + callPathS1);
back = "..\\..\\..\\";
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
batRunner.write("cd " + back + callPathS2);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
batRunner.write("cd " + back + callPathA);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
FileWriter confWriterSemestre1 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterSemestre2 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterA = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
String courseImportYearPathDos = couseDirPath + "\\" + importYearIntranet;
String courseImportYearPath = couseDirPath + "/" + importYearIntranet;
File courseImportYearDir = new File(courseImportYearPath);
courseImportYearDir.mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2).mkdirs();
new File(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A).mkdirs();
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_SETUP_FILE_NAME);
FilesUtils.copy(CreateCourseUnitDirPackageService.class.getResourceAsStream(Globals.INTRANET_SETUP_FILE),courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_SETUP_FILE_NAME);
 
String callPathS1 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_S1 + "\\").substring(tmpDir.length() + 1);
String callPathS2 = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_S2 + "\\").substring(tmpDir.length() + 1);
String callPathA = (courseImportYearPathDos + "\\" + Globals.INTRANET_SEMESTRE_A + "\\").substring(tmpDir.length() + 1);
batRunner.write("cd " + back + callPathS1);
back = "..\\..\\..\\";
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
batRunner.write("cd " + back + callPathS2);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
batRunner.write("cd " + back + callPathA);
batRunner.write("\n");
batRunner.write(Globals.INTRANET_SETUP_FILE_NAME + " " + Globals.INTRANET_USERS_SETUP_FILE_NAME);
batRunner.write("\n");
FileWriter confWriterSemestre1 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S1 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterSemestre2 = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_S2 + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
FileWriter confWriterA = new FileWriter(courseImportYearPath + "/" + Globals.INTRANET_SEMESTRE_A + "/" + Globals.INTRANET_USERS_SETUP_FILE_NAME);
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(),importYear);
for(CourseUnit courseUnit: courseUnits)
{
FileWriter nowWriter;
String semestre;
if(courseUnit.getSemestre().equals("S1"))
 
// List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(),importYear);
for(CourseUnit courseUnit: courseUnits)
{
nowWriter = confWriterSemestre1;
semestre = Globals.INTRANET_SEMESTRE_S1;
}
else if(courseUnit.getSemestre().equals("S2"))
{
nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_S2;
}
else
{
nowWriter = confWriterA;
semestre = Globals.INTRANET_SEMESTRE_A;
}
FileWriter nowWriter;
String semestre;
if(courseUnit.getSemestre().equals("S1"))
{
nowWriter = confWriterSemestre1;
semestre = Globals.INTRANET_SEMESTRE_S1;
}
else if(courseUnit.getSemestre().equals("S2"))
{
nowWriter = confWriterSemestre2;
semestre = Globals.INTRANET_SEMESTRE_S2;
}
else
{
nowWriter = confWriterA;
semestre = Globals.INTRANET_SEMESTRE_A;
}
 
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
courseUnit.setNormalizedName(normalizedName);
courseUnit.setPathIntranet(unitPath.substring(tmpDir.length()));
nowWriter.write(normalizedName);
System.out.println("GENERATING LINE: " + normalizedName);
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
courseUnit.setNormalizedName(normalizedName);
courseUnit.setPathIntranet(unitPath.substring(tmpDir.length()));
nowWriter.write(normalizedName);
System.out.println("GENERATING LINE: " + normalizedName);
 
if(courseUnit.getTeachers() != null)
{
String users = "";
int counter = 0;
for(Teacher t: courseUnit.getTeachers())
if(courseUnit.getTeachers() != null)
{
if(t.getUsername() != null)
String users = "";
int counter = 0;
for(Teacher t: courseUnit.getTeachers())
{
users += " " + t.getUsername();
counter++;
if(t.getUsername() != null)
{
users += " " + t.getUsername();
counter++;
}
}
nowWriter.write(" " + counter + users);
nowWriter.write("\n");
}
nowWriter.write(" " + counter + users);
nowWriter.write("\n");
}
confWriterSemestre1.flush();
confWriterSemestre2.flush();
confWriterA.flush();
confWriterSemestre1.close();
confWriterSemestre2.close();
confWriterA.close();
}
confWriterSemestre1.flush();
confWriterSemestre2.flush();
confWriterA.flush();
confWriterSemestre1.close();
confWriterSemestre2.close();
confWriterA.close();
catch (IOException e)
{
logger.error(e,e);
}
}
catch (IOException e)
{
logger.error(e,e);
}
}
batRunner.write("cd " + back);
batRunner.close();
161,8 → 171,8
 
public static void main(String[] args) throws ServiceException
{
String teste = "Sistemas Térmicos, Hidráulicos e Pneumáticos";
System.out.println(StringsUtils.normalizeResourceName(teste));
String teste = "Sistemas Térmicos, Hidráulicos e Pneumáticos";
System.out.println(StringsUtils.normalizeResourceName(teste));
// AbstractDao.getCurrentSession().beginTransaction();
// new CreateCourseUnitDirPackageService().run(null,null);
// AbstractDao.getCurrentSession().getTransaction().commit();
/impl/src/java/pt/estgp/estgweb/services/common/ModuleEnum.java
2,13 → 2,14
 
import pt.estgp.estgweb.services.announcements.AnnouncementsCommonServices;
import pt.estgp.estgweb.services.announcements.TodoAnnouncementsCommonServices;
import pt.estgp.estgweb.services.email.EmailCommonServices;
import pt.estgp.estgweb.services.reminders.RemindersCommonServices;
import pt.estgp.estgweb.services.assessments.AssessmentsCommonServices;
import pt.estgp.estgweb.services.blogs.BlogPostsCommonServices;
import pt.estgp.estgweb.services.blogs.BlogsCommonServices;
import pt.estgp.estgweb.services.blogs.BlogPostsCommonServices;
import pt.estgp.estgweb.services.courses.CoursesCommonServices;
import pt.estgp.estgweb.services.courseunits.CourseUnitsCommonServices;
import pt.estgp.estgweb.services.courses.CoursesCommonServices;
import pt.estgp.estgweb.services.email.EmailCommonServices;
import pt.estgp.estgweb.services.profile.ProfileCommonServices;
import pt.estgp.estgweb.services.reminders.RemindersCommonServices;
import pt.estgp.estgweb.services.srusources.SruSourcesCommonServices;
import pt.estgp.estgweb.services.surveys.SurveysCommonServices;
 
34,8 → 35,10
// Questionarios("module.Qustionarios", new QuestionariosCommonServices());
SruSource("module.SruSource", new SruSourcesCommonServices()),
// Duarte Santos
Surveys("module.Surveys", new SurveysCommonServices());
Surveys("module.Surveys", new SurveysCommonServices()),
 
// Filipe Matos
Assessments("module.Assessments", new AssessmentsCommonServices());
// Events("module.Events",null),
// Blogs("module.Blogs",null),
// Proxy("module.Proxy",null);
/impl/src/java/pt/estgp/estgweb/services/assessments/CreateEditAssessmentService.java
New file
0,0 → 1,188
package pt.estgp.estgweb.services.assessments;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentQuestionItemView;
import pt.estgp.estgweb.domain.views.AssessmentQuestionPossibleAnswerView;
import pt.estgp.estgweb.domain.views.AssessmentQuestionView;
import pt.estgp.estgweb.domain.views.AssessmentView;
import pt.estgp.estgweb.services.data.ImageManager;
import pt.estgp.estgweb.services.surveys.SurveyStatusEnum;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.Date;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 31/Jul/2013
* Time: 16:46:26
* To change this template use File | Settings | File Templates.
*/
public class CreateEditAssessmentService implements IService{
 
private static final Logger logger = Logger.getLogger(CreateEditAssessmentService.class);
 
public AssessmentView createEditAssessmentService(AssessmentView assessmentView, UserSession userSession)
{
// Assessment
AssessmentImpl a;
if(assessmentView.getId() <= 0)
{
a = DomainObjectFactory.createAssessmentImpl();
assessmentView.persistViewInObject(a);
a.setOwner(userSession.getUser());
a.setSemester(DatesUtils.getSemestre());
a.setYear(DatesUtils.getImportYear());
a.setSaveDate(new Date());
a.setStatusPercentage(0);
a.setStatus(SurveyStatusEnum.STATUS_STOPPED.getStatus());
CourseUnit cU = DaoFactory.getCourseUnitDaoImpl().get(assessmentView.getCourseUnit().getId());
a.setCourseUnit(cU);
 
DaoFactory.getAssessmentDaoImpl().save(a);
}
else
{
// delete questions, items, possibles
processDeletedObjects(assessmentView);
a = DaoFactory.getAssessmentDaoImpl().get(assessmentView.getId());
assessmentView.persistViewInObject(a);
CourseUnit cU = DaoFactory.getCourseUnitDaoImpl().get(assessmentView.getCourseUnit().getId());
a.setCourseUnit(cU);
}
 
// AssessmentQuestions
for(AssessmentQuestionView questionView: assessmentView.getQuestions())
{
AssessmentQuestion q;
if(questionView.getId() <= 0)
{
q = DomainObjectFactory.createAssessmentQuestionImpl();
questionView.persistViewInObject(q);
q.setAssessment(a);
//image
if(questionView.getImage() != null)
{
DaoFactory.getImageDaoImpl().save(questionView.getImage());
ImageManager.store((ImageImpl) questionView.getImage());
((ImageImpl)questionView.getImage()).setImage(null);
q.setImage(questionView.getImage());
}
DaoFactory.getAssessmentQuestionDaoImpl().save(q);
}
else
{
q = DaoFactory.getAssessmentQuestionDaoImpl().get(questionView.getId());
questionView.persistViewInObject(q);
//image
if(questionView.getImage() != null)
{
if(q.getImage() != null)
{
DaoFactory.getImageDaoImpl().delete(q.getImage().getId());
}
DaoFactory.getImageDaoImpl().save(questionView.getImage());
ImageManager.store((ImageImpl) questionView.getImage());
q.setImage(questionView.getImage());
}
}
 
// AssessmentQuestionItems
for(AssessmentQuestionItemView itemView: questionView.getQuestionItems())
{
AssessmentQuestionItem qi;
if(itemView.getId() <= 0)
{
qi = DomainObjectFactory.createAssessmentQuestionItemImpl();
itemView.persistViewInObject(qi);
qi.setQuestion(q);
DaoFactory.getAssessmentQuestionItemDaoImpl().save(qi);
}
else
{
qi = DaoFactory.getAssessmentQuestionItemDaoImpl().get(itemView.getId());
itemView.persistViewInObject(qi);
}
 
// AssessmentQuestionPossibleAnswers
for(AssessmentQuestionPossibleAnswerView possibleAnswerView: itemView.getPossibleAnswers())
{
AssessmentQuestionPossibleAnswer pa;
if(possibleAnswerView.getId() <= 0)
{
pa = DomainObjectFactory.createAssessmentQuestionPossibleAnswerImpl();
possibleAnswerView.persistViewInObject(pa);
pa.setQuestionItem(qi);
DaoFactory.getAssessmentQuestionPossibleAnswerDaoImpl().save(pa);
}
else
{
pa = DaoFactory.getAssessmentQuestionPossibleAnswerDaoImpl().get(possibleAnswerView.getId());
possibleAnswerView.persistViewInObject(pa);
}
}
}
}
 
AssessmentView view = new AssessmentView(a);
 
AbstractDao.getCurrentSession().flush();
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
 
return view;
 
}
 
private void processDeletedObjects(AssessmentView assessmentView)
{
 
String deletedCandidatesIdsStr = assessmentView.getDeletedCandidates();
if(deletedCandidatesIdsStr != null)
{
String[] deletedCandidatesIds = deletedCandidatesIdsStr.split(",");
for(String deletedCandidateId : deletedCandidatesIds)
{
if(deletedCandidateId.length() <= 0) continue;
long id = Long.parseLong(deletedCandidateId);
AssessmentQuestionPossibleAnswerImpl pa = (AssessmentQuestionPossibleAnswerImpl) DaoFactory.getAssessmentQuestionPossibleAnswerDaoImpl().load(id);
DaoFactory.getAssessmentQuestionPossibleAnswerDaoImpl().delete(pa);
}
}
 
String deletedItemsIdsStr = assessmentView.getDeletedItems();
if(deletedItemsIdsStr != null)
{
String[] deletedItemsIds = deletedItemsIdsStr.split(",");
for(String deletedItemId : deletedItemsIds)
{
if(deletedItemId.length() <= 0) continue;
long id = Long.parseLong(deletedItemId);
AssessmentQuestionItemImpl qi = (AssessmentQuestionItemImpl) DaoFactory.getAssessmentQuestionItemDaoImpl().load(id);
DaoFactory.getAssessmentQuestionItemDaoImpl().delete(qi);
}
}
 
String deletedQuestionsIdsStr = assessmentView.getDeletedQuestions();
if(deletedQuestionsIdsStr != null)
{
String[] deletedQuestionsIds = deletedQuestionsIdsStr.split(",");
for(String deletedQuestionId : deletedQuestionsIds)
{
if(deletedQuestionId.length() <= 0) continue;
long id = Long.parseLong(deletedQuestionId);
AssessmentQuestionImpl q = (AssessmentQuestionImpl) DaoFactory.getAssessmentQuestionDaoImpl().load(id);
//delete image
if(q.getImage() != null)
{
DaoFactory.getImageDaoImpl().delete(q.getImage().getId());
}
DaoFactory.getAssessmentQuestionDaoImpl().delete(q);
}
}
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/EvaluateAssessmentsService.java
New file
0,0 → 1,153
package pt.estgp.estgweb.services.assessments;
 
import com.itextpdf.text.DocumentException;
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.Assessment;
import pt.estgp.estgweb.domain.AssessmentQuestionAnswer;
import pt.estgp.estgweb.domain.AssessmentResponse;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentQuestionAnswerView;
import pt.estgp.estgweb.domain.views.AssessmentResponseView;
import pt.estgp.estgweb.domain.views.AssessmentView;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.io.IOException;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 6/Ago/2013
* Time: 2:20:23
* To change this template use File | Settings | File Templates.
*/
public class EvaluateAssessmentsService implements IService {
 
private static final Logger logger = Logger.getLogger(EvaluateAssessmentsService.class);
 
private LoadAssessmentResponseService loadAssessmentResponseService = new LoadAssessmentResponseService();
private GeneratePdfService generatePdfService = new GeneratePdfService();
 
public AssessmentResponseView evaluateAssessmentResponse(AssessmentResponseView assessmentResponseView, UserSession userSession)
{
AssessmentResponse response = DaoFactory.getAssessmentResponseDaoImpl().get(assessmentResponseView.getId());
 
if(response.isEvaluated()) return null;
 
for(AssessmentQuestionAnswerView aView : assessmentResponseView.getAnswers())
{
AssessmentQuestionAnswer answer = DaoFactory.getAssessmentQuestionAnswerDaoImpl().get(aView.getId());
aView.persistViewInObject(answer);
answer.setEvaluated(true);
//se estiver errada
if(aView.getAnswerCorrectS().equals("incorrect"))
{
answer.setQuotation(0);
}
else{
double quotation = answer.getPossibleAnswer().getQuestionItem().getQuestion().getQuotation();
if(aView.getAnswerCorrectS().equals("correct"))
{
answer.setQuotation(quotation);
}
if(aView.getAnswerCorrectS().equals("incomplete"))
{
//double quotationAnswer = quotation * (aView.getPercentage()*0.01);
answer.setQuotation(aView.getPercentage());
}
}
}
 
//somar as cotações para atribuir cotação a resposta e colocar como avaliada
double quotationTotal=0;
for(AssessmentQuestionAnswer aQa : response.getAnswers())
{
quotationTotal+=aQa.getQuotation();
}
response.setEvaluated(true);
response.setQuotation(quotationTotal);
try {
generatePdfService.generateAssessmentResponsePdf(response.getId(),response.getAssessment().getId(),userSession);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (DocumentException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
 
logger.info("Evaluate assessment response with id: "+assessmentResponseView.getId());
 
return loadAssessmentResponseService.run(assessmentResponseView.getId(), userSession);
}
 
 
public AssessmentView evaluateQuestionResponses(List<AssessmentQuestionAnswerView> questionAnswersView, UserSession userSession)
{
long assessmentId=0; //para usar em baixo
for(AssessmentQuestionAnswerView aView : questionAnswersView)
{
AssessmentQuestionAnswer answer = DaoFactory.getAssessmentQuestionAnswerDaoImpl().get(aView.getId());
aView.persistViewInObject(answer);
answer.setEvaluated(true);
assessmentId = answer.getResponse().getAssessment().getId();
//se estiver errada
if(aView.getAnswerCorrectS().equals("incorrect"))
{
answer.setQuotation(0);
}
else{
double quotation = answer.getPossibleAnswer().getQuestionItem().getQuestion().getQuotation();
if(aView.getAnswerCorrectS().equals("correct"))
{
answer.setQuotation(quotation);
}
if(aView.getAnswerCorrectS().equals("incomplete"))
{
//double quotationAnswer = quotation * (aView.getPercentage()*0.01);
answer.setQuotation(aView.getPercentage());
}
}
}
 
//carregar as respostas e verificar se as answers já estão todas corrigidas
//para somar as cotações para atribuir cotação a resposta e colocar como avaliada
List<AssessmentResponse> responses = DaoFactory.getAssessmentResponseDaoImpl().loadResponsesByAssessmentIdAnswered(assessmentId);
for(AssessmentResponse response : responses)
{
boolean evaluated = true;
double quotationTotal=0;
for(AssessmentQuestionAnswer aQa : response.getAnswers())
{
if(!aQa.isEvaluated())
{
evaluated=false;
}
quotationTotal+=aQa.getQuotation();
}
if(evaluated)
{
response.setEvaluated(true);
response.setQuotation(quotationTotal);
try {
generatePdfService.generateAssessmentResponsePdf(response.getId(),response.getAssessment().getId(),userSession);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (DocumentException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
}
 
logger.info("Evaluate questions response");
 
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
 
Assessment assessment = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
AssessmentView assessmentView = new AssessmentView(assessment);
 
return assessmentView;
}
 
}
/impl/src/java/pt/estgp/estgweb/services/assessments/ScheduleAssessmentService.java
New file
0,0 → 1,155
package pt.estgp.estgweb.services.assessments;
 
import com.itextpdf.text.DocumentException;
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentView;
import pt.estgp.estgweb.services.surveys.SurveyStatusEnum;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 3/Ago/2013
* Time: 2:12:31
* To change this template use File | Settings | File Templates.
*/
public class ScheduleAssessmentService implements IService, Runnable {
 
private static final Logger logger = Logger.getLogger(ScheduleAssessmentService.class);
private static final int MAX_COMMIT = 100;
 
private long assessmentId;
private HttpServletRequest request;
private UserSession userSession;
private List<Long> selectedUsersId;
 
private GeneratePdfService generatePdfService = new GeneratePdfService();
 
 
public AssessmentView scheduleAssessmentService(AssessmentView assessmentView, List<Long> selectedUsersId, HttpServletRequest request, UserSession userSession) throws IOException, DocumentException {
// AssessmentImpl a = DaoFactory.getAssessmentDaoImpl().get(assessmentView.getId());
AssessmentImpl a = DaoFactory.getAssessmentDaoImpl().load(assessmentView.getId());
if(assessmentView.getStartDate()!=null)
a.setStartDate(assessmentView.getStartDate());
if(assessmentView.getEndDate()!=null)
a.setEndDate(assessmentView.getEndDate());
if(assessmentView.getTime()!=null)
a.setTime(assessmentView.getTime());
 
AssessmentView view = new AssessmentView(a);
 
AbstractDao.getCurrentSession().flush();
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
 
// generate pdf
generatePdfService.generateAssessmentPdf(a.getId(),userSession);
logger.info("Generate assessment pdf");
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
 
// start a thread
ScheduleAssessmentService service = new ScheduleAssessmentService();
service.request = request;
service.assessmentId = a.getId();
service.selectedUsersId = selectedUsersId;
service.userSession = userSession;
 
Thread thread = new Thread(service);
thread.start();
logger.info("Starting thread with id: "+thread.getId());
 
return view;
}
 
private synchronized AssessmentImpl createAssessmentResponses(AssessmentImpl assessment)
{
//primeiro verificar se já há respostas
List<AssessmentResponse> existResponses = DaoFactory.getAssessmentResponseDaoImpl().loadResponsesByAssessmentId(assessment.getId());
if(existResponses != null)
{
for(int i=0;i<existResponses.size();i++)
{
DaoFactory.getAssessmentResponseDaoImpl().delete(existResponses.get(i));
}
}
 
Set<StudentImpl> users = new HashSet<StudentImpl>(0);
users = assessment.getCourseUnit().getStudents();
 
List<AssessmentResponse> responses = new ArrayList<AssessmentResponse>();
for(User user : users)
{
if(selectedUsersId.contains(user.getId()))
{
AssessmentResponse ar = DomainObjectFactory.createAssessmentResponseImpl();
ar.setAnswered(false);
ar.setEvaluated(false);
ar.setOwner(user);
ar.setAssessment(assessment);
responses.add(ar);
}
}
 
if(responses.size() == 0)
{
assessment.setStatus(SurveyStatusEnum.STATUS_STOPPED.getStatus());
assessment.setStatusPercentage(100);
return assessment;
}
 
long i = 0;
int status;
for(AssessmentResponse r : responses)
{
if (i++ % MAX_COMMIT == 0)
{
status = (int)(((double)i/(double)responses.size())*100);
assessment.setStatusPercentage(status);
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
assessment = DaoFactory.getAssessmentDaoImpl().load(assessmentId);
}
DaoFactory.getAssessmentResponseDaoImpl().save(r);
}
assessment.setStatusPercentage(100);
assessment.setStatus(AssessmentStatusEnum.STATUS_STOPPED.getStatus());
 
return assessment;
}
 
 
public void run()
{
logger.info("Running thread...");
AbstractDao.getCurrentSession().beginTransaction();
 
logger.info("Loading assessment with id: "+assessmentId);
AssessmentImpl assessment = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
 
assessment.setStatusPercentage(0);
assessment.setStatus(AssessmentStatusEnum.STATUS_SCHEDULE_ASSESSMENT.getStatus());
 
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
 
assessment = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
 
logger.info("Creating assessment responses...");
assessment = createAssessmentResponses(assessment);
 
AbstractDao.getCurrentSession().getTransaction().commit();
logger.info("End of thread...");
 
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/AssessmentsCommonServices.java
New file
0,0 → 1,69
package pt.estgp.estgweb.services.assessments;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.AssessmentResponseImpl;
import pt.estgp.estgweb.domain.DomainObject;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.common.*;
import pt.estgp.estgweb.services.common.impl.DefaultToDo;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
 
 
public class AssessmentsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(AssessmentsCommonServices.class);
 
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession)
{
return 0;
}
 
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
return search(null,search,searchType,page,maxResults,userSession);
}
 
public ISearchResults search(String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
return null;
}
 
public int countToDo(UserSession userSession)
{
return 0;
}
 
public IToDoCat getToDo(UserSession userSession)
{
return null;
}
 
public List<IToDo> getAllToDos(UserSession userSession)
{
 
 
List<IToDo> todos = new ArrayList<IToDo>();
if(Globals.MODULE_STATUS_ASSESSMENTS){
List<AssessmentResponseImpl> assessmentResponses = DaoFactory.getAssessmentResponseDaoImpl().loadByUserId(userSession.getUser().getId());
for(AssessmentResponseImpl ar: assessmentResponses)
{
String courseUnit = ar.getAssessment().getCourseUnit().getName();
DefaultToDo defaultToDo = new DefaultToDo(ar.getAssessment().getTitle(),null,courseUnit,"assessment.type.todo","/user/startAssessmentResponseFromHome.do?resp="+ar.getId());
todos.add(defaultToDo);
}
}
 
return todos;
}
 
public void adviseNew(DomainObject object)
{}
 
public void adviseUpdate(DomainObject object)
{}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/GeneratePdfService.java
New file
0,0 → 1,802
package pt.estgp.estgweb.services.assessments;
 
import com.itextpdf.text.*;
import com.itextpdf.text.Image;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.draw.LineSeparator;
import jomm.utils.FilesUtils;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentView;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.io.*;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 6/Ago/2013
* Time: 2:20:23
* To change this template use File | Settings | File Templates.
*/
public class GeneratePdfService implements IService {
 
private static final Logger logger = Logger.getLogger(GeneratePdfService.class);
 
private RepositoryService repositoryService = new RepositoryService();
 
public void generateAssessmentPdf(long assessmentId,UserSession userSession) throws IOException, DocumentException {
Assessment assessment = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
////////////////////////////////////////////////
Document doc = null;
OutputStream os = null;
 
try {
//cria o documento tamanho A4, margens de 2,54cm
doc = new Document(PageSize.A4, 72, 72, 72, 72);
//cria a stream de saída
os = new FileOutputStream(Globals.TMP_DIR+"Enunciado"+assessment.getTitle()+".pdf");
//associa a stream de saída ao
PdfWriter.getInstance(doc, os);
//abre o documento
doc.open();
//imagem do cabeçalho
Image img = Image.getInstance(Globals.SITE_URL+"/imgs/logoestg.gif");
img.setAlignment(Element.ALIGN_LEFT);
doc.add(img);
 
//paragrafo em branco
doc.add(new Phrase(" "));
 
//fonts
//primeira linha para o caracteres especiais
// BaseFont specialCharacter = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font fontHeader = new Font(Font.FontFamily.TIMES_ROMAN,14,Font.BOLD);
Font fontBold = new Font(Font.FontFamily.TIMES_ROMAN,10,Font.BOLD);
Font fontNormal = new Font(Font.FontFamily.TIMES_ROMAN,10,Font.NORMAL);
Font fontTextBold = new Font(Font.FontFamily.TIMES_ROMAN,12,Font.BOLD);
Font fontTextNormal = new Font(Font.FontFamily.TIMES_ROMAN,12,Font.NORMAL);
 
//cabeçalho
//unidade curricular
Paragraph courseUnit = new Paragraph(assessment.getCourseUnit().getName(),fontHeader);
courseUnit.setAlignment(Element.ALIGN_CENTER);
doc.add(courseUnit);
 
//primeira linha cabeçalho
String evaluationTime = "";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_CONTINUOUS))
evaluationTime="Avaliação Contínua";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_FIRSTEXAM))
evaluationTime="Exame Normal";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_SECONDEXAM))
evaluationTime="Exame Recurso";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_THIRDEXAM))
evaluationTime="Exame Especial";
 
String yearText = " - Ano lectivo";
String year = " - "+assessment.getYear();
String course = " - "+assessment.getCourseUnit().getCourseName();
Paragraph firstLine = new Paragraph();
firstLine.add(new Chunk(evaluationTime,fontBold));
firstLine.add(new Chunk(yearText,fontNormal));
firstLine.add(new Chunk(year,fontNormal));
firstLine.add(new Chunk(course,fontNormal));
firstLine.setAlignment(Element.ALIGN_CENTER);
doc.add(firstLine);
 
//segunda linha cabeçalho
String dateText = "Data:";
String date = " "+ DatesUtils.getStringFromDate(assessment.getStartDate());
String timeText = " - Duração:";
String time = " "+String.valueOf(assessment.getTime().getHours())+":"+String.valueOf(assessment.getTime().getMinutes());
String ownerText = " - Docente:";
String owner = " "+assessment.getOwner().getName();
Paragraph secondLine = new Paragraph();
secondLine.add(new Chunk(dateText,fontBold));
secondLine.add(new Chunk(date,fontNormal));
secondLine.add(new Chunk(timeText,fontBold));
secondLine.add(new Chunk(time,fontNormal));
secondLine.add(new Chunk(ownerText,fontBold));
secondLine.add(new Chunk(owner,fontNormal));
secondLine.setAlignment(Element.ALIGN_CENTER);
doc.add(secondLine);
 
//paragrafo em branco
//doc.add(new Paragraph("Barra pah",fontNormal));
doc.add(Chunk.NEWLINE);
//Barra horizontal
LineSeparator objectName = new LineSeparator();
doc.add(objectName);
doc.add(Chunk.NEWLINE);
 
//questões
int numberQ=0;
for(AssessmentQuestion question : assessment.getQuestions())
{
numberQ++;
String numberQuotation = String.valueOf(numberQ) + ". ("+String.valueOf(question.getQuotation())+") ";
String questionText = question.getTextpt();
Paragraph questionP = new Paragraph();
questionP.add(new Chunk(numberQuotation,fontTextBold));
questionP.add(new Chunk(questionText,fontTextNormal));
questionP.setAlignment(Element.ALIGN_JUSTIFIED);
doc.add(questionP);
if(question.getImage()!=null)
{
Image image = Image.getInstance(Globals.SITE_URL+"/imageStream/"+question.getImage().getId());
image.setAlignment(Element.ALIGN_LEFT);
doc.add(image);
}
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO) || question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK))
{
for(AssessmentQuestionItem item : question.getQuestionItems())
{
for(AssessmentQuestionPossibleAnswer pA : item.getPossibleAnswers())
{
Image imagePa=null;
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO))
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/radiobox.png");
else
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/checkbox.png");
imagePa.setAlignment(Element.PARAGRAPH);
Paragraph pAP = new Paragraph();
pAP.add(new Chunk(imagePa, -1.00f, -2.00f));
pAP.add(new Chunk(" "+pA.getTextpt(),fontTextNormal));
pAP.setAlignment(Element.ALIGN_JUSTIFIED);
doc.add(pAP);
}
}
}
 
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
PdfPTable table = null;
int numPossibles=0;
//construir tabela
//para saber o numero de respostas possiveis
for(AssessmentQuestionItem itemTam : question.getQuestionItems())
{
numPossibles = itemTam.getPossibleAnswers().size()+1;
table = new PdfPTable(numPossibles);
PdfPCell colunaVazia = new PdfPCell(new Paragraph());
colunaVazia.setBorder(0);
table.addCell(colunaVazia);
for(AssessmentQuestionPossibleAnswer possibleTam : itemTam.getPossibleAnswers())
{
PdfPCell possible = new PdfPCell(new Paragraph(possibleTam.getTextpt(),fontTextNormal));
possible.setBorder(0);
table.addCell(possible);
}
break;
}
 
for(AssessmentQuestionItem item : question.getQuestionItems())
{
PdfPCell item1 = new PdfPCell(new Paragraph(item.getTextpt(),fontTextNormal));
item1.setBorder(0);
table.addCell(item1);
for(AssessmentQuestionPossibleAnswer pA : item.getPossibleAnswers())
{
Image imagePa= Image.getInstance(Globals.SITE_URL+"/imgs/radiobox.png");
PdfPCell imageCell = new PdfPCell(imagePa);
imageCell.setBorder(0);
table.addCell(imageCell);
}
}
float splitWidth = 1.0f / (float)numPossibles;
float[] tams = new float[numPossibles];
for(int i=0;i<numPossibles;i++)
{
tams[i] = splitWidth;
}
table.setWidths(tams);
table.setWidthPercentage(100.0f);
doc.add(table);
}
doc.add(Chunk.NEWLINE);
}
 
} finally {
if (doc != null) {
//fechamento do documento
doc.close();
}
if (os != null) {
//fechamento da stream de saída
os.close();
}
}
 
//repositoryStream
String fileName = Globals.TMP_DIR+"Enunciado"+assessment.getTitle()+".pdf";
File file = new File(fileName);
String extension = FilesUtils.getExtension(fileName);
String description = "assessment.file "+assessment.getCourseUnit().getName();
FileInputStream inputStream = new FileInputStream(file);
String identifier = assessment.getIdentifier();
 
if(identifier==null)
identifier = repositoryService.storeRepositoryFile(inputStream,"application/pdf",extension,(int)file.length(),file.getName(),description, ResourceAccessControlEnum.publicDomain,userSession);
else
repositoryService.updateRepositoryFile(identifier,inputStream, "application/pdf",extension,(int)file.length(),file.getName(),description, ResourceAccessControlEnum.publicDomain);
 
assessment.setIdentifier(identifier);
 
// return new AssessmentView(assessment);
}
 
public void generateAssessmentResponsePdf(long assessmentResponseId,long assessmentId,UserSession userSession) throws IOException, DocumentException {
AssessmentResponse assessmentResponse = DaoFactory.getAssessmentResponseDaoImpl().get(assessmentResponseId);
Assessment assessment = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
////////////////////////////////////////////////
Document doc = null;
OutputStream os = null;
 
try {
//cria o documento tamanho A4, margens de 2,54cm
doc = new Document(PageSize.A4, 72, 72, 72, 72);
//cria a stream de saída
os = new FileOutputStream(Globals.TMP_DIR+"Resposta"+assessment.getTitle()+String.valueOf(assessmentResponse.getId())+".pdf");
//associa a stream de saída ao
PdfWriter.getInstance(doc, os);
//abre o documento
doc.open();
//imagem do cabeçalho
Image img = Image.getInstance(Globals.SITE_URL+"/imgs/logoestg.gif");
img.setAlignment(Element.ALIGN_LEFT);
doc.add(img);
 
//paragrafo em branco
doc.add(new Phrase(" "));
 
//fonts
//primeira linha para o caracteres especiais
// BaseFont specialCharacter = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font fontHeader = new Font(Font.FontFamily.TIMES_ROMAN,14,Font.BOLD);
Font fontBold = new Font(Font.FontFamily.TIMES_ROMAN,10,Font.BOLD);
Font fontNormal = new Font(Font.FontFamily.TIMES_ROMAN,10,Font.NORMAL);
Font fontTextBold = new Font(Font.FontFamily.TIMES_ROMAN,12,Font.BOLD);
Font fontTextNormal = new Font(Font.FontFamily.TIMES_ROMAN,12,Font.NORMAL);
Font fontTextEvaluate = new Font(Font.FontFamily.TIMES_ROMAN,12,Font.NORMAL,BaseColor.RED);
 
 
//cabeçalho
//unidade curricular
Paragraph courseUnit = new Paragraph(assessment.getCourseUnit().getName(),fontHeader);
courseUnit.setAlignment(Element.ALIGN_CENTER);
doc.add(courseUnit);
 
//primeira linha cabeçalho
String evaluationTime = "";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_CONTINUOUS))
evaluationTime="Avaliação Contínua";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_FIRSTEXAM))
evaluationTime="Exame Normal";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_SECONDEXAM))
evaluationTime="Exame Recurso";
if(assessment.getEvaluationTime().equals(Globals.ASSESSMENT_EVALUATION_TIME_THIRDEXAM))
evaluationTime="Exame Especial";
 
String yearText = " - Ano lectivo";
String year = " - "+assessment.getYear();
String course = " - "+assessment.getCourseUnit().getCourseName();
Paragraph firstLine = new Paragraph();
firstLine.add(new Chunk(evaluationTime,fontBold));
firstLine.add(new Chunk(yearText,fontNormal));
firstLine.add(new Chunk(year,fontNormal));
firstLine.add(new Chunk(course,fontNormal));
firstLine.setAlignment(Element.ALIGN_CENTER);
doc.add(firstLine);
 
//segunda linha cabeçalho
String dateText = "Data:";
String date = " "+ DatesUtils.getStringFromDate(assessment.getStartDate());
String timeText = " - Duração:";
String time = " "+String.valueOf(assessment.getTime().getHours())+":"+String.valueOf(assessment.getTime().getMinutes());
String ownerText = " - Docente:";
String owner = " "+assessment.getOwner().getName();
String quotationText = " - Nota:";
String quotation = " "+String.valueOf(assessmentResponse.getQuotation());
Paragraph secondLine = new Paragraph();
secondLine.add(new Chunk(dateText,fontBold));
secondLine.add(new Chunk(date,fontNormal));
secondLine.add(new Chunk(timeText,fontBold));
secondLine.add(new Chunk(time,fontNormal));
secondLine.add(new Chunk(ownerText,fontBold));
secondLine.add(new Chunk(owner,fontNormal));
if(assessmentResponse.isEvaluated())
{
secondLine.add(new Chunk(quotationText,fontBold));
secondLine.add(new Chunk(quotation,fontNormal));
}
secondLine.setAlignment(Element.ALIGN_CENTER);
doc.add(secondLine);
 
//paragrafo em branco
//doc.add(new Paragraph("Barra pah",fontNormal));
doc.add(Chunk.NEWLINE);
//Barra horizontal
LineSeparator objectName = new LineSeparator();
doc.add(objectName);
doc.add(Chunk.NEWLINE);
 
//questões
int numberQ=0;
for(AssessmentQuestion question : assessment.getQuestions())
{
numberQ++;
String numberQuotation = String.valueOf(numberQ) + ". ("+String.valueOf(question.getQuotation())+") ";
String questionText = question.getTextpt();
Paragraph questionP = new Paragraph();
questionP.add(new Chunk(numberQuotation,fontTextBold));
questionP.add(new Chunk(questionText,fontTextNormal));
questionP.setAlignment(Element.ALIGN_JUSTIFIED);
doc.add(questionP);
if(question.getImage()!=null)
{
Image image = Image.getInstance(Globals.SITE_URL+"/imageStream/"+question.getImage().getId());
image.setAlignment(Element.ALIGN_LEFT);
doc.add(image);
}
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_TEXT))
{
for(AssessmentQuestionAnswer answer : assessmentResponse.getAnswers())
{
if(answer.getPossibleAnswer().getQuestionItem().getQuestion()== question)
{
Paragraph answerP = new Paragraph();
answerP.add(new Chunk("Resposta: ",fontTextBold));
answerP.add(new Chunk(answer.getTextAnswer(), fontTextNormal));
 
if(assessmentResponse.isEvaluated())
{ //verifica se está correcta
if(question.getQuotation()==answer.getQuotation())
{
answerP.add(new Chunk(" Correcta",fontTextEvaluate));
if(answer.getNote() != null && answer.getNote().trim().length() !=0)
answerP.add(new Chunk(" Obs:"+answer.getNote(),fontTextEvaluate));
}
else if(answer.getQuotation()==0)
{
answerP.add(new Chunk(" Errada",fontTextEvaluate));
if(answer.getNote() != null && answer.getNote().trim().length() !=0)
answerP.add(new Chunk(" Obs:"+answer.getNote(),fontTextEvaluate));
}
else
{
// double quotationA = (answer.getQuotation()*100)/question.getQuotation();
double quotationA = answer.getQuotation();
answerP.add(new Chunk(" Incompleta("+quotationA+")",fontTextEvaluate));
if(answer.getNote() != null && answer.getNote().trim().length() !=0)
answerP.add(new Chunk(" Obs:"+answer.getNote(),fontTextEvaluate));
}
}
doc.add(answerP);
break;
}
}
}
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_PRACTICAL))
{
for(AssessmentQuestionAnswer answer : assessmentResponse.getAnswers())
{
if(answer.getPossibleAnswer().getQuestionItem().getQuestion()== question)
{
if(answer.getIdentifier()!= null && answer.getIdentifier().trim().length() !=0)
{
Paragraph answerP = new Paragraph("Foi entregue um ficheiro", fontTextBold);
if(assessmentResponse.isEvaluated())
{ //verifica se está correcta
if(question.getQuotation()==answer.getQuotation())
{
answerP.add(new Chunk(" Correcta",fontTextEvaluate));
if(answer.getNote() != null && answer.getNote().trim().length() !=0)
answerP.add(new Chunk(" Obs:"+answer.getNote(),fontTextEvaluate));
}
else if(answer.getQuotation()==0)
{
answerP.add(new Chunk(" Errada",fontTextEvaluate));
if(answer.getNote() != null && answer.getNote().trim().length() !=0)
answerP.add(new Chunk(" Obs:"+answer.getNote(),fontTextEvaluate));
}
else
{
// double quotationA = (answer.getQuotation()*100)/question.getQuotation();
double quotationA = answer.getQuotation();
answerP.add(new Chunk(" Incompleta("+quotationA+")",fontTextEvaluate));
if(answer.getNote() != null && answer.getNote().trim().length() !=0)
answerP.add(new Chunk(" Obs:"+answer.getNote(),fontTextEvaluate));
}
}
doc.add(answerP);
break;
}
}
}
}
 
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO) || question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK))
{
for(AssessmentQuestionItem item : question.getQuestionItems())
{
for(AssessmentQuestionPossibleAnswer pA : item.getPossibleAnswers())
{
String evaluated=null;
Image imagePa=null;
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO))
{
boolean isRadioAnswered = false;
for(AssessmentQuestionAnswer answer : assessmentResponse.getAnswers())
{
if(answer.getPossibleAnswer() == pA)
{
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/radioboxselected.png");
isRadioAnswered = true;
if(assessmentResponse.isEvaluated())
{ //verifica se está correcta
if(pA.getQuotation()>0)
{
evaluated = " Correcta";
}
else if(pA.getQuotation()==0)
{
evaluated = " Errada";
}
}
break;
}
}
if(!isRadioAnswered)
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/radiobox.png");
}
 
else
{
boolean isCheckAnswered = false;
for(AssessmentQuestionAnswer answer : assessmentResponse.getAnswers())
{
if(answer.getPossibleAnswer() == pA)
{
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/checkboxselected.jpg");
isCheckAnswered = true;
if(assessmentResponse.isEvaluated())
{ //verifica se está correcta
if(pA.getQuotation()>0)
{
evaluated = " Correcta";
}
else if(pA.getQuotation()==0)
{
evaluated = " Errada";
}
}
break;
}
}
if(!isCheckAnswered)
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/checkbox.png");
}
 
imagePa.setAlignment(Element.PARAGRAPH);
Paragraph pAP = new Paragraph();
pAP.add(new Chunk(imagePa, -1.00f, -2.00f));
pAP.add(new Chunk(" "+pA.getTextpt(),fontTextNormal));
if(evaluated!=null)
{
pAP.add(new Chunk(evaluated,fontTextEvaluate));
evaluated=null;
}
pAP.setAlignment(Element.ALIGN_JUSTIFIED);
doc.add(pAP);
}
}
}
 
if(question.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
PdfPTable table = null;
int numPossibles=0;
//construir tabela
//para saber o numero de respostas possiveis
for(AssessmentQuestionItem itemTam : question.getQuestionItems())
{
numPossibles = itemTam.getPossibleAnswers().size()+2; //mais um para items e para correcções
table = new PdfPTable(numPossibles);
PdfPCell colunaVazia = new PdfPCell(new Paragraph());
colunaVazia.setBorder(0);
table.addCell(colunaVazia);
for(AssessmentQuestionPossibleAnswer possibleTam : itemTam.getPossibleAnswers())
{
PdfPCell possible = new PdfPCell(new Paragraph(possibleTam.getTextpt(),fontTextNormal));
possible.setBorder(0);
table.addCell(possible);
}
table.addCell(colunaVazia); //para fechar a primeira linha da tabela
break;
}
 
for(AssessmentQuestionItem item : question.getQuestionItems())
{
String evaluated=null;
PdfPCell item1 = new PdfPCell(new Paragraph(item.getTextpt(),fontTextNormal));
item1.setBorder(0);
table.addCell(item1);
Image imagePa=null;
for(AssessmentQuestionPossibleAnswer pA : item.getPossibleAnswers())
{
boolean isRadioAnswered = false;
for(AssessmentQuestionAnswer answer : assessmentResponse.getAnswers())
{
if(answer.getPossibleAnswer() == pA)
{
imagePa = Image.getInstance(Globals.SITE_URL+"/imgs/radioboxselected.png");
isRadioAnswered = true;
if(assessmentResponse.isEvaluated())
{ //verifica se está correcta
if(pA.getQuotation()>0)
{
evaluated = " Correcta";
}
else if(pA.getQuotation()==0)
{
evaluated = " Errada";
}
}
break;
}
}
 
if(!isRadioAnswered)
imagePa= Image.getInstance(Globals.SITE_URL+"/imgs/radiobox.png");
 
PdfPCell imageCell = new PdfPCell(imagePa);
imageCell.setBorder(0);
table.addCell(imageCell);
}
if(evaluated != null)
{
PdfPCell evaluatedCell = new PdfPCell(new Paragraph(evaluated,fontTextEvaluate));
evaluatedCell.setBorder(0);
table.addCell(evaluatedCell);
evaluated=null;
}
else
{
PdfPCell evaluatedCell = new PdfPCell(new Paragraph());
evaluatedCell.setBorder(0);
table.addCell(evaluatedCell);
}
}
float splitWidth = 1.0f / (float)numPossibles;
float[] tams = new float[numPossibles];
for(int i=0;i<numPossibles;i++)
{
tams[i] = splitWidth;
}
table.setWidths(tams);
table.setWidthPercentage(100.0f);
doc.add(table);
}
doc.add(Chunk.NEWLINE);
}
 
} finally {
if (doc != null) {
//fechamento do documento
doc.close();
}
if (os != null) {
//fechamento da stream de saída
os.close();
}
}
 
//repositoryStream
String fileName = Globals.TMP_DIR+"Resposta"+assessment.getTitle()+String.valueOf(assessmentResponse.getId())+".pdf";
File file = new File(fileName);
String extension = FilesUtils.getExtension(fileName);
String description = "assessmentResponse.file "+assessment.getCourseUnit().getName()+assessmentResponse.getOwner().getName();
FileInputStream inputStream = new FileInputStream(file);
String identifierResponse = assessmentResponse.getIdentifier();
 
if(identifierResponse==null)
identifierResponse = repositoryService.storeRepositoryFile(inputStream,"application/pdf",extension,(int)file.length(),file.getName(),description, ResourceAccessControlEnum.publicDomain,userSession);
else
repositoryService.updateRepositoryFile(identifierResponse,inputStream, "application/pdf",extension,(int)file.length(),file.getName(),description, ResourceAccessControlEnum.publicDomain);
 
assessmentResponse.setIdentifier(identifierResponse);
}
 
 
 
 
public AssessmentView generateEvaluationsPdf(long assessmentId,UserSession userSession) throws IOException, DocumentException {
AssessmentImpl assessment = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
List<AssessmentResponse> responses = DaoFactory.getAssessmentResponseDaoImpl().loadResponsesByAssessmentId(assessmentId);
 
////////////////////////////////////////////////
Document doc = null;
OutputStream os = null;
 
try {
//cria o documento tamanho A4, margens de 2,54cm
doc = new Document(PageSize.A4, 72, 72, 72, 72);
//cria a stream de saída
os = new FileOutputStream(Globals.TMP_DIR+ assessment.getTitle()+".pdf");
//associa a stream de saída ao
PdfWriter.getInstance(doc, os);
//abre o documento
doc.open();
//imagem do cabeçalho
Image img = Image.getInstance(Globals.SITE_URL+"/imgs/logoestg.gif");
img.setAlignment(Element.ALIGN_LEFT);
doc.add(img);
 
//Barra horizontal
LineSeparator objectName = new LineSeparator();
doc.add(objectName);
 
//adiciona um paragrafo para dar espaço
// Paragraph p = new Paragraph("");
// Paragraph paragrafo = new Paragraph();
// paragrafo.setSpacingBefore(10);
// paragrafo.setIndentationLeft(58);
// paragrafo.setSpacingBefore(20);
// paragrafo.setLeading(20);
// paragrafo.add(new Chunk());
// doc.add(paragrafo);
//doc.add(p);
 
 
//doc.add(Chunk.NEWLINE);
//Informações sobre a prova
 
Phrase anoCurso = new Phrase("\nAno Lectivo: "+String.valueOf(assessment.getYear())+
" / Curso: "+assessment.getCourseUnit().getCourseName()+"\n");
Phrase courseUnit = new Phrase("Unidade Curricular: "+assessment.getCourseUnit().getName()+
"\nDocente: "+assessment.getOwner().getName()+"\n");
doc.add(anoCurso);
doc.add(courseUnit);
 
doc.add(new Phrase(" "));
 
 
////tabela
PdfPTable table = new PdfPTable(assessment.getQuestions().size()+3);
Font fontHeader = new Font(Font.FontFamily.TIMES_ROMAN,10,Font.BOLD);
//primeira linha para as cotações
PdfPCell colunaVazia = new PdfPCell(new Paragraph());
colunaVazia.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
colunaVazia.setColspan(2);
PdfPCell cotacaoMaxima = new PdfPCell(new Paragraph("20",fontHeader));
cotacaoMaxima.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
table.addCell(colunaVazia);
//table.addCell(colunaVazia);
table.addCell(cotacaoMaxima);
 
for(AssessmentQuestion question : assessment.getQuestions())
{
PdfPCell coluna = new PdfPCell(new Paragraph(String.valueOf(question.getQuotation()),fontHeader));
coluna.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
table.addCell(coluna);
}
 
//segunda linha
PdfPCell col1 = new PdfPCell(new Paragraph("Nº",fontHeader));
col1.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
PdfPCell col2 = new PdfPCell(new Paragraph("Nome",fontHeader));
col2.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
PdfPCell col3 = new PdfPCell(new Paragraph("Nota",fontHeader));
col3.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
table.addCell(col1);
table.addCell(col2);
table.addCell(col3);
int numberQ=0;
for(AssessmentQuestion question : assessment.getQuestions())
{
numberQ++;
PdfPCell coluna = new PdfPCell(new Paragraph("P"+String.valueOf(numberQ),fontHeader));
coluna.setBackgroundColor(new BaseColor(0Xc0, 0Xc0,0Xc0));
table.addCell(coluna);
}
 
Font fontText = new Font(Font.FontFamily.TIMES_ROMAN,10,Font.NORMAL);
//cotações das respostas
for(AssessmentResponse response : responses)
{
String code="";
if(response.getOwner() instanceof Student)
{
code = String.valueOf(((Student)response.getOwner()).getSigesCode());
}
PdfPCell colunaNumero = new PdfPCell(new Paragraph(code,fontText));
PdfPCell colunaNome = new PdfPCell(new Paragraph(response.getOwner().getName(),fontText));
PdfPCell colunaNota = new PdfPCell(new Paragraph(String.valueOf(response.getQuotation()),fontText));
table.addCell(colunaNumero);
table.addCell(colunaNome);
table.addCell(colunaNota);
//numero nome e nota adicionados
//percorrer as questões
for(AssessmentQuestion question : assessment.getQuestions())
{
String semResposta=" ";
double percentagemF=0;
boolean respondida = false;
for(AssessmentQuestionAnswer answer : response.getAnswers())
{
if(answer.getPossibleAnswer().getQuestionItem().getQuestion()==question)
{
// percentagemF += (answer.getQuotation()*100) / question.getQuotation();
percentagemF += answer.getQuotation();
respondida=true;
}
}
if(respondida){
// int percentagemI = (int)percentagemF;
// PdfPCell colunaPercentagem = new PdfPCell(new Paragraph(String.valueOf(percentagemI)+"%",fontText));
PdfPCell colunaPercentagem = new PdfPCell(new Paragraph(String.valueOf(percentagemF),fontText));
table.addCell(colunaPercentagem);
}
else{
PdfPCell colunaPercentagem = new PdfPCell(new Paragraph(semResposta,fontText));
table.addCell(colunaPercentagem);
}
}
}
float splitWidth = 0.65f / (float)(assessment.getQuestions().size()+1);
float[] tams = new float[assessment.getQuestions().size()+3];
tams[0]=0.10f;
tams[1]=0.25f;
for(int i=2;i<assessment.getQuestions().size()+3;i++)
{
tams[i] = splitWidth;
}
// float[] tams = {0.10f,0.25f,0.10f,0.10f,0.10f,0.03f,0.04f,0.04f};
 
table.setWidths(tams);
 
table.setWidthPercentage(100.0f);
table.setHorizontalAlignment(Element.ALIGN_LEFT);
doc.add(table);
 
} finally {
if (doc != null) {
//fechamento do documento
doc.close();
}
if (os != null) {
//fechamento da stream de saída
os.close();
}
}
 
//repositoryStream
String fileName = Globals.TMP_DIR+ assessment.getTitle()+".pdf";
File file = new File(fileName);
String extension = FilesUtils.getExtension(fileName);
String description = "assessment.evaluations.file "+assessment.getCourseUnit().getName();
FileInputStream inputStream = new FileInputStream(file);
String identifierEvaluations = assessment.getEvaluationsIdentifier();
 
if(identifierEvaluations==null)
identifierEvaluations = repositoryService.storeRepositoryFile(inputStream,"application/pdf",extension,(int)file.length(),file.getName(),description, ResourceAccessControlEnum.publicDomain,userSession);
else
repositoryService.updateRepositoryFile(identifierEvaluations,inputStream, "application/pdf",extension,(int)file.length(),file.getName(),description, ResourceAccessControlEnum.publicDomain);
 
assessment.setEvaluationsIdentifier(identifierEvaluations);
 
return new AssessmentView(assessment);
// return new AssessmentView();
}
 
}
/impl/src/java/pt/estgp/estgweb/services/assessments/LoadAssessmentResponseService.java
New file
0,0 → 1,32
package pt.estgp.estgweb.services.assessments;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.AssessmentResponse;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentResponseView;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.io.Serializable;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 5/Ago/2013
* Time: 15:55:51
* To change this template use File | Settings | File Templates.
*/
public class LoadAssessmentResponseService implements IService {
 
private static final Logger logger = Logger.getLogger(LoadAssessmentResponseService.class);
 
public AssessmentResponseView run(Serializable id, UserSession userSession)
{
AssessmentResponse r = DaoFactory.getAssessmentResponseDaoImpl().get(id);
AssessmentResponseView assessmentResponseView = new AssessmentResponseView(r);
 
logger.info("Loading assessment response view: " + assessmentResponseView.getId());
 
return assessmentResponseView;
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/LoadAssessmentService.java
New file
0,0 → 1,38
package pt.estgp.estgweb.services.assessments;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.Assessment;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentView;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 1/Ago/2013
* Time: 18:25:49
* To change this template use File | Settings | File Templates.
*/
public class LoadAssessmentService implements IService {
 
private static final Logger logger = Logger.getLogger(LoadAssessmentService.class);
 
public AssessmentView run(long assessmentId, UserSession userSession)
{
Assessment a = DaoFactory.getAssessmentDaoImpl().get(assessmentId);
 
if(a == null) return null;
 
long answered = DaoFactory.getAssessmentResponseDaoImpl().countResponses(a.getId(),true,null);
long total = DaoFactory.getAssessmentResponseDaoImpl().countResponses(a.getId(),null,null);
long evaluated = DaoFactory.getAssessmentResponseDaoImpl().countResponses(a.getId(),true,true);
 
AssessmentView assessmentView = new AssessmentView(a);
assessmentView.setNumberOfResponses(answered);
assessmentView.setNumberTotalOfResponses(total);
assessmentView.setNumberOfCorrected(evaluated);
 
return assessmentView;
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/LoadAssessmentResponsesService.java
New file
0,0 → 1,100
package pt.estgp.estgweb.services.assessments;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentQuestionAnswerView;
import pt.estgp.estgweb.domain.views.AssessmentQuestionView;
import pt.estgp.estgweb.domain.views.AssessmentResponseView;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 5/Ago/2013
* Time: 15:55:51
* To change this template use File | Settings | File Templates.
*/
public class LoadAssessmentResponsesService implements IService {
 
private static final Logger logger = Logger.getLogger(LoadAssessmentResponsesService.class);
 
public List<AssessmentResponseView> loadAssessmentResponses(long idAssessment, UserSession userSession)
{
List<AssessmentResponse> responses = DaoFactory.getAssessmentResponseDaoImpl().loadResponsesByAssessmentIdAnswered(idAssessment);
 
List<AssessmentResponseView> responsesViews = new ArrayList<AssessmentResponseView>();
if(responses != null)
{
for(AssessmentResponse aR : responses)
{
AssessmentResponseView rView = new AssessmentResponseView(aR);
responsesViews.add(rView);
}
}
return responsesViews;
}
 
 
public List<AssessmentQuestionView> loadQuestionsResponses(long idAssessment, UserSession userSession)
{
List<AssessmentQuestionAnswerImpl> answers = DaoFactory.getAssessmentQuestionAnswerDaoImpl().loadByAssessmentIdNotEvaluated(idAssessment);
 
List<AssessmentQuestion> questions = new ArrayList<AssessmentQuestion>();
for(AssessmentQuestionAnswerImpl aQA : answers)
{ //adicionar as questões sem ser repetidas e so as que o docente tem de corrigir
if(!questions.contains(aQA.getPossibleAnswer().getQuestionItem().getQuestion()))
{
if(!aQA.getPossibleAnswer().getQuestionItem().getQuestion().getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO)
&& !aQA.getPossibleAnswer().getQuestionItem().getQuestion().getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK)
&& !aQA.getPossibleAnswer().getQuestionItem().getQuestion().getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
questions.add(aQA.getPossibleAnswer().getQuestionItem().getQuestion());
}
}
 
List<AssessmentQuestionView> questionsView = new ArrayList<AssessmentQuestionView>();
for(AssessmentQuestion a : questions)
{
AssessmentQuestionView qview = new AssessmentQuestionView(a);
qview.setNumberOfResponses(DaoFactory.getAssessmentQuestionAnswerDaoImpl().countResponses(qview.getId()));
questionsView.add(qview);
}
 
return questionsView;
}
 
///carregar todas as respostas não corrigidas de uma questão
public List<AssessmentQuestionAnswerView> loadQuestionResponses(long questionId, UserSession userSession)
{
List<AssessmentQuestionAnswerImpl> answers = DaoFactory.getAssessmentQuestionAnswerDaoImpl().loadByQuestionIdNotEvaluated(questionId);
 
List<AssessmentQuestionAnswerView> answersView = new ArrayList<AssessmentQuestionAnswerView>();
for(AssessmentQuestionAnswer a : answers)
{
AssessmentQuestionAnswerView aView = new AssessmentQuestionAnswerView(a,new AssessmentResponseView(a.getResponse()));
answersView.add(aView);
}
 
return answersView;
}
 
 
public List<AssessmentResponseView> loadOwnedResponses(UserSession userSession)
{
List<AssessmentResponse> responses = DaoFactory.getAssessmentResponseDaoImpl().loadOwnedResponses(userSession.getUser().getId());
List<AssessmentResponseView> responseViews = new ArrayList<AssessmentResponseView>();
 
for(AssessmentResponse r : responses)
{
AssessmentResponseView responseView = new AssessmentResponseView(r);
responseViews.add(responseView);
}
 
return responseViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/LoadAssessmentsService.java
New file
0,0 → 1,43
package pt.estgp.estgweb.services.assessments;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.Assessment;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.AssessmentView;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 1/Ago/2013
* Time: 3:56:13
* To change this template use File | Settings | File Templates.
*/
public class LoadAssessmentsService implements IService{
 
private static final Logger logger = Logger.getLogger(LoadAssessmentsService.class);
 
public List<AssessmentView> loadOwnedAssessments(UserSession userSession)
{
List<Assessment> assessments = DaoFactory.getAssessmentDaoImpl().loadOwnedAssessments(userSession.getUser().getId());
List<AssessmentView> assessmentViews = new ArrayList<AssessmentView>();
 
for(Assessment a : assessments)
{
long nrOfResponsesAnswered = DaoFactory.getAssessmentResponseDaoImpl().countResponses(a.getId(),true,null);
long nrTotalOfResponses = DaoFactory.getAssessmentResponseDaoImpl().countResponses(a.getId(),null,null);
long nrOfResponsesEvaluated = DaoFactory.getAssessmentResponseDaoImpl().countResponses(a.getId(),true,true);
AssessmentView assessmentView = new AssessmentView(a);
assessmentView.setNumberOfResponses(nrOfResponsesAnswered);
assessmentView.setNumberTotalOfResponses(nrTotalOfResponses);
assessmentView.setNumberOfCorrected(nrOfResponsesEvaluated);
assessmentViews.add(assessmentView);
}
 
return assessmentViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/AssessmentStatusEnum.java
New file
0,0 → 1,49
package pt.estgp.estgweb.services.assessments;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 6/Set/2013
* Time: 17:05:01
* To change this template use File | Settings | File Templates.
*/
public enum AssessmentStatusEnum {
 
STATUS_STOPPED("","STATUS_STOPPED"),
STATUS_SCHEDULE_ASSESSMENT("assessment.list.form.status.schedule.assessment","STATUS_SCHEDULE_ASSESSMENT");
 
private String messageKey;
private String status;
 
private AssessmentStatusEnum(String messageKey, String status)
{
this.messageKey = messageKey;
this.status = status;
}
 
public String getMessageKey() {
return messageKey;
}
 
public void setMessageKey(String messageKey) {
this.messageKey = messageKey;
}
 
public String getStatus() {
return status;
}
 
public void setStatus(String status) {
this.status = status;
}
 
public static AssessmentStatusEnum parse(String status)
{
for(AssessmentStatusEnum statusEnum: values())
{
if(statusEnum.getStatus().equals(status))
return statusEnum;
}
return null;
}
}
/impl/src/java/pt/estgp/estgweb/services/assessments/InsertAssessmentAnswersService.java
New file
0,0 → 1,122
package pt.estgp.estgweb.services.assessments;
 
import com.itextpdf.text.DocumentException;
import jomm.utils.FilesUtils;
import org.apache.log4j.Logger;
import org.apache.struts.upload.FormFile;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.*;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.io.IOException;
import java.util.Date;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 6/Ago/2013
* Time: 2:20:23
* To change this template use File | Settings | File Templates.
*/
public class InsertAssessmentAnswersService implements IService {
 
private static final Logger logger = Logger.getLogger(InsertAssessmentAnswersService.class);
 
private LoadAssessmentService loadAssessmentService = new LoadAssessmentService();
private RepositoryService repositoryService = new RepositoryService();
private GeneratePdfService generatePdfService = new GeneratePdfService();
 
public AssessmentView run(long responseId, AssessmentView assessmentView, UserSession userSession)
{
AssessmentResponse response = DaoFactory.getAssessmentResponseDaoImpl().get(responseId);
 
if(response.isAnswered()) return null;
 
for(AssessmentQuestionView qView : assessmentView.getQuestions())
{
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
for(AssessmentQuestionAnswerView aView : pView.getAnswers())
{
if(aView.getId() <= 0)
{
AssessmentQuestionAnswerImpl a = DomainObjectFactory.createAssessmentQuestionAnswerImpl();
aView.persistViewInObject(a);
 
AssessmentQuestionPossibleAnswerImpl p = (AssessmentQuestionPossibleAnswerImpl) DaoFactory.getAssessmentQuestionPossibleAnswerDaoImpl().get(pView.getId());
 
a.setPossibleAnswer(p);
a.setResponse(response);
a.setEvaluated(false);
if(iView.getUploadFile() != null && iView.getUploadFile().getFileSize()>0)
{ //tratar de salvar o ficheiro e guardar o identifier
FormFile file = iView.getUploadFile();
String extension = FilesUtils.getExtension(file.getFileName());
String description = "assessment.answer.file "+assessmentView.getCourseUnit().getName()+" of "+ userSession.getUser().getUsername();
String identifier = null;
try {
 
identifier = repositoryService.storeRepositoryFile(file.getInputStream(),file.getContentType(),extension,file.getFileSize(),file.getFileName(),description, ResourceAccessControlEnum.publicDomain,userSession);
a.setIdentifier(identifier);
 
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
//verificar se sao questoes de correccao automatica para atribuir cotação
//e serem colocadas como corrigidas
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO)
|| qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX)
|| qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK))
{
a.setQuotation(p.getQuotation());
a.setEvaluated(true);
}
 
DaoFactory.getAssessmentQuestionAnswerDaoImpl().save(a);
}
}
}
}
}
 
response.setDate(new Date());
response.setAnswered(true);
//verificar se so respondeu a questoes de correccao automatica para ser ja colocada a nota
//e definida a resposta como avaliada
boolean evaluated = true;
double quotationTotal=0;
for(AssessmentQuestionAnswer aQa : response.getAnswers())
{
if(!aQa.isEvaluated())
{
evaluated=false;
}
quotationTotal+=aQa.getQuotation();
}
if(evaluated)
{
response.setEvaluated(true);
response.setQuotation(quotationTotal);
}
 
try {
generatePdfService.generateAssessmentResponsePdf(response.getId(),response.getAssessment().getId(),userSession);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (DocumentException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
 
logger.info("Answer inserted to assessment with id: "+assessmentView.getId());
 
return loadAssessmentService.run(assessmentView.getId(), userSession);
}
 
}
/impl/src/java/pt/estgp/estgweb/services/authenticate/AuthenticateService.java
44,7 → 44,7
throw new AuthenticateException(AuthenticateException.ALREADY_AUTHENTICATED);
 
if(username == null || username.trim().length() == 0 || password == null || password.trim().length() == 0)
throw new AuthenticateException(AuthenticateException.FAIL_AUTHENTICATION);
throw new AuthenticateException(AuthenticateException.FAIL_AUTHENTICATION);
boolean go = false;
if(USE_LDAP)
go = ldapManager.login(username,password);
78,11 → 78,11
u.setPassword(jomm.utils.BytesUtils.getDigestMD5Hex(password));
if(u.getRoles().contains("teacher"))
{
 
}
else if (u.getRoles().contains("student"))
{
 
}
}
else
94,7 → 94,19
// u.setPassword(passwordAux);
u.setPassword(jomm.utils.BytesUtils.getDigestMD5Hex(password));
}
 
//CHECK USER BLOCK's
if(!u.isAdmin() && !u.isSuperuser())
{
if(u.isAutoBlockMode() && u.isAutoBlock()
||
!u.isAutoBlockMode() && u.isManualBlock())
{
logger.warn("user:" + username + " blocked");
throw new AuthenticateException(AuthenticateException.BLOCKED);
}
}
 
logger.warn("user:" + username + " authenticated");
((UserSessionImpl)userSession).clearObjectsWithOpenTransaction();
userSession.setName(u.getName());
/impl/src/java/pt/estgp/estgweb/services/authenticate/AuthenticateException.java
6,6 → 6,7
{
public static final String ALREADY_AUTHENTICATED = "authenticate.already.authenticated";
public static final String FAIL_AUTHENTICATION = "fail.authenticate";
public static final String BLOCKED = "authenticate.blocked";
 
public AuthenticateException()
{
/impl/src/java/pt/estgp/estgweb/domain/AssessmentQuestionPossibleAnswerImpl.java
New file
0,0 → 1,37
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 18:52:10
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionPossibleAnswerImpl extends AssessmentQuestionPossibleAnswer{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionPossibleAnswerImpl.class);
 
@Override
public GenericUser getOwner() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public List<String> getOwnerRoles() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
public String getChoosedOwnerRole() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public Serializable getSerializable() {
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/AssessmentImpl.java
New file
0,0 → 1,85
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
import java.util.Set;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 4/Abr/2013
* Time: 17:02:06
* To change this template use File | Settings | File Templates.
*/
public class AssessmentImpl extends Assessment implements IOwned, IEdit
{
private static final Logger logger = Logger.getLogger(AssessmentImpl.class);
 
@Override
public boolean isOwnedBy(GenericUser u) {
return isOwnedBy(u,false);
}
 
@Override
public boolean isOwnedBy(GenericUser u, boolean transaction) {
return u.getId() == getOwner().getId();
}
 
@Override
public GenericUser getOwner() {
return super.getOwner();
}
 
public String getChoosedOwnerRole() {
logger.warn("Invoke not implemented method in class:" + getClass().getName());
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public List<String> getOwnerRoles() {
logger.warn("Invoke not implemented method in class:" + getClass().getName());
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public Serializable getSerializable() {
return getId();
}
 
public boolean isTypeOf(String type)
{
return (getType().equals(type));
}
 
public boolean canEdit(GenericUserImpl u)
{
return canEditAssessment(u,false);
}
 
public boolean canEdit(GenericUserImpl u,boolean transaction)
{
return canEditAssessment(u,true);
}
 
private boolean canEditAssessment(GenericUserImpl user, boolean transaction)
{
Set<AssessmentResponse> responses = this.getResponses();
if(responses.size() ==0)
{
return user != null && isOwnedBy(user, transaction);
}
if(responses.size()>0)
{
for(AssessmentResponse response : responses)
{
return response.getAnswers().size() == 0 && user != null && isOwnedBy(user,transaction);
}
}
return false;
}
}
 
 
 
/impl/src/java/pt/estgp/estgweb/domain/views/AssessmentQuestionView.java
New file
0,0 → 1,226
package pt.estgp.estgweb.domain.views;
 
import org.apache.struts.upload.FormFile;
import pt.estgp.estgweb.domain.AssessmentQuestion;
import pt.estgp.estgweb.domain.AssessmentQuestionImpl;
import pt.estgp.estgweb.domain.AssessmentQuestionItem;
import pt.estgp.estgweb.domain.Image;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 20/Jul/2013
* Time: 22:49:22
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionView extends DomainObjectView{
 
 
private long id;
private String textpt;
private String texten;
private String type;
private double quotation;
private String textExtra;
private int textLimit;
private Image image;
// private FormFile imagem;
private long imageId;
private AssessmentView assessment;
private List<AssessmentQuestionItemView> questionItems = new ArrayList<AssessmentQuestionItemView>();
private List<AssessmentQuestionPossibleAnswerView> possibleLabels = new ArrayList<AssessmentQuestionPossibleAnswerView>();
 
private FormFile bigImage = null;
private String bigImageStr;
 
private long numberOfResponses;
 
public AssessmentQuestionView()
{
}
 
public AssessmentQuestionView(AssessmentQuestion assessmentQuestion)
{
super(assessmentQuestion);
init(assessmentQuestion);
}
 
public AssessmentQuestionView(AssessmentQuestion assessmentQuestion, AssessmentView a)
{
super(assessmentQuestion);
if(a != null)
this.assessment = a;
init(assessmentQuestion);
}
 
private void init(AssessmentQuestion assessmentQuestion)
{
this.id = assessmentQuestion.getId();
this.textpt = assessmentQuestion.getTextpt();
this.texten = assessmentQuestion.getTexten();
this.type = assessmentQuestion.getType();
this.quotation = assessmentQuestion.getQuotation();
this.textExtra = assessmentQuestion.getTextExtra();
this.textLimit = assessmentQuestion.getTextLimit();
this.image = assessmentQuestion.getImage();
if(assessmentQuestion.getImage() != null)
{
this.imageId = assessmentQuestion.getImage().getId();
}
 
if(assessmentQuestion.getQuestionItems() != null)
{
for(AssessmentQuestionItem item: assessmentQuestion.getQuestionItems())
{
AssessmentQuestionItemView questionItemView = new AssessmentQuestionItemView(item,this);
this.questionItems.add(questionItemView);
}
}
}
 
public void persistViewInObject(AssessmentQuestion assessmentQuestion)
{
assessmentQuestion.setId(id);
assessmentQuestion.setTextpt(textpt);
assessmentQuestion.setTexten(texten);
assessmentQuestion.setQuotation(quotation);
assessmentQuestion.setTextExtra(textExtra);
assessmentQuestion.setTextLimit(textLimit);
assessmentQuestion.setType(type);
// assessmentQuestion.setImage(image);
}
 
public FormFile getBigImage() {
return bigImage;
}
 
public void setBigImage(FormFile bigImage) {
this.bigImage = bigImage;
}
 
public String getBigImageStr() {
return bigImageStr;
}
 
public void setBigImageStr(String bigImageStr) {
this.bigImageStr = bigImageStr;
}
 
public long getImageId() {
return imageId;
}
 
public void setImageId(long imageId) {
this.imageId = imageId;
}
 
public long getId() {
return id;
}
 
public long getNumberOfResponses() {
return numberOfResponses;
}
 
public void setNumberOfResponses(long numberOfResponses) {
this.numberOfResponses = numberOfResponses;
}
 
public void setId(long id) {
this.id = id;
}
 
public String getTextpt() {
return textpt;
}
 
public void setTextpt(String textpt) {
this.textpt = textpt;
}
 
public String getTexten() {
return texten;
}
 
public void setTexten(String texten) {
this.texten = texten;
}
 
public String getType() {
return type;
}
 
public void setType(String type) {
this.type = type;
}
 
public double getQuotation() {
return quotation;
}
 
public void setQuotation(double quotation) {
this.quotation = quotation;
}
 
public String getTextExtra() {
return textExtra;
}
 
public void setTextExtra(String textExtra) {
this.textExtra = textExtra;
}
 
public int getTextLimit() {
return textLimit;
}
 
public void setTextLimit(int textLimit) {
this.textLimit = textLimit;
}
 
public Image getImage() {
return image;
}
 
public void setImage(Image image) {
this.image = image;
}
 
public AssessmentView getAssessment() {
return assessment;
}
 
public void setAssessment(AssessmentView assessment) {
this.assessment = assessment;
}
 
public List<AssessmentQuestionItemView> getQuestionItems() {
return questionItems;
}
 
public void setQuestionItems(List<AssessmentQuestionItemView> questionItems) {
this.questionItems = questionItems;
}
 
public List<AssessmentQuestionPossibleAnswerView> getPossibleLabels() {
return possibleLabels;
}
 
public void setPossibleLabels(List<AssessmentQuestionPossibleAnswerView> possibleLabels) {
this.possibleLabels = possibleLabels;
}
 
@Override
public Class getReferenceClass() {
return AssessmentQuestionImpl.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/AssessmentView.java
New file
0,0 → 1,366
package pt.estgp.estgweb.domain.views;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.services.assessments.AssessmentStatusEnum;
import pt.estgp.estgweb.web.utils.DatesUtils;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 20/Jul/2013
* Time: 20:25:53
* To change this template use File | Settings | File Templates.
*/
public class AssessmentView extends DomainObjectView{
 
private static final Logger logger = Logger.getLogger(SurveyView.class);
 
private long id;
private Date updateDate;
private String title;
private String type;
private String year;
private String semester;
private Date startDate;
private Date endDate;
private Date saveDate;
private Date time;
private Date timeExtra;
private String evaluationsIdentifier;
private String identifier;
private AssessmentStatusEnum status;
private int statusPercentage;
private UserView owner;
private CourseUnitView courseUnit = new CourseUnitView();
private String evaluationTime;
private List<AssessmentQuestionView> questions = new ArrayList<AssessmentQuestionView>();
private List<AssessmentResponseView> responses = new ArrayList<AssessmentResponseView>();
 
private long numberOfResponses;
private long numberTotalOfResponses;
private long numberOfCorrected;
 
private String deletedQuestions;
private String deletedItems;
private String deletedCandidates;
 
 
public AssessmentView()
{}
 
public AssessmentView(Assessment assessment)
{
super(assessment);
init(assessment);
}
 
private void init(Assessment assessment)
{
this.id = assessment.getId();
this.updateDate = assessment.getUpdateDate();
this.title = assessment.getTitle();
this.type = assessment.getType();
this.year = assessment.getYear();
this.semester = assessment.getSemester();
this.startDate = assessment.getStartDate();
this.endDate = assessment.getEndDate();
this.saveDate = assessment.getSaveDate();
this.identifier = assessment.getIdentifier();
this.evaluationsIdentifier = assessment.getEvaluationsIdentifier();
this.statusPercentage = assessment.getStatusPercentage();
this.status = AssessmentStatusEnum.parse(assessment.getStatus());
this.owner = new UserView((User) assessment.getOwner());
this.courseUnit = new CourseUnitView((CourseUnit) assessment.getCourseUnit(),false,true,false,false);
this.evaluationTime = assessment.getEvaluationTime();
this.time = assessment.getTime();
this.timeExtra = assessment.getTimeExtra();
 
if(assessment.getQuestions() != null)
{
for(AssessmentQuestion question: assessment.getQuestions())
{
AssessmentQuestionView questionView = new AssessmentQuestionView(question,this);
this.questions.add(questionView);
}
}
//responses
if(assessment.getResponses() != null)
{
for(AssessmentResponse response: assessment.getResponses())
{
AssessmentResponseView responseView = new AssessmentResponseView(response,this);
this.responses.add(responseView);
}
}
}
public void persistViewInObject(Assessment assessment)
{
assessment.setTitle(title);
assessment.setStartDate(startDate);
assessment.setEndDate(endDate);
assessment.setType(type);
assessment.setTime(time);
assessment.setTimeExtra(timeExtra);
assessment.setEvaluationTime(evaluationTime);
////EVALUATIONTIME
}
 
 
public List<AssessmentResponseView> getResponses() {
return responses;
}
 
public void setResponses(List<AssessmentResponseView> responses) {
this.responses = responses;
}
 
public String getDeletedQuestions() {
return deletedQuestions;
}
 
public void setDeletedQuestions(String deletedQuestions) {
this.deletedQuestions = deletedQuestions;
}
 
public String getEvaluationTime() {
return evaluationTime;
}
 
public String getEvaluationsIdentifier() {
return evaluationsIdentifier;
}
 
public void setEvaluationsIdentifier(String evaluationsIdentifier) {
this.evaluationsIdentifier = evaluationsIdentifier;
}
 
public void setEvaluationTime(String evaluationTime) {
this.evaluationTime = evaluationTime;
}
 
public String getDeletedItems() {
return deletedItems;
}
 
public Date getTimeExtra() {
return timeExtra;
}
 
public void setTimeExtra(Date timeExtra) {
this.timeExtra = timeExtra;
}
 
public void setDeletedItems(String deletedItems) {
this.deletedItems = deletedItems;
}
 
public String getDeletedCandidates() {
return deletedCandidates;
}
 
public void setDeletedCandidates(String deletedCandidates) {
this.deletedCandidates = deletedCandidates;
}
 
/* public List<AssessmentResponseView> getResponses() {
return responses;
}
 
public void setResponses(List<AssessmentResponseView> responses) {
this.responses = responses;
} */
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
 
public Date getUpdateDate() {
return updateDate;
}
 
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
 
public String getTitle() {
return title;
}
 
public void setTitle(String title) {
this.title = title;
}
 
public String getType() {
return type;
}
 
public void setType(String type) {
this.type = type;
}
 
public String getYear() {
return year;
}
 
public void setYear(String year) {
this.year = year;
}
 
public String getSemester() {
return semester;
}
 
public void setSemester(String semester) {
this.semester = semester;
}
 
public Date getStartDate() {
return startDate;
}
 
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
 
public Date getEndDate() {
return endDate;
}
 
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
 
public Date getSaveDate() {
return saveDate;
}
 
public void setSaveDate(Date saveDate) {
this.saveDate = saveDate;
}
 
public Date getTime() {
return time;
}
 
public void setTime(Date time) {
this.time = time;
}
 
public String getIdentifier() {
return identifier;
}
 
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
 
public AssessmentStatusEnum getStatus() {
return status;
}
 
public void setStatus(AssessmentStatusEnum status) {
this.status = status;
}
 
public int getStatusPercentage() {
return statusPercentage;
}
 
public void setStatusPercentage(int statusPercentage) {
this.statusPercentage = statusPercentage;
}
 
public UserView getOwner() {
return owner;
}
 
public void setOwner(UserView owner) {
this.owner = owner;
}
 
public CourseUnitView getCourseUnit() {
return courseUnit;
}
 
public void setCourseUnit(CourseUnitView courseUnit) {
this.courseUnit = courseUnit;
}
 
public List<AssessmentQuestionView> getQuestions() {
return questions;
}
 
public void setQuestions(List<AssessmentQuestionView> questions) {
this.questions = questions;
}
 
public long getNumberOfResponses() {
return numberOfResponses;
}
 
public void setNumberOfResponses(long numberOfResponses) {
this.numberOfResponses = numberOfResponses;
}
 
public long getNumberTotalOfResponses() {
return numberTotalOfResponses;
}
 
public void setNumberTotalOfResponses(long numberTotalOfResponses) {
this.numberTotalOfResponses = numberTotalOfResponses;
}
 
public long getNumberOfCorrected() {
return numberOfCorrected;
}
 
public void setNumberOfCorrected(long numberOfCorrected) {
this.numberOfCorrected = numberOfCorrected;
}
 
public String getFormatedSaveDate()
{
return DatesUtils.getStringFromDate(saveDate);
}
 
public String getFormatedUpdateDate()
{
return DatesUtils.getStringFromDate(updateDate);
}
 
public String getFormatedStartDate()
{
return DatesUtils.getStringFromDate(startDate);
}
 
public void setFormatedEndDate(String date)
{
this.endDate = DatesUtils.getDateFromString(date);
}
 
public String getFormatedEndDate()
{
return DatesUtils.getStringFromDate(endDate);
}
 
@Override
public Class getReferenceClass() {
return AssessmentImpl.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/AssessmentQuestionAnswerView.java
New file
0,0 → 1,196
package pt.estgp.estgweb.domain.views;
 
import org.apache.log4j.Logger;
import org.apache.struts.upload.FormFile;
import pt.estgp.estgweb.domain.AssessmentQuestionAnswer;
import pt.estgp.estgweb.domain.AssessmentQuestionAnswerImpl;
 
import java.io.Serializable;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 21/Jul/2013
* Time: 5:21:32
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionAnswerView extends DomainObjectView{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionAnswerView.class);
 
private long id;
private String textAnswer;
private String identifier;
private String note;
private double quotation;
private boolean evaluated;
private FormFile uploadFile;
private AssessmentQuestionPossibleAnswerView possibleAnswer = new AssessmentQuestionPossibleAnswerView();
private AssessmentResponseView response;
 
private boolean answerCorrect=true;
private boolean answerIncomplete=false;
private float percentage;
private String answerCorrectS="correct";
 
public AssessmentQuestionAnswerView()
{}
 
public AssessmentQuestionAnswerView(AssessmentQuestionAnswer questionAnswer)
{
super(questionAnswer);
init(questionAnswer);
}
 
public AssessmentQuestionAnswerView(AssessmentQuestionAnswer questionAnswer, AssessmentResponseView r)
{
super(questionAnswer);
this.response = r;
init(questionAnswer);
}
 
public AssessmentQuestionAnswerView(AssessmentQuestionAnswer questionAnswer, AssessmentQuestionPossibleAnswerView p)
{
super(questionAnswer);
if(p != null)
this.possibleAnswer = p;
init(questionAnswer);
}
 
private void init(AssessmentQuestionAnswer questionAnswer)
{
this.id = questionAnswer.getId();
this.textAnswer = questionAnswer.getTextAnswer();
this.identifier = questionAnswer.getIdentifier();
this.note = questionAnswer.getNote();
this.quotation = questionAnswer.getQuotation();
this.evaluated = questionAnswer.isEvaluated();
//alterei isto
// this.possibleAnswer = new AssessmentQuestionPossibleAnswerView((AssessmentQuestionPossibleAnswer)questionAnswer.getPossibleAnswer());
// this.response = new AssessmentResponseView((AssessmentResponse)questionAnswer.getResponse());
 
}
 
public void persistViewInObject(AssessmentQuestionAnswer questionAnswer)
{
questionAnswer.setTextAnswer(textAnswer);
questionAnswer.setIdentifier(identifier);
questionAnswer.setNote(note);
questionAnswer.setQuotation(quotation);
questionAnswer.setEvaluated(evaluated);
}
 
public FormFile getUploadFile() {
return uploadFile;
}
 
public void setUploadFile(FormFile uploadFile) {
this.uploadFile = uploadFile;
}
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
 
public String getNote() {
return note;
}
 
public void setNote(String note) {
this.note = note;
}
 
public boolean isAnswerCorrect() {
return answerCorrect;
}
 
public void setAnswerCorrect(boolean answerCorrect) {
this.answerCorrect = answerCorrect;
}
 
public boolean isEvaluated() {
return evaluated;
}
 
public void setEvaluated(boolean evaluated) {
this.evaluated = evaluated;
}
 
public double getQuotation() {
return quotation;
}
 
public boolean isAnswerIncomplete() {
return answerIncomplete;
}
 
public String getAnswerCorrectS() {
return answerCorrectS;
}
 
public void setAnswerCorrectS(String answerCorrectS) {
this.answerCorrectS = answerCorrectS;
}
 
public float getPercentage() {
return percentage;
}
 
public void setPercentage(float percentage) {
this.percentage = percentage;
}
 
public void setAnswerIncomplete(boolean answerIncomplete) {
this.answerIncomplete = answerIncomplete;
}
 
public void setQuotation(double quotation) {
this.quotation = quotation;
}
 
public String getTextAnswer() {
return textAnswer;
}
 
public void setTextAnswer(String textAnswer) {
this.textAnswer = textAnswer;
}
 
public String getIdentifier() {
return identifier;
}
 
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
 
public AssessmentQuestionPossibleAnswerView getPossibleAnswer() {
return possibleAnswer;
}
 
public void setPossibleAnswer(AssessmentQuestionPossibleAnswerView possibleAnswer) {
this.possibleAnswer = possibleAnswer;
}
 
public AssessmentResponseView getResponse() {
return response;
}
 
public void setResponse(AssessmentResponseView response) {
this.response = response;
}
 
@Override
public Class getReferenceClass() {
return AssessmentQuestionAnswerImpl.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/AssessmentResponseView.java
New file
0,0 → 1,177
package pt.estgp.estgweb.domain.views;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.*;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 21/Jul/2013
* Time: 5:31:02
* To change this template use File | Settings | File Templates.
*/
public class AssessmentResponseView extends DomainObjectView{
 
private static final Logger logger = Logger.getLogger(AssessmentResponseView.class);
 
private long id;
private Date date;
private boolean answered;
private boolean evaluated;
private double quotation;
private String identifier;
private UserView owner = new UserView();
private AssessmentView assessment = new AssessmentView();
private List<AssessmentQuestionAnswerView> answers = new ArrayList<AssessmentQuestionAnswerView>();
 
 
public AssessmentResponseView()
{}
public AssessmentResponseView(AssessmentResponse assessmentResponse, AssessmentView a)
{
super(assessmentResponse);
if(a != null)
this.assessment = a;
initWithoutAssessment(assessmentResponse);
}
 
public AssessmentResponseView(AssessmentResponse assessmentResponse)
{
super(assessmentResponse);
init(assessmentResponse);
}
 
private void initWithoutAssessment(AssessmentResponse assessmentResponse)
{
this.id = assessmentResponse.getId();
this.date = assessmentResponse.getDate();
this.answered = assessmentResponse.isAnswered();
this.evaluated = assessmentResponse.isEvaluated();
this.quotation = assessmentResponse.getQuotation();
this.identifier = assessmentResponse.getIdentifier();
this.owner = new UserView((User) assessmentResponse.getOwner());
// this.assessment = new AssessmentView((Assessment) assessmentResponse.getAssessment());
 
if(assessmentResponse.getAnswers() != null)
{
for(AssessmentQuestionAnswer questionAnswer : assessmentResponse.getAnswers())
{
AssessmentQuestionAnswerView questionAnswerView = new AssessmentQuestionAnswerView(questionAnswer, new AssessmentQuestionPossibleAnswerView(questionAnswer.getPossibleAnswer()));
this.answers.add(questionAnswerView);
}
}
}
 
private void init(AssessmentResponse assessmentResponse)
{
this.id = assessmentResponse.getId();
this.date = assessmentResponse.getDate();
this.answered = assessmentResponse.isAnswered();
this.evaluated = assessmentResponse.isEvaluated();
this.quotation = assessmentResponse.getQuotation();
this.identifier = assessmentResponse.getIdentifier();
this.owner = new UserView((User) assessmentResponse.getOwner());
this.assessment = new AssessmentView((Assessment) assessmentResponse.getAssessment());
 
if(assessmentResponse.getAnswers() != null)
{
for(AssessmentQuestionAnswer questionAnswer : assessmentResponse.getAnswers())
{
AssessmentQuestionAnswerView questionAnswerView = new AssessmentQuestionAnswerView(questionAnswer, new AssessmentQuestionPossibleAnswerView(questionAnswer.getPossibleAnswer()));
this.answers.add(questionAnswerView);
}
}
}
 
public void persistViewInObject(AssessmentResponse response)
{
}
 
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
 
public Date getDate() {
return date;
}
 
public void setDate(Date date) {
this.date = date;
}
 
public boolean isAnswered() {
return answered;
}
 
public void setAnswered(boolean answered) {
this.answered = answered;
}
 
public boolean isEvaluated() {
return evaluated;
}
 
public void setEvaluated(boolean evaluated) {
this.evaluated = evaluated;
}
 
public double getQuotation() {
return quotation;
}
 
public void setQuotation(double quotation) {
this.quotation = quotation;
}
 
public UserView getOwner() {
return owner;
}
 
public void setOwner(UserView owner) {
this.owner = owner;
}
 
public AssessmentView getAssessment() {
return assessment;
}
 
public void setAssessment(AssessmentView assessment) {
this.assessment = assessment;
}
 
public List<AssessmentQuestionAnswerView> getAnswers() {
return answers;
}
 
public void setAnswers(List<AssessmentQuestionAnswerView> answers) {
this.answers = answers;
}
 
public String getIdentifier() {
return identifier;
}
 
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
 
@Override
public Class getReferenceClass() {
return AssessmentResponseImpl.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/UserView.java
59,6 → 59,11
//This field should be set true when a user View is representing a deleted user
private boolean deleted = false;
 
 
private boolean autoBlockMode;
private boolean autoBlock;
private boolean manualBlock;
 
private List<RecordView> creatorRecords;
private List<RecordView> contributorRecords;
 
101,6 → 106,10
this.office = user.getOffice();
this.ext = user.getExt();
 
this.autoBlockMode = user.isAutoBlockMode();
this.autoBlock = user.isAutoBlock();
this.manualBlock = user.isManualBlock();
 
if(user instanceof Teacher)
{
mainArea = ((Teacher)user).getMainArea();
114,8 → 123,30
}
}
 
public boolean isAutoBlockMode() {
return autoBlockMode;
}
 
public void setAutoBlockMode(boolean autoBlockMode) {
this.autoBlockMode = autoBlockMode;
}
 
public boolean isAutoBlock() {
return autoBlock;
}
 
public void setAutoBlock(boolean autoBlock) {
this.autoBlock = autoBlock;
}
 
public boolean isManualBlock() {
return manualBlock;
}
 
public void setManualBlock(boolean manualBlock) {
this.manualBlock = manualBlock;
}
 
public void persistViewInObjectAdmin(User user)
{
user.setName(name);
139,6 → 170,9
user.setScholarDegree(scholarDegree);
user.setOffice(office);
user.setExt(ext);
user.setAutoBlockMode(autoBlockMode);
user.setAutoBlock(autoBlock);
user.setManualBlock(manualBlock);
 
if(password != null && password.length() > 0)
{
/impl/src/java/pt/estgp/estgweb/domain/views/AnnouncementView.java
64,6 → 64,8
private int popupwidth;
private int popupheight;
 
private int position; //posicao do anuncio na lista de apresentacao do portal
 
public AnnouncementView()
{
courseUnitView = new CourseUnitView();
107,6 → 109,7
this.saveDate = announcement.getSaveDate();
this.popupwidth = announcement.getPopupwidthpx();
this.popupheight = announcement.getPopupheightpx();
this.position = announcement.getPosition();
if(announcement instanceof CourseUnitAnnouncementImpl)
{
courseUnitView = new CourseUnitView(((CourseUnitAnnouncement)announcement).getCourseUnit());
135,6 → 138,8
announcement.setInternal(internal);
announcement.setPopupheightpx(popupheight);
announcement.setPopupwidthpx(popupwidth);
announcement.setPosition(position);//quando e' um user normal a editar nao ve o campo position entao vem zero do site nao faz mal porque assim ate se garante que so o admin pode mecher nisto
 
if(announcement instanceof CourseUnitAnnouncement && courseUnitView != null && courseUnitView.getId() > 0)
{
((CourseUnitAnnouncement)announcement).setCourseUnit(DaoFactory.getCourseUnitDaoImpl().load(courseUnitView.getId()));
178,6 → 183,14
this.courseUnitView = courseUnitView;
}
 
public int getPosition() {
return position;
}
 
public void setPosition(int position) {
this.position = position;
}
 
public long getBigImageId()
{
return bigImageId;
/impl/src/java/pt/estgp/estgweb/domain/views/AssessmentQuestionItemView.java
New file
0,0 → 1,147
package pt.estgp.estgweb.domain.views;
 
import org.apache.log4j.Logger;
import org.apache.struts.upload.FormFile;
import pt.estgp.estgweb.domain.AssessmentQuestionItem;
import pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswer;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 21/Jul/2013
* Time: 5:00:38
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionItemView extends DomainObjectView{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionItemView.class);
 
private long id;
private String textpt;
private String texten;
private AssessmentQuestionView question;
private List<AssessmentQuestionPossibleAnswerView> possibleAnswers = new ArrayList<AssessmentQuestionPossibleAnswerView>();
 
private String radioValue;
private String textareaValue;
private FormFile uploadFile = null;
 
public AssessmentQuestionItemView()
{}
 
public AssessmentQuestionItemView(AssessmentQuestionItem questionItem)
{
super(questionItem);
init(questionItem);
}
 
public AssessmentQuestionItemView(AssessmentQuestionItem questionItem, AssessmentQuestionView q)
{
super(questionItem);
if(q != null)
this.question = q;
init(questionItem);
}
 
private void init(AssessmentQuestionItem questionItem)
{
this.id = questionItem.getId();
this.textpt = questionItem.getTextpt();
this.texten = questionItem.getTexten();
 
if(questionItem.getPossibleAnswers() != null)
{
for(AssessmentQuestionPossibleAnswer possible: questionItem.getPossibleAnswers())
{
AssessmentQuestionPossibleAnswerView possibleAnswerView = new AssessmentQuestionPossibleAnswerView(possible,this);
this.possibleAnswers.add(possibleAnswerView);
}
}
//alterei aqui
// this.question = new AssessmentQuestionView((AssessmentQuestion)questionItem.getQuestion());
}
 
public void persistViewInObject(AssessmentQuestionItem questionItem)
{
questionItem.setTextpt(textpt);
questionItem.setTexten(texten);
}
 
public String getRadioValue() {
return radioValue;
}
 
public void setRadioValue(String radioValue) {
this.radioValue = radioValue;
}
 
public String getTextareaValue() {
return textareaValue;
}
 
public void setTextareaValue(String textareaValue) {
this.textareaValue = textareaValue;
}
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
 
public String getTextpt() {
return textpt;
}
 
public void setTextpt(String textpt) {
this.textpt = textpt;
}
 
public String getTexten() {
return texten;
}
 
public void setTexten(String texten) {
this.texten = texten;
}
 
public AssessmentQuestionView getQuestion() {
return question;
}
 
public void setQuestion(AssessmentQuestionView question) {
this.question = question;
}
 
public List<AssessmentQuestionPossibleAnswerView> getPossibleAnswers() {
return possibleAnswers;
}
 
public void setPossibleAnswers(List<AssessmentQuestionPossibleAnswerView> possibleAnswers) {
this.possibleAnswers = possibleAnswers;
}
 
public FormFile getUploadFile() {
return uploadFile;
}
 
public void setUploadFile(FormFile uploadFile) {
this.uploadFile = uploadFile;
}
 
@Override
public Class getReferenceClass() {
return AssessmentQuestionItem.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/AssessmentQuestionPossibleAnswerView.java
New file
0,0 → 1,151
package pt.estgp.estgweb.domain.views;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.AssessmentQuestionAnswer;
import pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswer;
import pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswerImpl;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 21/Jul/2013
* Time: 5:08:56
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionPossibleAnswerView extends DomainObjectView{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionPossibleAnswerView.class);
 
private long id;
private String textpt;
private String texten;
private double quotation;
private boolean correct = false;
private AssessmentQuestionItemView questionItem;
private List<AssessmentQuestionAnswerView> answers = new ArrayList<AssessmentQuestionAnswerView>();
 
private boolean checkbox;
 
 
public AssessmentQuestionPossibleAnswerView()
{}
 
public AssessmentQuestionPossibleAnswerView(AssessmentQuestionPossibleAnswer possibleAnswer) {
super(possibleAnswer);
init(possibleAnswer);
}
 
public AssessmentQuestionPossibleAnswerView(AssessmentQuestionPossibleAnswer possibleAnswer, AssessmentQuestionItemView i) {
super(possibleAnswer);
if(i != null)
this.questionItem = i;
init(possibleAnswer);
}
 
private void init(AssessmentQuestionPossibleAnswer possibleAnswer)
{
this.id = possibleAnswer.getId();
this.textpt = possibleAnswer.getTextpt();
this.texten = possibleAnswer.getTexten();
this.quotation = possibleAnswer.getQuotation();
this.correct = possibleAnswer.isCorrect();
 
if(possibleAnswer.getAnswers() != null)
{
for(AssessmentQuestionAnswer answer: possibleAnswer.getAnswers())
{
AssessmentQuestionAnswerView answerView = new AssessmentQuestionAnswerView(answer,this);
this.answers.add(answerView);
}
}
//alterei aqui
// this.questionItem = new AssessmentQuestionItemView((AssessmentQuestionItem)possibleAnswer.getQuestionItem());
 
}
 
public void persistViewInObject(AssessmentQuestionPossibleAnswer possibleAnswer)
{
possibleAnswer.setTextpt(textpt);
possibleAnswer.setTexten(texten);
possibleAnswer.setQuotation(quotation);
possibleAnswer.setCorrect(correct);
}
 
public long getId() {
return id;
}
 
public void setId(long id) {
this.id = id;
}
 
public String getTextpt() {
return textpt;
}
 
public void setTextpt(String textpt) {
this.textpt = textpt;
}
 
public String getTexten() {
return texten;
}
 
public boolean isCheckbox() {
return checkbox;
}
 
public void setCheckbox(boolean checkbox) {
this.checkbox = checkbox;
}
 
public void setTexten(String texten) {
this.texten = texten;
}
 
public double getQuotation() {
return quotation;
}
 
public void setQuotation(double quotation) {
this.quotation = quotation;
}
 
public AssessmentQuestionItemView getQuestionItem() {
return questionItem;
}
 
public void setQuestionItem(AssessmentQuestionItemView questionItem) {
this.questionItem = questionItem;
}
 
public List<AssessmentQuestionAnswerView> getAnswers() {
return answers;
}
 
public void setAnswers(List<AssessmentQuestionAnswerView> answers) {
this.answers = answers;
}
 
public boolean isCorrect() {
return correct;
}
 
public void setCorrect(boolean correct) {
this.correct = correct;
}
 
@Override
public Class getReferenceClass() {
return AssessmentQuestionPossibleAnswerImpl.class;
}
 
@Override
public Serializable getSerializable() {
return id;
}
}
/impl/src/java/pt/estgp/estgweb/domain/DomainObjectFactory.java
254,4 → 254,29
{
return new SurveyStatsGraphicImpl();
}
// Filipe Matos
public static AssessmentImpl createAssessmentImpl()
{
return new AssessmentImpl();
}
public static AssessmentQuestionImpl createAssessmentQuestionImpl()
{
return new AssessmentQuestionImpl();
}
public static AssessmentQuestionItemImpl createAssessmentQuestionItemImpl()
{
return new AssessmentQuestionItemImpl();
}
public static AssessmentQuestionPossibleAnswerImpl createAssessmentQuestionPossibleAnswerImpl()
{
return new AssessmentQuestionPossibleAnswerImpl();
}
public static AssessmentQuestionAnswerImpl createAssessmentQuestionAnswerImpl()
{
return new AssessmentQuestionAnswerImpl();
}
public static AssessmentResponseImpl createAssessmentResponseImpl()
{
return new AssessmentResponseImpl();
}
}
/impl/src/java/pt/estgp/estgweb/domain/AssessmentResponseImpl.java
New file
0,0 → 1,52
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:00:27
* To change this template use File | Settings | File Templates.
*/
public class AssessmentResponseImpl extends AssessmentResponse implements IOwned{
 
private static final Logger logger = Logger.getLogger(AssessmentResponseImpl.class);
 
@Override
public boolean isOwnedBy(GenericUser u)
{
return isOwnedBy(u,false);
}
 
@Override
public boolean isOwnedBy(GenericUser u, boolean transaction)
{
return u.getId() == getOwner().getId() || u.getId() == this.getAssessment().getOwner().getId();
//depois meter isto tbm
// u.getId() == this.getAssessment().getCourseUnit().getCourse().getCoordinator().getId();
}
 
@Override
public GenericUser getOwner()
{
return super.getOwner();
}
@Override
public List<String> getOwnerRoles() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
public String getChoosedOwnerRole() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public Serializable getSerializable() {
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/AssessmentQuestionItemImpl.java
New file
0,0 → 1,37
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 18:51:07
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionItemImpl extends AssessmentQuestionItem{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionItemImpl.class);
 
@Override
public GenericUser getOwner() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public List<String> getOwnerRoles() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
public String getChoosedOwnerRole() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public Serializable getSerializable() {
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseDaoImpl.java
186,6 → 186,8
.list();
}
 
 
// Duarte Santos
public List<String> loadAreas()
{
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AssessmentResponseDaoImpl.java
New file
0,0 → 1,83
package pt.estgp.estgweb.domain.dao.impl;
 
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import pt.estgp.estgweb.domain.AssessmentResponse;
import pt.estgp.estgweb.domain.AssessmentResponseImpl;
 
import java.util.Date;
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.*;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:48:06
* To change this template use File | Settings | File Templates.
*/
public class AssessmentResponseDaoImpl extends AssessmentResponseDao{
 
private static final Logger logger = Logger.getLogger(AssessmentResponseDaoImpl.class);
 
public static AssessmentResponseDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof AssessmentResponseDaoImpl))
myInstance = new AssessmentResponseDaoImpl();
return (AssessmentResponseDaoImpl) myInstance;
}
 
public List<AssessmentResponse> loadOwnedResponses(long id)
{
return createCriteria().add(eq("owner.id",id)).add(eq("answered",true)).addOrder(Order.desc("id")).list();
}
 
public List<AssessmentResponse> loadResponsesByAssessmentId(long assessmentId)
{
List list = createCriteria().add(eq("assessment.id", assessmentId)).list();
 
if(list.size() == 0)
return null;
else
return list;
}
 
public List<AssessmentResponse> loadResponsesByAssessmentIdAnswered(long assessmentId)
{
List list = createCriteria().add(eq("assessment.id", assessmentId))
.add(eq("answered",true)).add(eq("evaluated",false)).list();
 
if(list.size() == 0)
return null;
else
return list;
}
 
 
public long countResponses(long assessmentId, Boolean answered, Boolean evaluated)
{
Criteria c = createCriteria();
c.add(eq("assessment.id",assessmentId));
if(answered != null)
c.add(eq("answered",answered));
if(evaluated != null)
c.add(eq("evaluated",evaluated));
c.setProjection(Projections.projectionList()
.add(Projections.rowCount())
);
return ((Integer) c.uniqueResult()).longValue();
}
 
public List<AssessmentResponseImpl> loadByUserId(long userId)
{
Criteria c = createCriteria()
.createAlias("assessment","a")
.add(eq("owner.id",userId))
.add(eq("answered", false))
.add(and(lt("a.startDate", new Date()),gt("a.endDate", new Date())));
return c.list();
 
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AssessmentQuestionDaoImpl.java
New file
0,0 → 1,21
package pt.estgp.estgweb.domain.dao.impl;
 
import org.apache.log4j.Logger;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:43:13
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionDaoImpl extends AssessmentQuestionDao{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionDaoImpl.class);
 
public static AssessmentQuestionDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof AssessmentQuestionDaoImpl))
myInstance = new AssessmentQuestionDaoImpl();
return (AssessmentQuestionDaoImpl) myInstance;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AssessmentDaoImpl.java
New file
0,0 → 1,47
package pt.estgp.estgweb.domain.dao.impl;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import org.hibernate.criterion.Order;
import pt.estgp.estgweb.domain.Assessment;
import pt.estgp.estgweb.domain.AssessmentImpl;
 
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.eq;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:37:29
* To change this template use File | Settings | File Templates.
*/
public class AssessmentDaoImpl extends AbstractDao<AssessmentImpl>{
 
private static final Logger logger = Logger.getLogger(AssessmentDaoImpl.class);
 
protected static AssessmentDaoImpl myInstance = null;
public static AssessmentDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof AssessmentDaoImpl))
myInstance = new AssessmentDaoImpl();
return (AssessmentDaoImpl) myInstance;
}
 
public List<Assessment> loadOwnedAssessments(long id)
{
return createCriteria().add(eq("owner.id",id)).addOrder(Order.desc("id")).list();
}
 
public Assessment loadByRepositoryId(String identifier)
{
return (Assessment) createCriteria()
.add(eq("identifier",identifier))
.uniqueResult();
}
 
@Override
protected Class getReferenceClass() {
return AssessmentImpl.class;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AnnouncementDaoImpl.java
1,24 → 1,21
package pt.estgp.estgweb.domain.dao.impl;
 
import jomm.utils.MyCalendar;
import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoUtils;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.common.ISearchResults;
import pt.estgp.estgweb.services.common.SearchTypeEnum;
import pt.estgp.estgweb.domain.dao.DaoUtils;
import pt.estgp.estgweb.services.announcements.CreateAnnouncementService;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.services.common.SearchTypeEnum;
 
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.*;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.Criteria;
import org.apache.lucene.search.Query;
import jomm.dao.impl.AbstractDao;
import jomm.utils.MyCalendar;
 
 
/**
308,6 → 305,7
.add(or(or(gt("expireDate", now), eq("expireDate", now)), isNull("expireDate")))
.add(eq("status", true))
.add(coSubTargets)
.addOrder(Order.desc("position")) //NOVO
.addOrder(Order.asc("expireDate"));
return criteria;
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AssessmentQuestionItemDaoImpl.java
New file
0,0 → 1,21
package pt.estgp.estgweb.domain.dao.impl;
 
import org.apache.log4j.Logger;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:45:12
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionItemDaoImpl extends AssessmentQuestionItemDao{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionItemDaoImpl.class);
 
public static AssessmentQuestionItemDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof AssessmentQuestionItemDaoImpl))
myInstance = new AssessmentQuestionItemDaoImpl();
return (AssessmentQuestionItemDaoImpl) myInstance;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AssessmentQuestionAnswerDaoImpl.java
New file
0,0 → 1,74
package pt.estgp.estgweb.domain.dao.impl;
 
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import pt.estgp.estgweb.domain.AssessmentQuestionAnswerImpl;
 
import java.util.List;
 
import static org.hibernate.criterion.Restrictions.eq;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:44:05
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionAnswerDaoImpl extends AssessmentQuestionAnswerDao{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionAnswerDaoImpl.class);
 
public static AssessmentQuestionAnswerDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof AssessmentQuestionAnswerDaoImpl))
myInstance = new AssessmentQuestionAnswerDaoImpl();
return (AssessmentQuestionAnswerDaoImpl) myInstance;
}
 
public List<AssessmentQuestionAnswerImpl> loadByAssessmentId(long assessmentId)
{
Criteria c = createCriteria()
.createAlias("response","r")
.createAlias("r.assessment","a")
.add(eq("a.id",assessmentId));
return c.list();
 
}
 
public List<AssessmentQuestionAnswerImpl> loadByAssessmentIdNotEvaluated(long assessmentId)
{
Criteria c = createCriteria()
.createAlias("response","r")
.createAlias("r.assessment","a")
.add(eq("a.id",assessmentId))
.add(eq("evaluated", false));
return c.list();
}
 
public List<AssessmentQuestionAnswerImpl> loadByQuestionIdNotEvaluated(long questionId)
{
Criteria c = createCriteria()
.createAlias("possibleAnswer","pA")
.createAlias("pA.questionItem","qI")
.createAlias("qI.question","q")
.add(eq("q.id",questionId))
.add(eq("evaluated", false));
return c.list();
}
 
public long countResponses(long questionId)
{
Criteria c = createCriteria();
c.createAlias("possibleAnswer","pA");
c.createAlias("pA.questionItem","qI");
c.createAlias("qI.question","q");
 
 
c.add(eq("q.id",questionId));
c.setProjection(Projections.projectionList()
.add(Projections.rowCount())
);
return ((Integer) c.uniqueResult()).longValue();
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AssessmentQuestionPossibleAnswerDaoImpl.java
New file
0,0 → 1,21
package pt.estgp.estgweb.domain.dao.impl;
 
import org.apache.log4j.Logger;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 19:46:11
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionPossibleAnswerDaoImpl extends AssessmentQuestionPossibleAnswerDao{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionPossibleAnswerDaoImpl.class);
 
public static AssessmentQuestionPossibleAnswerDaoImpl getInstance() {
if (myInstance == null || !(myInstance instanceof AssessmentQuestionPossibleAnswerDaoImpl))
myInstance = new AssessmentQuestionPossibleAnswerDaoImpl();
return (AssessmentQuestionPossibleAnswerDaoImpl) myInstance;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoFactory.java
249,4 → 249,29
{
return SurveyStatsGraphicDaoImpl.getInstance();
}
//Filipe Matos
public static AssessmentQuestionDaoImpl getAssessmentQuestionDaoImpl()
{
return AssessmentQuestionDaoImpl.getInstance();
}
public static AssessmentQuestionItemDaoImpl getAssessmentQuestionItemDaoImpl()
{
return AssessmentQuestionItemDaoImpl.getInstance();
}
public static AssessmentQuestionPossibleAnswerDaoImpl getAssessmentQuestionPossibleAnswerDaoImpl()
{
return AssessmentQuestionPossibleAnswerDaoImpl.getInstance();
}
public static AssessmentDaoImpl getAssessmentDaoImpl()
{
return AssessmentDaoImpl.getInstance();
}
public static AssessmentQuestionAnswerDaoImpl getAssessmentQuestionAnswerDaoImpl()
{
return AssessmentQuestionAnswerDaoImpl.getInstance();
}
public static AssessmentResponseDaoImpl getAssessmentResponseDaoImpl()
{
return AssessmentResponseDaoImpl.getInstance();
}
}
/impl/src/java/pt/estgp/estgweb/domain/AssessmentQuestionImpl.java
New file
0,0 → 1,37
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 18:48:00
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionImpl extends AssessmentQuestion{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionImpl.class);
 
@Override
public GenericUser getOwner() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public List<String> getOwnerRoles() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
public String getChoosedOwnerRole() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public Serializable getSerializable() {
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/AssessmentQuestionAnswerImpl.java
New file
0,0 → 1,37
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 18/Jul/2013
* Time: 18:49:35
* To change this template use File | Settings | File Templates.
*/
public class AssessmentQuestionAnswerImpl extends AssessmentQuestionAnswer{
 
private static final Logger logger = Logger.getLogger(AssessmentQuestionAnswerImpl.class);
 
@Override
public GenericUser getOwner() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public List<String> getOwnerRoles() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
public String getChoosedOwnerRole() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
 
@Override
public Serializable getSerializable() {
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/GenericUserImpl.java
112,4 → 112,18
}
return strBuilder.toString();
}
 
//Filipe Matos
//depois ir meter isto no globals
public boolean isTeacher()
{
return hasRole("teacher");
}
public boolean isStudent()
{
return hasRole("student");
}
 
}
 
 
/impl/src/java/pt/estgp/estgweb/filters/filters/CanEditAssessmentClass.java
New file
0,0 → 1,45
package pt.estgp.estgweb.filters.filters;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.IEdit;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.filters.chains.LoadControlFilter;
import pt.estgp.estgweb.filters.exceptions.AccessDeniedOperationException;
import pt.estgp.estgweb.filters.exceptions.NeedAuthenticationException;
import pt.estgp.estgweb.filters.filters.utils.LoadObjectFromParameters;
import pt.utl.ist.berserk.ServiceRequest;
import pt.utl.ist.berserk.ServiceResponse;
import pt.utl.ist.berserk.logic.filterManager.FilterParameters;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterException;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 1/Ago/2013
* Time: 18:40:44
* To change this template use File | Settings | File Templates.
*/
public class CanEditAssessmentClass extends LoadControlFilter {
 
private static final Logger logger = Logger.getLogger(CanEditAssessmentClass.class);
 
public void execute(ServiceRequest request, ServiceResponse response, FilterParameters filterParameters) throws FilterException, Exception
{
UserSession userSession = (UserSession) request.getServiceParameters().getParameter(Globals.USER_SESSION_KEY);
 
if(userSession.getUser() == null)
{
logger.info("try access restricted area:" + request.getRequester());
throw new NeedAuthenticationException();
}
 
IEdit iEdit = (IEdit) LoadObjectFromParameters.loadObjectFromClassName((String) filterParameters.getParameter(1), filterParameters, request.getServiceParameters());
 
if(!iEdit.canEdit(userSession.getUser(),true))
{
logger.warn(userSession.getUser().getUsername() + ": try access restricted area");
throw new AccessDeniedOperationException("fail.owner");
}
}
}
/impl/src/java/pt/estgp/estgweb/filters/filters/ResourceAccessControlAssessment.java
New file
0,0 → 1,22
package pt.estgp.estgweb.filters.filters;
 
import pt.estgp.estgweb.domain.Assessment;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlFilter;
 
 
public class ResourceAccessControlAssessment extends ResourceAccessControlFilter
{
@Override
public boolean canAccessResource(UserSession userSession, String identifier)
{
Assessment a;
a = DaoFactory.getAssessmentDaoImpl().loadByRepositoryId(identifier);
if(a == null)
{
return false;
}
return (a.isOwnedBy(userSession.getUser()));
}
}
/impl/src/java/pt/estgp/estgweb/web/form/assessments/AssessmentsForm.java
New file
0,0 → 1,547
package pt.estgp.estgweb.web.form.assessments;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import org.apache.struts.upload.MultipartRequestWrapper;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.views.*;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.form.AddRolesForm;
 
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 20/Jul/2013
* Time: 18:31:33
* To change this template use File | Settings | File Templates.
*/
public class AssessmentsForm extends AddRolesForm{
 
private static final Logger logger = Logger.getLogger(AssessmentsForm.class);
 
private static List<String> assessmentTypes = ConfigProperties.getListValues("assessments.type");
private static List<String> assessmentQuestionTypes = ConfigProperties.getListValues("assessments.question.type");
private static List<String> assessmentQuestionTypesSelfEvaluation = ConfigProperties.getListValues("assessments.question.type");
private static List<String> assessmentEvaluationTime = ConfigProperties.getListValues("assessments.evaluation.time");
private static List<String> assessmentCorrectAnonymous = ConfigProperties.getListValues("assessments.correctA");
private static List<String> assessmentCorrectSelection = ConfigProperties.getListValues("assessments.correction.selection");
 
private AssessmentView assessmentView = new AssessmentView();
private AssessmentResponseView assessmentResponseView = new AssessmentResponseView();
private List<AssessmentResponseView> assessmentResponsesView = new ArrayList<AssessmentResponseView>();
private List<AssessmentQuestionView> assessmentQuestionsRView = new ArrayList<AssessmentQuestionView>();
private List<AssessmentQuestionAnswerView> assessmentQuestionAnswers = new ArrayList();
private long courseUnitId;
private String startDate;
private String endDate;
private String questionType;
private long counter = -1;
 
private List<UserView> possibleUsersResponse = new ArrayList<UserView>();
private String[] selectedUsers = {};
private String time;
private String timeExtra;
 
private String correctionAnonymous;
private String correctionSelection;
 
private FormFile bigImageT;
private String bigImageStrT;
 
public AssessmentsForm()
{
if(assessmentTypes.size() > 0)
assessmentView.setType(assessmentTypes.get(0));
assessmentQuestionTypesSelfEvaluation.remove("text");
assessmentQuestionTypesSelfEvaluation.remove("practical");
}
 
 
public List<AssessmentQuestionAnswerView> getAssessmentQuestionAnswers() {
return assessmentQuestionAnswers;
}
 
public void setAssessmentQuestionAnswers(List<AssessmentQuestionAnswerView> assessmentQuestionAnswers) {
this.assessmentQuestionAnswers = assessmentQuestionAnswers;
}
 
public String getCorrectionAnonymous() {
return correctionAnonymous;
}
 
public void setCorrectionAnonymous(String correctionAnonymous) {
this.correctionAnonymous = correctionAnonymous;
}
 
public String getCorrectionSelection() {
return correctionSelection;
}
 
public void setCorrectionSelection(String correctionSelection) {
this.correctionSelection = correctionSelection;
}
 
public List<String> getAssessmentTypes() {
return assessmentTypes;
}
 
public List<String> getAssessmentCorrectAnonymous() {
return assessmentCorrectAnonymous;
}
 
public void setAssessmentCorrectAnonymous(List<String> assessmentCorrectAnonymous) {
AssessmentsForm.assessmentCorrectAnonymous = assessmentCorrectAnonymous;
}
 
public List<String> getAssessmentCorrectSelection() {
return assessmentCorrectSelection;
}
 
public List<AssessmentQuestionView> getAssessmentQuestionsRView() {
return assessmentQuestionsRView;
}
 
public void setAssessmentQuestionsRView(List<AssessmentQuestionView> assessmentQuestionsRView) {
this.assessmentQuestionsRView = assessmentQuestionsRView;
}
 
public void setAssessmentCorrectSelection(List<String> assessmentCorrectSelection) {
AssessmentsForm.assessmentCorrectSelection = assessmentCorrectSelection;
}
 
public void setAssessmentTypes(List<String> assessmentTypes) {
AssessmentsForm.assessmentTypes = assessmentTypes;
}
 
public List<String> getAssessmentQuestionTypesSelfEvaluation() {
return assessmentQuestionTypesSelfEvaluation;
}
 
public void setAssessmentQuestionTypesSelfEvaluation(List<String> assessmentQuestionTypesSelfEvaluation) {
AssessmentsForm.assessmentQuestionTypesSelfEvaluation = assessmentQuestionTypesSelfEvaluation;
}
 
public List<String> getAssessmentQuestionTypes() {
return assessmentQuestionTypes;
}
 
public List<UserView> getPossibleUsersResponse() {
return possibleUsersResponse;
}
 
public void setPossibleUsersResponse(List<UserView> possibleUsersResponse) {
this.possibleUsersResponse = possibleUsersResponse;
}
 
public List<String> getAssessmentEvaluationTime() {
return assessmentEvaluationTime;
}
 
public void setAssessmentEvaluationTime(List<String> assessmentEvaluationTime) {
AssessmentsForm.assessmentEvaluationTime = assessmentEvaluationTime;
}
 
public void setAssessmentQuestionTypes(List<String> assessmentQuestionTypes) {
AssessmentsForm.assessmentQuestionTypes = assessmentQuestionTypes;
}
 
public AssessmentView getAssessmentView() {
return assessmentView;
}
 
public String getTimeExtra() {
return timeExtra;
}
 
public void setTimeExtra(String timeExtra) {
this.timeExtra = timeExtra;
}
 
public String getTime() {
return time;
}
 
public void setTime(String time) {
this.time = time;
}
 
public String[] getSelectedUsers() {
return selectedUsers;
}
 
public void setSelectedUsers(String[] selectedUsers) {
this.selectedUsers = selectedUsers;
}
 
public void setAssessmentView(AssessmentView assessmentView) {
this.assessmentView = assessmentView;
}
 
public AssessmentResponseView getAssessmentResponseView() {
return assessmentResponseView;
}
 
 
public List<AssessmentResponseView> getAssessmentResponsesView() {
return assessmentResponsesView;
}
 
public void setAssessmentResponsesView(List<AssessmentResponseView> assessmentResponsesView) {
this.assessmentResponsesView = assessmentResponsesView;
}
 
public long getCourseUnitId() {
return courseUnitId;
}
 
public void setCourseUnitId(long couseUnitId) {
this.courseUnitId = couseUnitId;
}
 
public void setAssessmentResponseView(AssessmentResponseView assessmentResponseView) {
this.assessmentResponseView = assessmentResponseView;
}
 
public String getBigImageStrT() {
return bigImageStrT;
}
 
public void setBigImageStrT(String bigImageStr) {
this.bigImageStrT = bigImageStr;
}
 
public FormFile getBigImageT() {
return bigImageT;
}
 
public void setBigImageT(FormFile bigImage) {
this.bigImageT = bigImage;
}
 
public String getStartDate() {
return startDate;
}
 
public void setStartDate(String startDate) {
this.startDate = startDate;
}
 
public String getEndDate() {
return endDate;
}
 
public void setEndDate(String endDate) {
this.endDate = endDate;
}
 
public String getQuestionType() {
return questionType;
}
 
public void setQuestionType(String questionType) {
this.questionType = questionType;
}
 
public long getCounter() {
return counter;
}
 
public void setCounter(long counter) {
this.counter = counter;
}
 
public long getCounterAndDec()
{
return this.counter--;
}
 
 
//
public void reset(ActionMapping actionMapping, HttpServletRequest request)
{
// HttpServletRequest request2 = request;
// ActionMapping actionMapping2 = actionMapping;
//
// if (request2 instanceof MultipartRequestWrapper) {
// // MultipartRequestWrapper wrapper = (MultipartRequestWrapper) request2;
// // request = wrapper.getRequest();
// logger.debug("found a multipart wrapped request");
// // when enctype=multipart/form-data, struts wraps the request.
// // for our work here, we just want the original request parameters.
// MultipartRequestWrapper wrapper = (MultipartRequestWrapper) request2;
// CommonsMultipartRequestHandler handler = new CommonsMultipartRequestHandler();
// handler.setMapping(actionMapping2);
// try {
// handler.handleRequest(request2);
// } catch (ServletException ex) {
// logger.error(ex, ex);
// }
//
// Map paramMap = handler.getTextElements();
// // Map paramMap = wrapper.getParameterMap();
// for (Iterator it = paramMap.keySet().iterator(); it.hasNext() ;) {
// String key = (String) it.next();
// String value = paramMap.get(key).toString();
// logger.debug("map key: " + key + "=" + value);
// wrapper.setParameter(key, value);
// }
// // ((MultipartRequestWrapper) request).setParameter("tipo", questionType);
// }
// selectedUsers = null;
// assessmentView.setQuestions(null);
 
UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSessionFromRequest(request);
String parameter0=null;
if (request instanceof MultipartRequestWrapper) {
parameter0 = (String) sess.get("questionsListSize");
}
// String parameter0 = request.getParameter("questionsListSize");
if(parameter0 != null)
{
int questionsSize = Integer.parseInt(parameter0);
assessmentView.setQuestions(new ArrayList<AssessmentQuestionView>());
for(int i=0;i<questionsSize;i++)
{
assessmentView.getQuestions().add(new AssessmentQuestionView());
//String parameter1 = request.getParameter("itemsListSize"+i);
String parameter1 = (String)sess.get("itemsListSize"+i);
if(parameter1 != null)
{
int itemsSize = Integer.parseInt(parameter1);
assessmentView.getQuestions().get(i).setQuestionItems(new ArrayList<AssessmentQuestionItemView>());
for(int j=0;j<itemsSize;j++)
{
assessmentView.getQuestions().get(i).getQuestionItems().add(new AssessmentQuestionItemView());
// String parameter2 = request.getParameter("candidatesListSize"+i+j);
String parameter2 = (String)sess.get("candidatesListSize"+i+j);
int candidatesSize = 0;
if(parameter2 != null)
{
candidatesSize = Integer.parseInt(parameter2);
assessmentView.getQuestions().get(i).getQuestionItems().get(j).setPossibleAnswers(new ArrayList<AssessmentQuestionPossibleAnswerView>());
for(int k=0;k<candidatesSize;k++)
{
assessmentView.getQuestions().get(i).getQuestionItems().get(j).getPossibleAnswers().add(new AssessmentQuestionPossibleAnswerView());
}
}
}
}
 
// String parameter3 = request.getParameter("candidatesLabelsSize"+i);
String parameter3 = (String)sess.get("candidatesLabelsSize"+i);
if(parameter3 != null)
{
int candidatesLabelsSize = Integer.parseInt(parameter3);
assessmentView.getQuestions().get(i).setPossibleLabels(new ArrayList<AssessmentQuestionPossibleAnswerView>());
for(int m=0;m<candidatesLabelsSize;m++)
{
assessmentView.getQuestions().get(i).getPossibleLabels().add(new AssessmentQuestionPossibleAnswerView());
}
}
}
}
//esta parte é para as correcções prova a prova////////////////////////////////
String parameterC0 = request.getParameter("questionsListSizeC");
if(parameterC0 != null)
{
int questionsSize = Integer.parseInt(parameterC0);
assessmentView.setQuestions(new ArrayList<AssessmentQuestionView>());
for(int i=0;i<questionsSize;i++)
{
assessmentView.getQuestions().add(new AssessmentQuestionView());
String parameterC1 = request.getParameter("itemsListSizeC"+i);
if(parameterC1 != null)
{
int itemsSize = Integer.parseInt(parameterC1);
assessmentView.getQuestions().get(i).setQuestionItems(new ArrayList<AssessmentQuestionItemView>());
for(int j=0;j<itemsSize;j++)
{
assessmentView.getQuestions().get(i).getQuestionItems().add(new AssessmentQuestionItemView());
String parameterC2 = request.getParameter("candidatesListSizeC"+i+j);
int candidatesSize = 0;
if(parameterC2 != null)
{
candidatesSize = Integer.parseInt(parameterC2);
assessmentView.getQuestions().get(i).getQuestionItems().get(j).setPossibleAnswers(new ArrayList<AssessmentQuestionPossibleAnswerView>());
for(int k=0;k<candidatesSize;k++)
{
assessmentView.getQuestions().get(i).getQuestionItems().get(j).getPossibleAnswers().add(new AssessmentQuestionPossibleAnswerView());
}
}
}
}
 
}
String parameterC3 = request.getParameter("answersListSizeC");
if(parameterC3 != null)
{
int answersListSize = Integer.parseInt(parameterC3);
assessmentResponseView.setAnswers(new ArrayList<AssessmentQuestionAnswerView>());
for (int a=0;a<answersListSize;a++)
{
assessmentResponseView.getAnswers().add(new AssessmentQuestionAnswerView());
}
}
}
 
//esta parte é para as correcções questão a questão////////////////////////////////
String parameterCQuestion0 = request.getParameter("questionsListSizeCQuestion");
if(parameterCQuestion0 != null)
{
int questionsSize = Integer.parseInt(parameterCQuestion0);
assessmentQuestionsRView = new ArrayList<AssessmentQuestionView>();
for(int i=0;i<questionsSize;i++)
{
assessmentQuestionsRView.add(new AssessmentQuestionView());
}
String parameterCQuestion1 = request.getParameter("answersListSizeCQuestion");
if(parameterCQuestion1 != null)
{
int answersListSize = Integer.parseInt(parameterCQuestion1);
assessmentQuestionAnswers = new ArrayList<AssessmentQuestionAnswerView>();
for (int a=0;a<answersListSize;a++)
{
assessmentQuestionAnswers.add(new AssessmentQuestionAnswerView());
}
}
}
}
 
 
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest)
{
ActionErrors errors = new ActionErrors();
 
if(httpServletRequest.getParameter("dispatch").equals("save"))
{
if(assessmentView.getTitle() == null || assessmentView.getTitle().trim().length() == 0)
addMessageWithKeys(errors,httpServletRequest,"errors.required","assessment.submit.form.title");
 
if(assessmentView.getQuestions().size() == 0)
addMessage(errors,httpServletRequest,"survey.submit.form.error.need.questions");
else
{
int i = 1;
double quotation =0;
for(AssessmentQuestionView qView : assessmentView.getQuestions())
{ //verificar se é prova de autoavaliacao e se tens questoes de texto ou praticas
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_TEXT) && assessmentView.getType().equals("self-evaluation"))
addMessage(errors, httpServletRequest, "assessment.submit.form.error.type.question.text");
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_PRACTICAL) && assessmentView.getType().equals("self-evaluation"))
addMessage(errors, httpServletRequest, "assessment.submit.form.error.type.question.text");
 
 
//texto da questao
if(qView.getTextpt() == null || qView.getTextpt().trim().length() == 0)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.label", Integer.toString(i));
//cotação da questao
if(qView.getQuotation() <= 0)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.quotation", Integer.toString(i));
//somar a cotações
quotation = quotation + qView.getQuotation();
 
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO) || qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK))
{
AssessmentQuestionItemView iView = qView.getQuestionItems().get(0);
 
if(iView.getPossibleAnswers().size() == 0)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.hoption", Integer.toString(i));
else
{
boolean correct=false;
for(AssessmentQuestionPossibleAnswerView cView : iView.getPossibleAnswers())
{
if(cView.getTextpt() == null || cView.getTextpt().trim().length() == 0)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.options.need.labels",Integer.toString(i));
if(cView.isCorrect())
correct=true;
}
if(!correct)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.correct.option",Integer.toString(i));
}
}
else if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
 
boolean flag = false;
 
if(qView.getQuestionItems().size() == 0)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.hoption", Integer.toString(i));
else
{
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
boolean correct=false;
if(iView.getTextpt() == null || iView.getTextpt().trim().length() == 0)
flag = true;
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
if(pView.isCorrect())
correct=true;
}
if(!correct)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.correct.option",Integer.toString(i));
}
}
 
if(qView.getPossibleLabels().size() == 0)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.need.voption", Integer.toString(i));
else
{
for(AssessmentQuestionPossibleAnswerView cView : qView.getPossibleLabels())
{
if(cView.getTextpt() == null || cView.getTextpt().trim().length() == 0)
flag = true;
}
}
 
if(flag)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.question.options.need.labels",Integer.toString(i));
}
i++;
}
if(quotation != 20)
addMessage(errors, httpServletRequest, "assessment.submit.form.error.quotation.total", Integer.toString(i));
}
}
 
 
else if(httpServletRequest.getParameter("dispatch").equals("saveSchedule"))
{
if(time == null || time.length() == 0)
addMessage(errors,httpServletRequest,"assessment.submit.form.error.need.time");
 
if(assessmentView.getType().equals(Globals.ASSESSMENT_TYPE_EVALUATION))
{
if(startDate == null || startDate.length() == 0)
addMessage(errors,httpServletRequest,"assessment.submit.form.error.need.date");
}
 
if(assessmentView.getType().equals(Globals.ASSESSMENT_TYPE_SELFEVALUATION))
{
if(startDate == null || startDate.length() == 0)
addMessage(errors,httpServletRequest,"assessment.submit.form.error.need.start.date");
 
if(endDate == null || endDate.length() == 0)
addMessage(errors,httpServletRequest,"assessment.submit.form.error.need.end.date");
}
 
if(selectedUsers.length ==0)
{
addMessage(errors,httpServletRequest,"assessment.submit.form.error.need.students");
}
}
 
return errors;
}
}
/impl/src/java/pt/estgp/estgweb/web/controllers/assessments/AssessmentController.java
New file
0,0 → 1,1311
package pt.estgp.estgweb.web.controllers.assessments;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.views.*;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.controllers.AddRolesController;
import pt.estgp.estgweb.web.form.assessments.AssessmentsForm;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.estgp.estgweb.web.utils.DomainUtils;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;
 
/**
* Created by IntelliJ IDEA.
* User: Filipe Matos
* Date: 21/Jul/2013
* Time: 14:40:41
* To change this template use File | Settings | File Templates.
*/
public class AssessmentController extends AddRolesController{
 
private static final Logger logger = Logger.getLogger(AssessmentController.class);
 
public ActionForward nothing(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
//este metodo serve apenas para actualizar paginas
 
return mapping.getInputForward();
}
 
public ActionForward changeAssessmentType(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
assessmentForm.getAssessmentQuestionTypesSelfEvaluation().remove("text");
assessmentForm.getAssessmentQuestionTypesSelfEvaluation().remove("practical");
 
return mapping.getInputForward();
}
 
public ActionForward updateRadioBox(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
 
if(request.getParameter("questionId") != null && request.getParameter("candidateId") != null)
{
int questionIndex = Integer.parseInt(request.getParameter("questionId"));
int candidateIndex = Integer.parseInt(request.getParameter("candidateId"));
int itemIndex=0;
 
AssessmentQuestionView qView = assessmentView.getQuestions().get(questionIndex);
 
if(request.getParameter("itemId") != null && qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
itemIndex = Integer.parseInt(request.getParameter("itemId"));
}
 
int index=0;
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
List<AssessmentQuestionPossibleAnswerView> listaPAV = iView.getPossibleAnswers();
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO))
{
for (int i=0;i<listaPAV.size();i++)
{
if(i!=candidateIndex){
listaPAV.get(i).setCorrect(false);
}
}
}
 
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
for (int i=0;i<listaPAV.size();i++)
{
if(index==itemIndex)
{
if(i!=candidateIndex){
listaPAV.get(i).setCorrect(false);
}
}
}
}
index++;
}
 
}
 
return mapping.getInputForward();
}
 
//////////////////////PARTE DE TESTES
public ActionForward create (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
try
{ ///PARA TESTAR SE APAGA TUDO
UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSessionFromRequest(request);
List<String> nomesSessao = (List<String>) sess.get("nomesSessao");
if(nomesSessao!=null)
{
for(int i=0;i<nomesSessao.size();i++)
{
sess.remove(nomesSessao.get(i));
sess.serialize(request,response);
}
sess.remove("nomesSessao");
sess.serialize(request,response);
}
return mapping.findForward("from.add.role");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
// logger.error(e,e);
throw e;
}
}
 
 
public ActionForward addQuestion(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
long id1 = assessmentForm.getCounterAndDec();
 
AssessmentQuestionView qView = new AssessmentQuestionView();
qView.setId(id1);
qView.setType(assessmentForm.getQuestionType());
///meter os meus tipos no globals
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_TEXT) || qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_PRACTICAL))
{
AssessmentQuestionItemView iView = new AssessmentQuestionItemView();
iView.setId(assessmentForm.getCounterAndDec());
AssessmentQuestionPossibleAnswerView pView = new AssessmentQuestionPossibleAnswerView();
pView.setId(assessmentForm.getCounterAndDec());
//pView.setType(qView.getType());
iView.getPossibleAnswers().add(pView);
qView.getQuestionItems().add(iView);
}
else if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK) || qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO))
{
AssessmentQuestionItemView iView = new AssessmentQuestionItemView();
iView.setId(assessmentForm.getCounterAndDec());
qView.getQuestionItems().add(iView);
}
 
assessmentView.getQuestions().add(qView);
 
return mapping.getInputForward();
}
 
public ActionForward removeQuestion(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
 
if(request.getParameter("questionId") != null)
{
int questionIndex = Integer.parseInt(request.getParameter("questionId"));
 
AssessmentQuestionView qView = assessmentView.getQuestions().get(questionIndex);
 
String questionsToDelete = assessmentView.getDeletedQuestions()+qView.getId()+",";
String itemsToDelete = assessmentView.getDeletedItems();
String candidatesToDelete = assessmentView.getDeletedCandidates();
 
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
itemsToDelete = itemsToDelete+iView.getId()+",";
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
candidatesToDelete = candidatesToDelete+pView.getId()+",";
}
}
 
assessmentView.setDeletedQuestions(questionsToDelete);
assessmentView.setDeletedItems(itemsToDelete);
assessmentView.setDeletedCandidates(candidatesToDelete);
 
assessmentView.getQuestions().remove(questionIndex);
}
 
return mapping.getInputForward();
}
 
public ActionForward addItemOption(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
long id = assessmentForm.getCounterAndDec();
 
if(request.getParameter("questionId") != null)
{
int questionIndex = Integer.parseInt(request.getParameter("questionId"));
 
AssessmentQuestionView qView = assessmentView.getQuestions().get(questionIndex);
AssessmentQuestionItemView iView = new AssessmentQuestionItemView();
iView.setId(id);
 
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
for(AssessmentQuestionPossibleAnswerView candidateLabel : qView.getPossibleLabels())
{
AssessmentQuestionPossibleAnswerView pView = new AssessmentQuestionPossibleAnswerView();
pView.setId(assessmentForm.getCounterAndDec());
iView.getPossibleAnswers().add(pView);
}
}
 
qView.getQuestionItems().add(iView);
}
 
return mapping.getInputForward();
}
 
public ActionForward removeItemOption(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
 
if(request.getParameter("questionId") != null && request.getParameter("itemId") != null)
{
int questionIndex = Integer.parseInt(request.getParameter("questionId"));
int itemIndex = Integer.parseInt(request.getParameter("itemId"));
 
AssessmentQuestionView qView = assessmentView.getQuestions().get(questionIndex);
AssessmentQuestionItemView iView = qView.getQuestionItems().get(itemIndex);
 
String itemsToDelete = ""+iView.getId()+",";
String candidatesToDelete = "";
for(AssessmentQuestionPossibleAnswerView cView : iView.getPossibleAnswers())
{
candidatesToDelete = candidatesToDelete+cView.getId()+",";
}
 
assessmentView.setDeletedItems(assessmentView.getDeletedItems().concat(itemsToDelete));
assessmentView.setDeletedCandidates(assessmentView.getDeletedCandidates().concat(candidatesToDelete));
 
qView.getQuestionItems().remove(itemIndex);
}
return mapping.getInputForward();
}
 
public ActionForward addCandidateOption(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
 
if(request.getParameter("questionId") != null)
{
int questionIndex = Integer.parseInt(request.getParameter("questionId"));
 
AssessmentQuestionView qView = assessmentView.getQuestions().get(questionIndex);
 
if(!qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_TEXT) && qView.getQuestionItems().size() == 0)
{
addError(request,"assessment.submit.form.error.question.need.hoption.first");
return mapping.getInputForward();
}
 
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
qView.getPossibleLabels().add(new AssessmentQuestionPossibleAnswerView());
 
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
long id = assessmentForm.getCounterAndDec();
AssessmentQuestionPossibleAnswerView pView = new AssessmentQuestionPossibleAnswerView();
pView.setId(id);
//pView.setType(qView.getType());
iView.getPossibleAnswers().add(pView);
}
}
 
return mapping.getInputForward();
}
 
public ActionForward removeCandidateOption(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentForm.getAssessmentView();
 
if(request.getParameter("questionId") != null && request.getParameter("candidateId") != null)
{
int questionIndex = Integer.parseInt(request.getParameter("questionId"));
int candidateIndex = Integer.parseInt(request.getParameter("candidateId"));
 
AssessmentQuestionView qView = assessmentView.getQuestions().get(questionIndex);
 
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
qView.getPossibleLabels().remove(candidateIndex);
 
String candidatesToDelete = "";
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
AssessmentQuestionPossibleAnswerView pView = iView.getPossibleAnswers().get(candidateIndex);
iView.getPossibleAnswers().remove(candidateIndex);
candidatesToDelete = candidatesToDelete+pView.getId()+",";
}
 
assessmentView.setDeletedCandidates(assessmentView.getDeletedCandidates().concat(candidatesToDelete));
}
 
return mapping.getInputForward();
}
 
 
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
 
AssessmentView view = assessmentsForm.getAssessmentView();
view.getCourseUnit().setId(assessmentsForm.getCourseUnitId());
 
for(AssessmentQuestionView qView : view.getQuestions())
{
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{ //tratar das questoes de matriz
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
int index = 0;
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
pView.setTextpt(qView.getPossibleLabels().get(index).getTextpt());
index++;
}
}
}
//tratar das imagens
if(qView.getBigImage() != null && qView.getBigImage().getFileSize() !=0)
{
String description = view.getTitle()+qView.getTextpt();
qView.setImage(DomainUtils.getNewImage(qView.getBigImage(),description));
}
//tratar das cotações das possiveis respostas
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO))
{
for(AssessmentQuestionPossibleAnswerView pView : qView.getQuestionItems().get(0).getPossibleAnswers())
{
if(pView.isCorrect())
pView.setQuotation(qView.getQuotation());
}
}
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK))
{ double quotationSplit=0;
int questionsCorrected=0;
for(AssessmentQuestionPossibleAnswerView pView : qView.getQuestionItems().get(0).getPossibleAnswers())
{
if(pView.isCorrect())
questionsCorrected++;
}
//teste
double cotacao = qView.getQuotation();
double questionCorrectedD = questionsCorrected;
quotationSplit = cotacao / questionCorrectedD;
//quotationSplit = qView.getQuotation() / questionsCorrected;
//valor a atribuir as respostas possiveis obtido
//falta atribuir
for(AssessmentQuestionPossibleAnswerView pView : qView.getQuestionItems().get(0).getPossibleAnswers())
{
if(pView.isCorrect())
pView.setQuotation(quotationSplit);
}
}
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
double quotationSplit=0;
int questionsCorrected=0;
//correr items e respostas possiveis
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
if(pView.isCorrect())
questionsCorrected++;
}
}
double cotacao = qView.getQuotation();
double questionCorrectedD = questionsCorrected;
quotationSplit = cotacao / questionCorrectedD;
//quotationSplit = qView.getQuotation() / questionsCorrected;
//valor a atribuir as respostas possiveis obtido
//falta atribuir
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
if(pView.isCorrect())
pView.setQuotation(quotationSplit);
}
}
}
 
 
}
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {view};
boolean newAssessment = true;
if(view.getId() > 0)
newAssessment = false;
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"CreateEditAssessment",args,names);
 
if(assessmentView != null)
{
if(newAssessment)
addMessage(request, "assessment.message.created.success");
else
addMessage(request, "assessment.message.edited.success");
}
 
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward edit(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try {
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {new Long(request.getParameter("id"))};
 
AssessmentView view;
view = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"LoadEditAssessment",args,names);
 
if(view != null)
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
assessmentForm.setCourseUnitId(view.getCourseUnit().getId());
 
 
for(AssessmentQuestionView qView : view.getQuestions())
{
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
AssessmentQuestionItemView iView = qView.getQuestionItems().get(0);
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
AssessmentQuestionPossibleAnswerView pViewAux = new AssessmentQuestionPossibleAnswerView();
pViewAux.setTextpt(pView.getTextpt());
qView.getPossibleLabels().add(pViewAux);
}
}
}
 
assessmentForm.setAssessmentView(view);
 
return mapping.getInputForward();
}
return mapping.findForward("serviceZone");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
 
public ActionForward clone(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try {
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {new Long(request.getParameter("id"))};
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"LoadCloneAssessment",args,names);
 
if(assessmentView != null)
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
assessmentForm.setCourseUnitId(assessmentView.getCourseUnit().getId());
 
assessmentView.setId(assessmentForm.getCounterAndDec());
assessmentView.setTitle(null);
 
for(AssessmentQuestionView qView : assessmentView.getQuestions())
{
qView.setId(assessmentForm.getCounterAndDec());
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
iView.setId(assessmentForm.getCounterAndDec());
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
pView.setId(assessmentForm.getCounterAndDec());
}
}
}
 
for(AssessmentQuestionView qView : assessmentView.getQuestions())
{
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
AssessmentQuestionItemView iView = qView.getQuestionItems().get(0);
for(AssessmentQuestionPossibleAnswerView pAView : iView.getPossibleAnswers())
{
AssessmentQuestionPossibleAnswerView pAViewAux = new AssessmentQuestionPossibleAnswerView();
pAViewAux.setTextpt(pAView.getTextpt());
qView.getPossibleLabels().add(pAViewAux);
}
}
}
 
assessmentForm.setAssessmentView(assessmentView);
 
return mapping.getInputForward();
}
return mapping.findForward("serviceZone");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward schedule(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try {
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {new Long(request.getParameter("id"))};
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"LoadScheduleAssessment",args,names);
 
if(assessmentView != null)
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
assessmentForm.setAssessmentView(assessmentView);
assessmentForm.setPossibleUsersResponse(assessmentView.getCourseUnit().getStudentsOrderedByName());
 
assessmentForm.setSelectedUsers(new String[assessmentView.getResponses().size()]);
for(int i=0;i<assessmentView.getResponses().size();i++)
{
assessmentForm.getSelectedUsers()[i] = String.valueOf(assessmentView.getResponses().get(i).getOwner().getId());
}
 
return mapping.findForward("schedule");
}
return mapping.findForward("serviceZone");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
 
public ActionForward saveSchedule(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
 
AssessmentView view = assessmentsForm.getAssessmentView();
//tratar as datas
if(view.getType().equals(Globals.ASSESSMENT_TYPE_EVALUATION))
{
view.setStartDate(DatesUtils.getDateFromString(assessmentsForm.getStartDate()));
view.setEndDate(DatesUtils.getDateFromString(assessmentsForm.getStartDate())); //a data de fim fica a mesma que a data de inicio
view.getEndDate().setHours(23);
view.getEndDate().setMinutes(59);
view.getEndDate().setSeconds(59);
}
if(view.getType().equals(Globals.ASSESSMENT_TYPE_SELFEVALUATION))
{
view.setStartDate(DatesUtils.getDateFromString(assessmentsForm.getStartDate()));
view.setEndDate(DatesUtils.getDateFromString(assessmentsForm.getEndDate()));
view.getEndDate().setHours(23);
view.getEndDate().setMinutes(59);
view.getEndDate().setSeconds(59);
}
//tratar dos tempos
String[] times = assessmentsForm.getTime().split("\\:");
int hours = Integer.parseInt(times[0]);
int minutes = Integer.parseInt(times[1]);
view.setTime(new Time(hours,minutes,0));
//tratar os alunos selecionados
List<Long> selectedUsersId = new ArrayList<Long>();
for(int i=0;i<assessmentsForm.getSelectedUsers().length;i++)
{
selectedUsersId.add(Long.parseLong(assessmentsForm.getSelectedUsers()[i]));
}
 
//chamada ao serviço
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {view,selectedUsersId,request};
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"ScheduleAssessment",args,names);
 
if(assessmentView != null)
{
addMessage(request, "assessment.message.scheduled.success");
}
 
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward editSchedule(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try {
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {new Long(request.getParameter("id"))};
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"LoadScheduleAssessment",args,names);
 
if(assessmentView != null)
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
assessmentForm.setAssessmentView(assessmentView);
assessmentForm.setPossibleUsersResponse(assessmentView.getCourseUnit().getStudentsOrderedByName());
 
assessmentForm.setSelectedUsers(new String[assessmentView.getResponses().size()]);
for(int i=0;i<assessmentView.getResponses().size();i++)
{
assessmentForm.getSelectedUsers()[i] = String.valueOf(assessmentView.getResponses().get(i).getOwner().getId());
}
 
return mapping.findForward("editSchedule");
}
return mapping.findForward("serviceZone");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward saveEditSchedule(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
 
AssessmentView view = assessmentsForm.getAssessmentView();
 
//tratar os alunos selecionados
List<Long> selectedUsersId = new ArrayList<Long>();
for(int i=0;i<assessmentsForm.getSelectedUsers().length;i++)
{
selectedUsersId.add(Long.parseLong(assessmentsForm.getSelectedUsers()[i]));
}
 
//chamada ao serviço
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {view,selectedUsersId,request};
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"ScheduleAssessment",args,names);
 
if(assessmentView != null)
{
addMessage(request, "assessment.message.scheduled.success");
}
 
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward loadResponse(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
create(mapping,form,request,response);
 
try
{
long resp = Long.parseLong(request.getParameter("resp"));
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {resp};
 
AssessmentResponseView assessmentResponseView;
assessmentResponseView = (AssessmentResponseView) sm.execute(RequestUtils.getRequester(request,response),"LoadAssessmentResponse",args,names);
 
if(assessmentResponseView != null)
{
assessmentsForm.setAssessmentResponseView(assessmentResponseView);
AssessmentView assessmentView = assessmentResponseView.getAssessment();
for(AssessmentQuestionView qView : assessmentView.getQuestions())
{
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
AssessmentQuestionItemView iView = qView.getQuestionItems().get(0);
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
AssessmentQuestionPossibleAnswerView pViewAux = new AssessmentQuestionPossibleAnswerView();
pViewAux.setTextpt(pView.getTextpt());
qView.getPossibleLabels().add(pViewAux);
}
}
}
assessmentsForm.setAssessmentView(assessmentView);
 
return mapping.findForward("response");
 
}
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
 
public ActionForward answer(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
 
AssessmentView assessmentView = assessmentsForm.getAssessmentView();
AssessmentResponseView rView = assessmentsForm.getAssessmentResponseView();
 
for(AssessmentQuestionView qView : assessmentView.getQuestions())
{
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
AssessmentQuestionAnswerView aView = new AssessmentQuestionAnswerView();
aView.setId(-1);
 
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_TEXT))
{
String textValue = iView.getTextareaValue();
if(textValue != null && textValue.length() > 0)
{
aView.setTextAnswer(textValue);
aView.setPossibleAnswer(pView);
pView.getAnswers().add(aView);
}
}
else if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_PRACTICAL))
{
if(iView.getUploadFile() != null && iView.getUploadFile().getFileSize()>0)
{
aView.setPossibleAnswer(pView);
pView.getAnswers().add(aView);
}
}
else if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO) || qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX))
{
String radioValue = iView.getRadioValue();
if(radioValue != null)
{
long pId = Long.parseLong(iView.getRadioValue());
if(pView.getId() == pId)
{
aView.setPossibleAnswer(pView);
pView.getAnswers().add(aView);
}
}
}
else if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK))
{
if(pView.isCheckbox())
{
AssessmentQuestionAnswerView aView2 = new AssessmentQuestionAnswerView();
aView2.setId(-1);
aView2.setPossibleAnswer(pView);
pView.getAnswers().add(aView2);
}
}
}
}
}
 
try
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {rView.getId(),assessmentView};
 
AssessmentView aView;
aView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"InsertAssessmentAnswers",args,names);
 
if(aView != null)
{
addMessage(request, "assessment.message.answered.success");
}
 
return mapping.findForward("home");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
 
public ActionForward startCorrect(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try {
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {new Long(request.getParameter("id"))};
 
AssessmentView assessmentView;
assessmentView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"LoadAssessment",args,names);
 
if(assessmentView != null)
{
AssessmentsForm assessmentForm = (AssessmentsForm) form;
assessmentForm.setAssessmentView(assessmentView);
 
return mapping.findForward("startCorrect");
}
return mapping.findForward("serviceZone");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
 
public ActionForward confirmChoicesCorrect(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
AssessmentView assessmentView = assessmentsForm.getAssessmentView();
//atirar configurações da correcção para a sessão, primeiro remover o que lá estiver depois adicionar
try
{
UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSession(request,response);
sess.remove("correctionConf");
sess.serialize(request,response);
List<String> correctionConf = new ArrayList<String>();
correctionConf.add(assessmentsForm.getCorrectionSelection());
correctionConf.add(assessmentsForm.getCorrectionAnonymous());
sess.put("correctionConf", (Serializable) correctionConf);
sess.serialize(request,response);
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e,e);
throw e;
}
/////////////////////////////////////////////////////////////////////////////
 
//se a correcção for prova a prova
try{
if(assessmentsForm.getCorrectionSelection().equals("assessment"))
{
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {assessmentView.getId()};
 
List<AssessmentResponseView> responsesViews = null;
responsesViews = (List<AssessmentResponseView>) sm.execute(RequestUtils.getRequester(request,response),"LoadAssessmentResponses",args,names);
assessmentsForm.setAssessmentResponsesView(responsesViews);
 
}
//se a correcção for questão a questão
else if(assessmentsForm.getCorrectionSelection().equals("question"))
{
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {assessmentView.getId()};
 
List<AssessmentQuestionView> questionViews = null;
questionViews = (List<AssessmentQuestionView>) sm.execute(RequestUtils.getRequester(request,response),"LoadQuestionsResponses",args,names);
assessmentsForm.setAssessmentQuestionsRView(questionViews);
}
 
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("listQuestionsOrResponsesToCorrect");
}
 
public ActionForward loadCorrectResponse(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
 
try
{ //buscar configurações da correcção à sessão
UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSession(request,response);
List<String> l = (List<String>) sess.get("correctionConf");
assessmentsForm.setCorrectionSelection(l.get(0));
assessmentsForm.setCorrectionAnonymous(l.get(1));
/////////////////////////////////////////////////////////
long resp = Long.parseLong(request.getParameter("respId"));
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {resp};
 
AssessmentResponseView assessmentResponseView;
assessmentResponseView = (AssessmentResponseView) sm.execute(RequestUtils.getRequester(request,response),"LoadAssessmentResponse",args,names);
 
if(assessmentResponseView != null)
{
AssessmentView assessmentView = assessmentResponseView.getAssessment();
List<AssessmentQuestionView> questionList = new ArrayList<AssessmentQuestionView>(assessmentView.getQuestions());
//so interessam as questoes de texto e praticas
for(AssessmentQuestionView qView : questionList)
{
if(qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_MATRIX)
|| qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_CHECK)
|| qView.getType().equals(Globals.ASSESSMENT_QUESTION_TYPE_RADIO))
{
assessmentView.getQuestions().remove(qView);
}
//verificar se existe resposta a esta questão
else{
boolean exist = false;
for(AssessmentQuestionItemView iView : qView.getQuestionItems())
{
for(AssessmentQuestionPossibleAnswerView pView : iView.getPossibleAnswers())
{
for(AssessmentQuestionAnswerView aView : assessmentResponseView.getAnswers())
{
if(aView.getPossibleAnswer().getId() == pView.getId())
{
exist = true;
}
}
}
}
if(!exist)
{
assessmentView.getQuestions().remove(qView);
}
}
}
///////////////////////////////////////////////////
//apagar as answers que ja estao corrigidas (corrigidas automaticamente) ou corrigidas questao a questao
List<AssessmentQuestionAnswerView> answerList = new ArrayList<AssessmentQuestionAnswerView>(assessmentResponseView.getAnswers());
for(AssessmentQuestionAnswerView aView : answerList)
{
if(aView.isEvaluated())
{
assessmentResponseView.getAnswers().remove(aView);
}
}
 
assessmentsForm.setAssessmentResponseView(assessmentResponseView);
assessmentsForm.setAssessmentView(assessmentView);
 
return mapping.findForward("loadCorrectResponse");
 
}
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
public ActionForward submitCorrectResponse(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
AssessmentResponseView assessmentResponseView = assessmentsForm.getAssessmentResponseView();
try
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {assessmentResponseView};
 
AssessmentResponseView aRView;
aRView = (AssessmentResponseView) sm.execute(RequestUtils.getRequester(request,response),"EvaluateAssessmentResponse",args,names);
 
if(aRView != null)
{
addMessage(request, "assessment.message.corrected.sucess");
confirmChoicesCorrect(mapping,form,request,response);
return mapping.findForward("listQuestionsOrResponsesToCorrect");
}
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
public ActionForward loadQuestionResponses(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
 
try
{ //buscar configurações da correcção à sessão
UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSession(request,response);
List<String> l = (List<String>) sess.get("correctionConf");
assessmentsForm.setCorrectionSelection(l.get(0));
assessmentsForm.setCorrectionAnonymous(l.get(1));
/////////////////////////////////////////////////////////
long question = Long.parseLong(request.getParameter("questId"));
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {question};
 
List<AssessmentQuestionAnswerView> assessmentQuestionAnswersView;
assessmentQuestionAnswersView = (List<AssessmentQuestionAnswerView>) sm.execute(RequestUtils.getRequester(request,response),"LoadQuestionResponses",args,names);
 
if(assessmentQuestionAnswersView != null)
{
assessmentsForm.setAssessmentQuestionAnswers(assessmentQuestionAnswersView);
assessmentsForm.setAssessmentQuestionsRView(new ArrayList<AssessmentQuestionView>());
//achar a questão
for(AssessmentQuestionView qView : assessmentQuestionAnswersView.get(0).getResponse().getAssessment().getQuestions())
{
if(qView.getId()==question)
{
assessmentsForm.getAssessmentQuestionsRView().add(qView);
break;
}
}
return mapping.findForward("loadQuestionResponses");
 
}
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
public ActionForward submitCorrectQuestionResponses(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
AssessmentsForm assessmentsForm = (AssessmentsForm) form;
List<AssessmentQuestionAnswerView> questionAnswersView = assessmentsForm.getAssessmentQuestionAnswers();
 
try
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {questionAnswersView};
 
AssessmentView aView;
aView = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"EvaluateQuestionResponses",args,names);
 
if(aView != null)
{
addMessage(request, "assessment.message.question.corrected.sucess");
assessmentsForm.setAssessmentView(aView);//para o método seguinte funcionar
confirmChoicesCorrect(mapping,form,request,response);
return mapping.findForward("listQuestionsOrResponsesToCorrect");
}
return mapping.findForward("serviceZone");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
 
public ActionForward generateEvaluationsPdf(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try {
IServiceManager sm = ServiceManager.getInstance();
String[] names = {"serializable"};
Object[] args = {new Long(request.getParameter("id"))};
 
AssessmentView view;
view = (AssessmentView) sm.execute(RequestUtils.getRequester(request,response),"GenerateEvaluationsPdf",args,names);
 
if(view != null)
{
addMessage(request, "assessment.message.evaluations.pdf.generated.sucess");
return mapping.findForward("listAssessments");
}
return mapping.findForward("listAssessments");
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
}
/impl/src/updates/db/update15-position-annoucement.sql
New file
0,0 → 1,0
ALTER TABLE `baco3`.`announcement` ADD COLUMN `position` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `popupheightpx`;
/impl/src/updates/db/update-16.sql
New file
0,0 → 1,3
ALTER TABLE `user` ADD COLUMN `autoBlockMode` TINYINT(1) UNSIGNED DEFAULT 1 AFTER `mainArea`,
ADD COLUMN `autoBlock` TINYINT(1) UNSIGNED DEFAULT 0 AFTER `autoBlockMode`,
ADD COLUMN `manualBlock` TINYINT(1) UNSIGNED DEFAULT 0 AFTER `autoBlock`;
/impl/src/updates/db/update-17-Assessments.sql
New file
0,0 → 1,158
 
--
-- Definition of table `assessment`
--
 
DROP TABLE IF EXISTS `assessment`;
CREATE TABLE `assessment` (
`id` bigint(20) NOT NULL auto_increment,
`discriminator` varchar(255) NOT NULL,
`updateDate` datetime NOT NULL,
`title` varchar(255) default NULL,
`type` varchar(255) default NULL,
`year` varchar(255) default NULL,
`semester` varchar(255) default NULL,
`startDate` datetime default NULL,
`endDate` datetime default NULL,
`saveDate` datetime default NULL,
`time` time default NULL,
`timeExtra` time default NULL,
`evaluationsIdentifier` varchar(255) default NULL,
`identifier` varchar(255) default NULL,
`status` varchar(255) default NULL,
`statusPercentage` int(11) default NULL,
`evaluationTime` varchar(255) default NULL,
`owner` bigint(20) default NULL,
`courseUnit` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `FK7E5336C252876F6F` (`owner`),
KEY `FK7E5336C2DF034EA4` (`courseUnit`),
CONSTRAINT `FK7E5336C2DF034EA4` FOREIGN KEY (`courseUnit`) REFERENCES `courseunit` (`id`),
CONSTRAINT `FK7E5336C252876F6F` FOREIGN KEY (`owner`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `assessment`
--
 
 
--
-- Definition of table `assessmentquestion`
--
 
DROP TABLE IF EXISTS `assessmentquestion`;
CREATE TABLE `assessmentquestion` (
`id` bigint(20) NOT NULL auto_increment,
`discriminator` varchar(255) NOT NULL,
`textpt` varchar(255) default NULL,
`texten` varchar(255) default NULL,
`type` varchar(255) default NULL,
`quotation` double default NULL,
`textExtra` varchar(255) default NULL,
`textLimit` int(11) default NULL,
`image` bigint(20) default NULL,
`assessment` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `FK11B90A821B70CB0` (`image`),
KEY `FK11B90A8B2ABDFCA` (`assessment`),
CONSTRAINT `FK11B90A8B2ABDFCA` FOREIGN KEY (`assessment`) REFERENCES `assessment` (`id`),
CONSTRAINT `FK11B90A821B70CB0` FOREIGN KEY (`image`) REFERENCES `image` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `assessmentquestion`
--
 
--
-- Definition of table `assessmentquestionanswer`
--
 
DROP TABLE IF EXISTS `assessmentquestionanswer`;
CREATE TABLE `assessmentquestionanswer` (
`id` bigint(20) NOT NULL auto_increment,
`discriminator` varchar(255) NOT NULL,
`textAnswer` varchar(255) default NULL,
`identifier` varchar(255) default NULL,
`note` varchar(255) default NULL,
`quotation` double default NULL,
`evaluated` bit(1) default NULL,
`possibleAnswer` bigint(20) default NULL,
`response` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `FK6510B26670BADAA` (`response`),
KEY `FK6510B266F549A9AC` (`possibleAnswer`),
CONSTRAINT `FK6510B266F549A9AC` FOREIGN KEY (`possibleAnswer`) REFERENCES `assessmentquestionpossibleanswer` (`id`),
CONSTRAINT `FK6510B26670BADAA` FOREIGN KEY (`response`) REFERENCES `assessmentresponse` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `assessmentquestionanswer`
--
 
--
-- Definition of table `assessmentquestionitem`
--
 
DROP TABLE IF EXISTS `assessmentquestionitem`;
CREATE TABLE `assessmentquestionitem` (
`id` bigint(20) NOT NULL auto_increment,
`discriminator` varchar(255) NOT NULL,
`textpt` varchar(255) default NULL,
`texten` varchar(255) default NULL,
`question` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `FKF24477BBA4A1FCF4` (`question`),
CONSTRAINT `FKF24477BBA4A1FCF4` FOREIGN KEY (`question`) REFERENCES `assessmentquestion` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `assessmentquestionitem`
--
 
--
-- Definition of table `assessmentquestionpossibleanswer`
--
 
DROP TABLE IF EXISTS `assessmentquestionpossibleanswer`;
CREATE TABLE `assessmentquestionpossibleanswer` (
`id` bigint(20) NOT NULL auto_increment,
`discriminator` varchar(255) NOT NULL,
`textpt` varchar(255) default NULL,
`texten` varchar(255) default NULL,
`quotation` double default NULL,
`correct` bit(1) default NULL,
`questionItem` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `FKBEEF5B175906CD3A` (`questionItem`),
CONSTRAINT `FKBEEF5B175906CD3A` FOREIGN KEY (`questionItem`) REFERENCES `assessmentquestionitem` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `assessmentquestionpossibleanswer`
--
 
--
-- Definition of table `assessmentresponse`
--
 
DROP TABLE IF EXISTS `assessmentresponse`;
CREATE TABLE `assessmentresponse` (
`id` bigint(20) NOT NULL auto_increment,
`discriminator` varchar(255) NOT NULL,
`date` datetime default NULL,
`answered` bit(1) default NULL,
`evaluated` bit(1) default NULL,
`quotation` double default NULL,
`identifier` varchar(255) default NULL,
`owner` bigint(20) default NULL,
`assessment` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `FK3250690352876F6F` (`owner`),
KEY `FK32506903B2ABDFCA` (`assessment`),
CONSTRAINT `FK32506903B2ABDFCA` FOREIGN KEY (`assessment`) REFERENCES `assessment` (`id`),
CONSTRAINT `FK3250690352876F6F` FOREIGN KEY (`owner`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `assessmentresponse`
--
/impl/src/hbm/pt/estgp/estgweb/domain/GenericUser.hbm.xml
48,6 → 48,11
<property name="gmail" type="string"/>
<property name="msn" type="string"/>
<property name="scholarDegree" type="string"/>
 
<property name="autoBlockMode" type="boolean"/>
<property name="autoBlock" type="boolean"/>
<property name="manualBlock" type="boolean"/>
 
<set name="groups" table="group_users" lazy="false">
<key column="user_id"/>
<many-to-many column="group_id" class="pt.estgp.estgweb.domain.Group"/>
/impl/src/hbm/pt/estgp/estgweb/domain/Assessment.hbm.xml
New file
0,0 → 1,143
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 
<hibernate-mapping>
<class name="pt.estgp.estgweb.domain.Assessment" table="assessment" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.OwnedDomainObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discriminator"/>
<timestamp source="db" name="updateDate" unsaved-value="null"/>
<property name="title" type="string"/>
<property name="type" type="string"/>
<property name="year" type="string"/>
<property name="semester" type="string"/>
<property name="startDate" type="timestamp"/>
<property name="endDate" type="timestamp"/>
<property name="saveDate" type="timestamp"/>
<property name="time" type="time"/>
<property name="timeExtra" type="time"/>
<property name="evaluationsIdentifier" type="string"/>
<property name="identifier" type="string"/>
<property name="status" type="string"/>
<property name="statusPercentage" type="int"/>
<property name="evaluationTime" type="string"/>
<many-to-one name="owner" class="pt.estgp.estgweb.domain.GenericUser" lazy="false" outer-join="true"/>
<many-to-one name="courseUnit" class="pt.estgp.estgweb.domain.CourseUnit" lazy="false" outer-join="true"/>
<set name="questions" lazy="true" order-by="id asc">
<key column="assessment"/>
<one-to-many class="pt.estgp.estgweb.domain.AssessmentQuestion"/>
</set>
<set name="responses" lazy="true" order-by="id asc">
<key column="assessment"/>
<one-to-many class="pt.estgp.estgweb.domain.AssessmentResponse"/>
</set>
<subclass name="pt.estgp.estgweb.domain.AssessmentImpl" discriminator-value="AssessmentImpl"/>
</class>
 
 
<class name="pt.estgp.estgweb.domain.AssessmentQuestion" table="assessmentquestion" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.OwnedDomainObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discriminator"/>
<property name="textpt" type="string"/>
<property name="texten" type="string"/>
<property name="type" type="string"/>
<property name="quotation" type="double"/>
<property name="textExtra" type="string"/>
<property name="textLimit" type="int"/>
<many-to-one name="image" column="image" class="pt.estgp.estgweb.domain.Image" lazy="no-proxy" outer-join="false" cascade="all"/>
<many-to-one name="assessment" class="pt.estgp.estgweb.domain.Assessment" lazy="false" outer-join="true"/>
<set name="questionItems" lazy="true" order-by="id asc">
<key column="question"/>
<one-to-many class="pt.estgp.estgweb.domain.AssessmentQuestionItem"/>
</set>
<subclass name="pt.estgp.estgweb.domain.AssessmentQuestionImpl" discriminator-value="AssessmentQuestionImpl"/>
</class>
 
 
<class name="pt.estgp.estgweb.domain.AssessmentQuestionItem" table="assessmentquestionitem" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.OwnedDomainObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discriminator"/>
<property name="textpt" type="string"/>
<property name="texten" type="string"/>
<many-to-one name="question" class="pt.estgp.estgweb.domain.AssessmentQuestion" lazy="false" outer-join="true"/>
<set name="possibleAnswers" lazy="true" order-by="id asc">
<key column="questionItem"/>
<one-to-many class="pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswer"/>
</set>
<subclass name="pt.estgp.estgweb.domain.AssessmentQuestionItemImpl" discriminator-value="AssessmentQuestionItemImpl"/>
</class>
 
 
<class name="pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswer" table="assessmentquestionpossibleanswer" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.OwnedDomainObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discriminator"/>
<property name="textpt" type="string"/>
<property name="texten" type="string"/>
<property name="quotation" type="double"/>
<property name="correct" type="boolean"/>
<many-to-one name="questionItem" class="pt.estgp.estgweb.domain.AssessmentQuestionItem" lazy="false" outer-join="true"/>
<set name="answers" lazy="false" order-by="id asc">
<key column="possibleAnswer"/>
<one-to-many class="pt.estgp.estgweb.domain.AssessmentQuestionAnswer"/>
</set>
<subclass name="pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswerImpl" discriminator-value="AssessmentQuestionPossibleAnswer"/>
</class>
 
 
<class name="pt.estgp.estgweb.domain.AssessmentQuestionAnswer" table="assessmentquestionanswer" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.OwnedDomainObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discriminator"/>
<property name="textAnswer" type="string"/>
<property name="identifier" type="string"/>
<property name="note" type="string"/>
<property name="quotation" type="double"/>
<property name="evaluated" type="boolean"/>
<many-to-one name="possibleAnswer" class="pt.estgp.estgweb.domain.AssessmentQuestionPossibleAnswer" lazy="false" outer-join="true"/>
<many-to-one name="response" class="pt.estgp.estgweb.domain.AssessmentResponse" lazy="false" outer-join="true"/>
<subclass name="pt.estgp.estgweb.domain.AssessmentQuestionAnswerImpl" discriminator-value="AssessmentQuestionAnswerImpl"/>
</class>
 
 
<class name="pt.estgp.estgweb.domain.AssessmentResponse" table="assessmentresponse" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.OwnedDomainObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discriminator"/>
<property name="date" type="timestamp"/>
<property name="answered" type="boolean"/>
<property name="evaluated" type="boolean"/>
<property name="quotation" type="double"/>
<property name="identifier" type="string"/>
<many-to-one name="owner" class="pt.estgp.estgweb.domain.GenericUser" lazy="false" outer-join="true"/>
<many-to-one name="assessment" class="pt.estgp.estgweb.domain.Assessment" lazy="false" outer-join="true"/>
<set name="answers" lazy="true" order-by="id asc">
<key column="response"/>
<one-to-many class="pt.estgp.estgweb.domain.AssessmentQuestionAnswer"/>
</set>
<subclass name="pt.estgp.estgweb.domain.AssessmentResponseImpl" discriminator-value="AssessmentResponseImpl"/>
</class>
 
</hibernate-mapping>
/impl/src/hbm/pt/estgp/estgweb/domain/Announcement.hbm.xml
31,6 → 31,7
<property name="counter" type="integer" />
<property name="popupwidthpx" type="integer" />
<property name="popupheightpx" type="integer" />
<property name="position" type="integer" />
<many-to-one name="bigImage" column="bigImage" class="pt.estgp.estgweb.domain.Image" lazy="no-proxy" outer-join="false" cascade="all" />
<many-to-one name="smallImage" column="smallImage" class="pt.estgp.estgweb.domain.Image" lazy="no-proxy" outer-join="false" cascade="all"/>
<many-to-one name="owner" class="pt.estgp.estgweb.domain.GenericUser" lazy="false" outer-join="true"/>
/impl/src/web/imgs/checkboxselected.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/web/imgs/radioboxselected.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/web/admin/profile/profilePersonalData.jsp
31,6 → 31,45
<html:hidden property="role"/>
<html:hidden property="typeClass"/>
<table class="form">
 
<baco:isAdmin>
<tr>
<th>
<bean:message key="profile.autoBlockMode"/>
</th>
<td>
<html:select property="userView.autoBlockMode">
<html:option value="true" key="profile.autoBlockMode.true"/>
<html:option value="false" key="profile.autoBlockMode.false"/>
</html:select>
</td>
</tr>
<tr>
<th>
<bean:message key="profile.autoBlock"/>
</th>
<td>
<html:select property="userView.autoBlock">
<html:option value="true" key="profile.autoBlock.true"/>
<html:option value="false" key="profile.autoBlock.false"/>
</html:select>
</td>
</tr>
<tr>
<th>
<bean:message key="profile.manualBlock"/>
</th>
<td>
<html:select property="userView.manualBlock">
<html:option value="true" key="profile.manualBlock.true"/>
<html:option value="false" key="profile.manualBlock.false"/>
</html:select>
</td>
</tr>
<tr>
<td colspan="2"><hr/></td>
</tr>
</baco:isAdmin>
<baco:isNotAdmin>
<tr>
<th>
/impl/src/web/admin/announcements/submitAnnouncement.jsp
37,6 → 37,31
<baco:isAdmin>
<tr>
<th>
<bean:message key="announcement.position"/>
</th>
<td>
<html:select property="announcementView.position">
<html:option value="0">NEUTRO</html:option>
<html:option value="1">1</html:option>
<html:option value="2">2</html:option>
<html:option value="3">3</html:option>
<html:option value="4">4</html:option>
<html:option value="5">5</html:option>
<html:option value="6">6</html:option>
<html:option value="7">7</html:option>
<html:option value="8">8</html:option>
<html:option value="9">9</html:option>
<html:option value="10">10</html:option>
<html:option value="11">11</html:option>
<html:option value="12">12</html:option>
<html:option value="13">13</html:option>
<html:option value="14">14</html:option>
<html:option value="15">15</html:option>
</html:select>
</td>
</tr>
<tr>
<th>
<bean:message key="announcement.status"/>
</th>
<td>
/impl/src/web/public/index.jsp
5,6 → 5,7
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
60,41 → 61,48
AnnouncementView announcementView = announcementViews.get(i);
request.setAttribute("item",announcementView);
%> <td class="cont">
<table class="flashNew" cellpadding="0" cellspacing="0"><tr>
<th class="imageContainer">
<logic:present name="item" property="smallImage">
<img alt="${item.title}" src="<%=request.getContextPath()%>/imageStream/${item.smallImage.id}">
</logic:present>
</th>
<td class="textContainer">
<logic:empty name="item" property="url">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:empty>
<logic:notEmpty name="item" property="url">
<logic:equal value="false" name="item" property="textBiggerThenPermited">
<h2>
<html:link href="${item.url}">${item.title}</html:link>
</h2>
<p>
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
<logic:equal value="true" name="item" property="textBiggerThenPermited">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
</logic:notEmpty>
</td>
</tr></table>
<table class="flashNew" cellpadding="0" cellspacing="0">
<tr>
<th class="imageContainer">
<logic:present name="item" property="smallImage">
<img alt="${item.title}" src="<%=request.getContextPath()%>/imageStream/${item.smallImage.id}">
</logic:present>
</th>
<td class="textContainer">
<logic:empty name="item" property="url">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:empty>
<logic:notEmpty name="item" property="url">
<logic:equal value="false" name="item" property="textBiggerThenPermited">
<h2>
<html:link href="${item.url}">${item.title}</html:link>
</h2>
<p>
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
<logic:equal value="true" name="item" property="textBiggerThenPermited">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
</logic:notEmpty>
</td>
</tr>
<baco:canManage name="item">
<tr>
<td colspan="2"><a href="<%=request.getContextPath()%>/startEditAnnouncement.do?id=${item.id}">Editar</a></td>
</tr>
</baco:canManage>
</table>
<%
}
%>
154,7 → 162,13
</logic:equal>
</logic:notEmpty>
</td>
</tr></table>
</tr>
<baco:canManage name="item">
<tr>
<td colspan="2"><a href="<%=request.getContextPath()%>/startEditAnnouncement.do?id=${item.id}">Editar</a></td>
</tr>
</baco:canManage>
</table>
<%
}
i = j;
/impl/src/web/public/announcements/announcementsPortalLeft.jsp
51,6 → 51,9
<tr>
<td>
<div class="portalAnnouncementTop">
<baco:canManage name="item">
( <a href="<%=request.getContextPath()%>/startEditAnnouncement.do?id=${item.id}">Editar</a> )
</baco:canManage>
<div class="imageAnnouncementTop">
 
<%
114,6 → 117,7
<%}%>
</logic:notEmpty>
</div>
 
</div>
</td>
</tr>
/impl/src/web/public/announcements/announcements.jsp
6,6 → 6,7
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%
38,6 → 39,9
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
<%}%>
</logic:notEmpty>
<baco:canManage name="item">
( <a href="<%=request.getContextPath()%>/startEditAnnouncement.do?id=${item.id}">Editar</a> )
</baco:canManage>
</li>
</logic:equal>
</logic:iterate>
/impl/src/web/user/assessments/listAssessments.jsp
New file
0,0 → 1,259
<%@ page import="pt.estgp.estgweb.domain.UserSession" %>
<%@ page import="pt.estgp.estgweb.domain.views.AssessmentResponseView" %>
<%@ page import="pt.estgp.estgweb.domain.views.AssessmentView" %>
<%@ page import="pt.estgp.estgweb.domain.views.CourseUnitView" %>
<%@ page import="pt.estgp.estgweb.services.assessments.AssessmentStatusEnum" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.HashSet" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<%
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new String[]{};
 
List<AssessmentView> assessmentViews = new ArrayList<AssessmentView>();
List<AssessmentResponseView> responseViews = new ArrayList<AssessmentResponseView>();
List<CourseUnitView> courseUnitViews = new ArrayList<CourseUnitView>();
List<String> courseUnitViewsIds = new ArrayList<String>();
UserSession userSession = UserSessionProxy.loadUserSession(request, response);
if(userSession.getUser().isTeacher())
{ //owned assessments
assessmentViews = (List<AssessmentView>) sm.execute(RequestUtils.getRequester(request,response),"LoadOwnedAssessments", args, names);
}
else
{
if(userSession.getUser().isStudent())
{ //Aqui vai buscar as respostas do aluno...cada resposta tem a prova
responseViews = (List<AssessmentResponseView>) sm.execute(RequestUtils.getRequester(request,response),"LoadOwnedResponses", args, names);
for(AssessmentResponseView r : responseViews)
{
if(!courseUnitViewsIds.contains(String.valueOf(r.getAssessment().getCourseUnit().getId())))
{
courseUnitViewsIds.add(String.valueOf(r.getAssessment().getCourseUnit().getId()));
System.out.println(String.valueOf(r.getAssessment().getCourseUnit().getId()));
}
}
//adicionar a lista de courseUnitViews
for(String c : courseUnitViewsIds)
{
for(AssessmentResponseView r : responseViews)
{
if(Long.parseLong(c) == r.getAssessment().getCourseUnit().getId())
{
courseUnitViews.add(r.getAssessment().getCourseUnit());
break;
}
}
}
}
}
request.setAttribute("AssessmentViews", assessmentViews);
request.setAttribute("ResponseViews", responseViews);
request.setAttribute("CourseUnitViews", courseUnitViews);
%>
 
<jomm:messages/>
<html:errors/>
<%
if(userSession.getUser().isTeacher())
{
%>
<%
if(assessmentViews.size() > 0)
{
%>
<table class="dataTable">
<tr>
<th><bean:message key="assessment.list.form.title"/></th>
<th><bean:message key="assessment.list.form.type"/></th>
<th><bean:message key="assessment.list.form.evaluationtime"/></th>
<th><bean:message key="assessment.list.form.courseUnit"/></th>
<th><bean:message key="assessment.list.form.year"/></th>
<th><bean:message key="assessment.list.form.semester"/></th>
<th><bean:message key="assessment.list.form.assessment.date"/></th>
<%--<th><bean:message key="assessment.list.form.created.by"/></th>--%>
<th><bean:message key="assessment.list.form.number.responses"/></th>
<th><bean:message key="assessment.list.form.number.evaluated"/></th>
<%--<th><bean:message key="assessment.list.form.status"/></th>--%>
</tr>
 
<logic:iterate id="assessmentView" name="AssessmentViews" type="pt.estgp.estgweb.domain.views.AssessmentView">
<bean:define id="av" name="assessmentView" type="pt.estgp.estgweb.domain.views.AssessmentView"/>
<tr>
<td><bean:write name="assessmentView" property="title"/></td>
<td><bean:message key="assessments.type.${assessmentView.type}"/></td>
<td><bean:message key="assessments.evaluation.time.${assessmentView.evaluationTime}"/></td>
<td><bean:write name="assessmentView" property="courseUnit.name"/></td>
<td><bean:write name="assessmentView" property="year"/></td>
<td><bean:message key="courseunit.${assessmentView.semester}"/></td>
<logic:equal name="assessmentView" property="type" value="evaluation">
<td><bean:write name="assessmentView" property="formatedStartDate"/></td>
</logic:equal>
<logic:equal name="assessmentView" property="type" value="self-evaluation">
<td>
<logic:notEmpty name="assessmentView" property="formatedStartDate">
<bean:write name="assessmentView" property="formatedStartDate"/>
a <bean:write name="assessmentView" property="formatedEndDate"/>
</logic:notEmpty>
</td>
</logic:equal>
<%--<td><bean:write name="assessmentView" property="owner.username"/></td>--%>
<td><bean:write name="assessmentView" property="numberOfResponses"/>/<bean:write name="assessmentView" property="numberTotalOfResponses"/>
<logic:equal name="assessmentView" property="numberOfResponses" value="0">
<html:link action="/user/startEditScheduleAssessmentFromServiceZone.do?id=${assessmentView.id}">
<bean:message key="assessment.list.form.edit.inscriptions"/>
</html:link>
</logic:equal>
</td>
 
<td><bean:write name="assessmentView" property="numberOfCorrected"/>/<bean:write name="assessmentView" property="numberOfResponses"/></td>
<%--<td><bean:write name="assessmentView" property="statusPercentage"/><bean:message key="assessment.list.form.percentage.symbol"/></td>--%>
<%
if(av.getStatus() != null && av.getStatus() == AssessmentStatusEnum.STATUS_STOPPED)
{
%>
<logic:equal name="assessmentView" property="numberOfResponses" value="0">
<td><html:link action="/user/startEditAssessmentFromServiceZone.do?id=${assessmentView.id}"><bean:message key="assessment.list.form.option.edit"/></html:link></td>
</logic:equal>
<td><html:link action="/user/startCloneAssessmentFromServiceZone.do?id=${assessmentView.id}"><bean:message key="assessment.list.form.option.clone"/></html:link></td>
<logic:equal name="assessmentView" property="numberOfResponses" value="0">
<td><html:link action="/user/startScheduleAssessmentFromServiceZone.do?id=${assessmentView.id}"><bean:message key="assessment.list.form.option.schedule"/></html:link></td>
</logic:equal>
<logic:notEqual name="assessmentView" property="numberOfResponses" value="0">
<logic:notMatch name="assessmentView" property="numberOfCorrected" value="${assessmentView.numberOfResponses}">
<td><html:link action="/user/startCorrectAssessmentFromServiceZone.do?id=${assessmentView.id}"><bean:message key="assessment.list.form.option.correct"/></html:link></td>
</logic:notMatch>
</logic:notEqual>
<logic:match name="assessmentView" property="numberOfCorrected" value="${assessmentView.numberOfResponses}">
<logic:notEqual name="assessmentView" property="numberOfCorrected" value="0">
<td><html:link action="/user/generateEvaluationsPdfFromServiceZone.do?id=${assessmentView.id}"><bean:message key="assessment.list.form.option.generate.evaluations.pdf"/></html:link></td>
</logic:notEqual>
</logic:match>
<logic:notEmpty name="assessmentView" property="evaluationsIdentifier">
<td><a href="<%=request.getContextPath()%>/repositoryStream/${assessmentView.evaluationsIdentifier}"><bean:message key="assessment.list.form.option.download.pdf"/></a></td>
</logic:notEmpty>
<logic:notEmpty name="assessmentView" property="identifier">
<td><a href="<%=request.getContextPath()%>/repositoryStream/${assessmentView.identifier}"><bean:message key="assessment.list.form.option.download.assessment.pdf"/></a></td>
</logic:notEmpty>
<%
}
else if(av.getStatus() != null)
{
%>
<td colspan="200"><bean:message key="<%=av.getStatus().getMessageKey()%>"/></td>
<%
}
%>
</tr>
</logic:iterate>
</table>
<%
}
else
{
%>
<bean:message key="assessment.list.form.empty"/>
<%
}
%>
<%
}
%>
 
<%
if(userSession.getUser().isStudent())
{
%>
 
<%
if(responseViews.size() > 0)
{
%>
<br>
<logic:iterate id="courseUnitView" name="CourseUnitViews" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<div style="font-size: 14px; font-weight:bold;">
<bean:write name="courseUnitView" property="name"/>
</div>
 
 
<table class="dataTable">
<tr>
<th><bean:message key="assessment.list.form.title"/></th>
<th><bean:message key="assessment.list.form.type"/></th>
<th><bean:message key="assessment.list.form.evaluationtime"/></th>
<%--<th><bean:message key="assessment.list.form.courseUnit"/></th>--%>
<th><bean:message key="assessment.list.form.year"/></th>
<th><bean:message key="assessment.list.form.semester"/></th>
<th><bean:message key="assessment.list.form.assessment.date"/></th>
<th><bean:message key="assessment.list.form.quotation"/></th>
</tr>
 
<logic:iterate id="responseView" name="ResponseViews" type="pt.estgp.estgweb.domain.views.AssessmentResponseView">
<bean:define id="rAV" name="responseView" type="pt.estgp.estgweb.domain.views.AssessmentResponseView"/>
<logic:equal name="responseView" property="assessment.courseUnit.id" value="${courseUnitView.id}">
<tr>
<td><bean:write name="responseView" property="assessment.title"/></td>
<td><bean:message key="assessments.type.${responseView.assessment.type}"/></td>
<td><bean:message key="assessments.evaluation.time.${responseView.assessment.evaluationTime}"/></td>
<%--<td><bean:write name="responseView" property="assessment.courseUnit.name"/></td>--%>
<td><bean:write name="responseView" property="assessment.year"/></td>
<td><bean:message key="courseunit.${responseView.assessment.semester}"/></td>
<logic:equal name="responseView" property="assessment.type" value="evaluation">
<td><bean:write name="responseView" property="assessment.formatedStartDate"/></td>
</logic:equal>
<logic:equal name="responseView" property="assessment.type" value="self-evaluation">
<td>
<logic:notEmpty name="responseView" property="assessment.formatedStartDate">
<bean:write name="responseView" property="assessment.formatedStartDate"/>
a <bean:write name="responseView" property="assessment.formatedEndDate"/>
</logic:notEmpty>
</td>
</logic:equal>
<logic:equal name="responseView" property="evaluated" value="true">
<td><bean:write name="responseView" property="quotation"/></td>
</logic:equal>
<logic:notEqual name="responseView" property="evaluated" value="true">
<td><bean:message key="assessment.list.form.quotation.empty"/></td>
</logic:notEqual>
<logic:notEmpty name="responseView" property="assessment.identifier">
<td><a href="<%=request.getContextPath()%>/repositoryStream/${responseView.assessment.identifier}"><bean:message key="assessment.list.form.option.download.assessment.pdf"/></a></td>
</logic:notEmpty>
<logic:notEmpty name="responseView" property="identifier">
<td><a href="<%=request.getContextPath()%>/repositoryStream/${responseView.identifier}"><bean:message key="assessment.list.form.option.download.assessment.response.pdf"/></a></td>
</logic:notEmpty>
</tr>
</logic:equal>
</logic:iterate>
</table>
 
<br><br>
</logic:iterate>
 
 
<%
}
else
{
%>
<bean:message key="assessment.list.form.empty"/>
<%
}
%>
 
 
<%
}
%>
/impl/src/web/user/assessments/editScheduleAssessment.jsp
New file
0,0 → 1,96
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jomm:messages/>
<html:errors/>
 
<%
String fromAction = "";
String from = "";
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
%>
<html:form action="${user}/editScheduleAssessment${fromAction}${from}">
<html:hidden property="assessmentView.id"/>
<html:hidden property="assessmentView.type"/>
<input type="hidden" name="dispatch">
 
<table class="form">
<tr>
<th>
<bean:message key="assessment.submit.form.title"/>
</th>
<td>
<nested:write name="AssessmentsForm" property="assessmentView.title"/>
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.submit.form.type"/>
</th>
<td>
<bean:message key="assessments.type.${AssessmentsForm.assessmentView.type}"/>
</td>
</tr>
 
</table>
<br>
<bean:message key="assessment.submit.schedule.targetStudents"/>
<hr>
<div id="contentIntranet">
<div id="contentPane">
<table class="dataTable">
<tr>
<th></th>
<th><bean:message key="number"/></th>
<th><bean:message key="name"/></th>
<th><bean:message key="user"/></th>
</tr>
<logic:iterate name="AssessmentsForm" property="possibleUsersResponse" id="userPossible">
<tr>
<td>
<html:multibox property="selectedUsers">
<nested:write name="userPossible" property="id"/>
</html:multibox>
</td>
<td>
${userPossible.code}
</td>
<td>
${userPossible.name}
</td>
<td>
${userPossible.username}
</td>
</tr>
</logic:iterate>
</table>
</div>
</div>
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'saveEditSchedule');this.form.submit();">
</html:form>
/impl/src/web/user/assessments/submitAssessmentResponse.jsp
New file
0,0 → 1,311
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
 
<jomm:messages/>
<html:errors/>
 
<html:form action="/user/submitAssessmentResponseFromHome" enctype="multipart/form-data">
<input type="hidden" name="dispatch">
<html:hidden name="AssessmentsForm" property="assessmentView.id"/>
<html:hidden name="AssessmentsForm" property="assessmentResponseView.id"/>
<input type="hidden" name="questionsListSize" value="<%=((AssessmentsForm)request.getAttribute("AssessmentsForm")).getAssessmentView().getQuestions().size()%>">
<% UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSession(request,response);
int questionListSizeInt = ((AssessmentsForm)request.getAttribute("AssessmentsForm")).getAssessmentView().getQuestions().size();
String questionListSize = String.valueOf(questionListSizeInt) ;
sess.put("questionsListSize", (java.io.Serializable) questionListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao = (List<String>) sess.get("nomesSessao");
if(nomesSessao==null)
{
nomesSessao = new ArrayList<String>();
}
nomesSessao.add("questionsListSize");
sess.put("nomesSessao", (java.io.Serializable) nomesSessao);
sess.serialize(request,response);
%>
 
<input type="hidden" name="horas" value="<%=AssessmentsForm.getAssessmentView().getTime().getHours()%>" id="horas"/>
<input type="hidden" name="minutos" value="<%=AssessmentsForm.getAssessmentView().getTime().getMinutes()%>" id="minutos"/>
 
<script language="Javascript">
var horasT = document.forms[0].horas.value;
var minutosT = document.forms[0].minutos.value;
var segundosT=0;
function showRemaining() {
segundosT--
if(segundosT<0)
{
minutosT--;
segundosT = 59;
if(minutosT<0)
{
horasT--;
minutosT=59;
if(horasT<0)
{
alert("O tempo da prova expirou!");
set(document.forms[0],'answer');
document.forms[0].submit();
}
}
}
document.getElementById('tempoFinal').innerHTML = horasT + ':';
document.getElementById('tempoFinal').innerHTML += minutosT + ':';
document.getElementById('tempoFinal').innerHTML += segundosT;
}
 
timer = setInterval(showRemaining, 1000);
 
</script>
<%--<div id="tempoFinal" align="right" style="font-size: 40px; font-weight:bold; position:fixed; left:85%;"></div>--%>
<%--O de cima fica flutuante com o scroll--%>
 
<div id="tempoFinal" align="right" style="font-size: 40px; font-weight:bold;"></div>
 
 
<table class="form">
<tr>
<th><bean:message key="assessment.answer.form.title"/></th>
<td>
<%--<html:hidden name="AssessmentsForm" property="assessmentView.title"/>--%>
<bean:write name="AssessmentsForm" property="assessmentView.title"/>
</td>
</tr>
<tr>
<th><bean:message key="assessment.answer.form.courseUnit"/></th>
<td>
<%--<html:hidden name="AssessmentsForm" property="assessmentView.courseUnit.name"/>--%>
<bean:write name="AssessmentsForm" property="assessmentView.courseUnit.name"/>
</td>
</tr>
<tr>
<th><bean:message key="assessment.answer.form.course"/></th>
<td>
<%--<html:hidden name="AssessmentsForm" property="assessmentView.courseUnit.courseName"/>--%>
<bean:write name="AssessmentsForm" property="assessmentView.courseUnit.courseName"/>
</td>
</tr>
<tr>
<th><bean:message key="assessment.answer.form.owner"/></th>
<td>
<%--<html:hidden name="AssessmentsForm" property="assessmentView.owner.name"/>--%>
<bean:write name="AssessmentsForm" property="assessmentView.owner.name"/>
<br><br>
</td>
</tr>
<tr>
<th></th>
<td colspan="2">
<nested:iterate id="questionView" name="AssessmentsForm" property="assessmentView.questions" indexId="qId">
<input type="hidden" name="itemsListSize${qId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().size()%>"/>
<input type="hidden" name="candidatesLabelsSize${qId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getPossibleLabels().size()%>"/>
<% int itemsListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().size();
String itemsListSize = String.valueOf(itemsListSizeInt) ;
sess.put("itemsListSize"+qId, (java.io.Serializable) itemsListSize);
sess.serialize(request,response);
//
int candidatesLabelsSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getPossibleLabels().size();
String candidatesLabelsSize = String.valueOf(candidatesLabelsSizeInt) ;
sess.put("candidatesLabelsSize"+qId, (java.io.Serializable) candidatesLabelsSize);
sess.serialize(request,response);
 
//adicionar a lista de nomes
List<String> nomesSessao2 = (List<String>) sess.get("nomesSessao");
nomesSessao2.add("itemsListSize"+qId);
nomesSessao2.add("candidatesLabelsSize"+qId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao2);
sess.serialize(request,response);
%>
<nested:hidden property="id"/>
 
<table id="questionTableAssessment">
<tr>
<td colspan="200" class="questionLabelCell">
<nested:hidden property="textpt"/>
<nested:hidden property="type"/>
<nested:write property="textpt"/>
<%--Parte da imagem, o <td> tem de ca ficar na mesma--%>
<nested:notEqual name="questionView" property="imageId" value="0">
<br><br>
<table cellpadding="0" cellspacing="0" border="0">
<tr> <td>
<img width="800px" height="800px" src="<%=request.getContextPath()%>/imageStream/${questionView.imageId}">
</td></tr>
</table>
</nested:notEqual>
</td>
</tr>
 
<nested:equal property="type" value="text">
<tr>
<td>
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<% int candidatesListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize = String.valueOf(candidatesListSizeInt) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao3 = (List<String>) sess.get("nomesSessao");
nomesSessao3.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao3);
sess.serialize(request,response);
%>
<nested:iterate property="possibleAnswers">
<nested:hidden property="id"/>
</nested:iterate>
<logic:iterate id="c" name="item" property="possibleAnswers">
<nested:textarea property="textareaValue" styleId="assessmentTextarea"/>
</logic:iterate>
</nested:iterate>
</td>
</tr>
</nested:equal>
 
<nested:equal property="type" value="practical">
<tr>
<td>
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<% int candidatesListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize = String.valueOf(candidatesListSizeInt) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao3 = (List<String>) sess.get("nomesSessao");
nomesSessao3.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao3);
sess.serialize(request,response);
%>
<nested:iterate property="possibleAnswers">
<nested:hidden property="id"/>
</nested:iterate>
<logic:iterate id="c" name="item" property="possibleAnswers">
<bean:message key="assessment.answer.form.uploadFile"/>
<nested:file property="uploadFile"/>
</logic:iterate>
</nested:iterate>
</td>
</tr>
</nested:equal>
 
<nested:equal property="type" value="radio">
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<% int candidatesListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize = String.valueOf(candidatesListSizeInt) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao3 = (List<String>) sess.get("nomesSessao");
nomesSessao3.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao3);
sess.serialize(request,response);
%>
<nested:iterate property="possibleAnswers">
<nested:hidden property="id"/>
<nested:hidden property="textpt"/>
</nested:iterate>
<logic:iterate id="c" name="item" property="possibleAnswers">
<tr>
<td>
<nested:radio property="radioValue" value="${c.id}"/>
<nested:write name="c" property="textpt"/>
</td>
</tr>
</logic:iterate>
</nested:iterate>
</nested:equal>
 
<nested:equal property="type" value="check">
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<% int candidatesListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize = String.valueOf(candidatesListSizeInt) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao3 = (List<String>) sess.get("nomesSessao");
nomesSessao3.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao3);
sess.serialize(request,response);
%>
<nested:iterate property="possibleAnswers">
<tr>
<td>
<nested:hidden property="id"/>
<nested:hidden property="textpt"/>
<nested:checkbox property="checkbox"/>
<nested:write property="textpt"/>
</td>
</tr>
</nested:iterate>
</nested:iterate>
</nested:equal>
 
<nested:equal property="type" value="matrix">
<tr>
<td></td>
<nested:iterate property="possibleLabels">
<td class="candidateCell">
<nested:hidden property="textpt"/>
<nested:write property="textpt"/>
</td>
</nested:iterate>
</tr>
<input type="hidden" name="teste_row_hidden"/>
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<% int candidatesListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize = String.valueOf(candidatesListSizeInt) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao3 = (List<String>) sess.get("nomesSessao");
nomesSessao3.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao3);
sess.serialize(request,response);
%>
<nested:iterate property="possibleAnswers">
<nested:hidden property="id"/>
<nested:hidden property="textpt"/>
</nested:iterate>
<tr onmouseover="this.style.backgroundColor='#aFaFaF'" onmouseout="this.style.backgroundColor='#F7F7F7'">
<td>
<nested:hidden property="textpt"/>
<nested:write property="textpt"/>
</td>
<logic:iterate id="c" name="item" property="possibleAnswers">
<td class="candidateCell">
<nested:radio property="radioValue" value="${c.id}"/>
</td>
</logic:iterate>
</tr>
</nested:iterate>
</nested:equal>
</table>
<br><br>
</nested:iterate>
</td>
</tr>
</table>
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'answer');this.form.submit();">
</html:form>
/impl/src/web/user/assessments/submitAssessment.jsp
New file
0,0 → 1,412
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jomm:messages/>
<html:errors/>
<%
String fromAction = "";
String from = "";
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
%>
<html:form action="${user}/submitAssessment${fromAction}${from}" enctype="multipart/form-data" >
<html:hidden property="assessmentView.id"/>
<html:hidden property="assessmentView.deletedQuestions"/>
<html:hidden property="assessmentView.deletedItems"/>
<html:hidden property="assessmentView.deletedCandidates"/>
<html:hidden property="counter"/>
<%--<html:hidden property="bigImageStr"/>--%>
<input type="hidden" name="dispatch">
<input type="hidden" name="questionId"/>
<input type="hidden" name="itemId"/>
<input type="hidden" name="candidateId"/>
 
<table class="form">
<tr>
<th>
<bean:message key="assessment.submit.form.title"/>
*
</th>
<td>
<html:text property="assessmentView.title"/>
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.submit.form.type"/>
</th>
<td>
<logic:greaterThan name="AssessmentsForm" property="assessmentView.id" value="0">
<html:hidden property="assessmentView.type"/>
<bean:message key="assessments.type.${AssessmentsForm.assessmentView.type}"/>
</logic:greaterThan>
 
<logic:lessEqual name="AssessmentsForm" property="assessmentView.id" value="0">
<html:select property="assessmentView.type" onchange="set(this.form,'changeAssessmentType');this.form.submit();">
<logic:present name="AssessmentsForm" property="assessmentTypes">
<logic:iterate id="type" name="AssessmentsForm" property="assessmentTypes">
<html:option value="${type}">
<bean:message key="assessments.type.${type}"/>
</html:option>
</logic:iterate>
</logic:present>
</html:select>
</logic:lessEqual>
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.submit.form.evaluationtime"/>
</th>
<td>
<html:select property="assessmentView.evaluationTime">
<logic:present name="AssessmentsForm" property="assessmentEvaluationTime">
<logic:iterate id="type" name="AssessmentsForm" property="assessmentEvaluationTime">
<html:option value="${type}">
<bean:message key="assessments.evaluation.time.${type}"/>
</html:option>
</logic:iterate>
</logic:present>
</html:select>
</td>
</tr>
 
<tr>
<th>
<bean:message key="assessment.submit.form.courseUnit"/>
</th>
<td>
<%if(pt.estgp.estgweb.utils.DatesUtils.getSemestre().equals("S1")) { %>
 
<html:select property="courseUnitId">
<logic:iterate id="unit" name="UserSession" property="user.teachedUnitsCurrentYearViewS1" type="pt.estgp.estgweb.domain.CourseUnit">
<html:option value="${unit.id}">
${unit.name}
</html:option>
</logic:iterate>
</html:select>
<% } else{%>
<html:select property="courseUnitId">
<logic:iterate id="unit" name="UserSession" property="user.teachedUnitsCurrentYearViewS2" type="pt.estgp.estgweb.domain.CourseUnit">
<html:option value="${unit.id}">
${unit.name}
</html:option>
</logic:iterate>
</html:select>
<% } %>
</td>
</tr>
 
 
</table>
 
<br>
<bean:message key="assessment.submit.form.questions"/>
 
<hr>
<input type="hidden" name="questionsListSize" value="<%=((AssessmentsForm)request.getAttribute("AssessmentsForm")).getAssessmentView().getQuestions().size()%>">
<% UserSessionImpl sess = (UserSessionImpl) UserSessionProxy.loadUserSession(request,response);
int questionListSizeInt = ((AssessmentsForm)request.getAttribute("AssessmentsForm")).getAssessmentView().getQuestions().size();
String questionListSize = String.valueOf(questionListSizeInt) ;
sess.put("questionsListSize", (java.io.Serializable) questionListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao = (List<String>) sess.get("nomesSessao");
if(nomesSessao==null)
{
nomesSessao = new ArrayList<String>();
}
nomesSessao.add("questionsListSize");
sess.put("nomesSessao", (java.io.Serializable) nomesSessao);
sess.serialize(request,response);
%>
<nested:iterate id="questionView" name="AssessmentsForm" property="assessmentView.questions" indexId="qId">
<table class="form">
<input type="hidden" name="itemsListSize${qId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().size()%>"/>
<input type="hidden" name="candidatesLabelsSize${qId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getPossibleLabels().size()%>"/>
<% int itemsListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().size();
String itemsListSize = String.valueOf(itemsListSizeInt) ;
sess.put("itemsListSize"+qId, (java.io.Serializable) itemsListSize);
sess.serialize(request,response);
//
int candidatesLabelsSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getPossibleLabels().size();
String candidatesLabelsSize = String.valueOf(candidatesLabelsSizeInt) ;
sess.put("candidatesLabelsSize"+qId, (java.io.Serializable) candidatesLabelsSize);
sess.serialize(request,response);
 
//adicionar a lista de nomes
List<String> nomesSessao2 = (List<String>) sess.get("nomesSessao");
nomesSessao2.add("itemsListSize"+qId);
nomesSessao2.add("candidatesLabelsSize"+qId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao2);
sess.serialize(request,response);
%>
<nested:hidden property="id"/>
<nested:hidden property="type"/>
<tr>
<th>
<a name="question${qId}"></a>
<a name="question${questionView.id}"></a>
<bean:message key="assessment.submit.form.delete.question"/>
</th>
<td>
<input type="button" class="removeButton" value=""
onclick="AssessmentsForm.questionId.value='${qId}';confirmAction('Tem a certeza que deseja apagar?',this.form,'removeQuestion');"/>
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.submit.form.quotation.question"/>
</th>
<td>
<nested:text property="quotation"/>
</td>
</tr>
 
<tr>
<th>
<bean:message key="assessment.submit.form.question.image"/>
</th>
<td>
<logic:equal name="questionView" property="imageId" value="0">
<%--<input class="file" id="bigImageIdT" name="bigImageT" type="file" value=""/>--%>
<nested:file property="bigImage"/>
<%--<nested:file styleClass="file" styleId="bigImageIdT" property="bigImageT" value="teste"/>--%>
 
<bean:message key="announcement.image.max"/>
<%=Globals.MAX_BIGMAGE_FILE_SIZE_KBYTES + "kb"%>
</logic:equal>
<logic:notEqual name="questionView" property="imageId" value="0">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<nested:file property="bigImage"/>
<bean:message key="announcement.image.max"/>
<%=Globals.MAX_BIGMAGE_FILE_SIZE_KBYTES + "kb"%>
</td>
<td>
<img width="100px" src="<%=request.getContextPath()%>/imageStream/${questionView.imageId}">
</td>
</tr>
</table>
</logic:notEqual>
</td>
</tr>
 
<tr>
<th>
<bean:message key="assessment.submit.form.question"/>
</th>
<td>
<%--<nested:text property="textpt"/>--%>
<nested:textarea property="textpt" styleId="surveyTextarea"/>
</td>
</tr>
<nested:equal name="questionView" value="matrix" property="type">
<tr>
<th></th>
<td>
<table>
<tr>
<td></td>
<nested:iterate property="possibleLabels" indexId="cId">
<td>
<nested:text property="textpt" styleId="inputVertical"/>
<input type="button" class="removeButton" value=""
onclick="AssessmentsForm.questionId.value='${qId}';
AssessmentsForm.candidateId.value='${cId}';
set(this.form,'removeCandidateOption');
AssessmentsForm.action = AssessmentsForm.action+'#question${qId}';
this.form.submit();"/>
</td>
</nested:iterate>
</tr>
<nested:iterate property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<% int candidatesListSizeInt = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize = String.valueOf(candidatesListSizeInt) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao3 = (List<String>) sess.get("nomesSessao");
nomesSessao3.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao3);
sess.serialize(request,response);
%>
 
<tr>
<td>
<nested:hidden property="id"/>
<nested:text property="textpt" styleId="inputHorizontal"/>
<input type="button" class="removeButton" value=""
onclick="AssessmentsForm.questionId.value='${qId}';
AssessmentsForm.itemId.value='${iId}';
set(this.form,'removeItemOption');
AssessmentsForm.action = AssessmentsForm.action+'#question${qId}';
this.form.submit();"/>
</td>
<nested:iterate property="possibleAnswers" indexId="cId">
<td align="left">
<nested:hidden property="id"/>
<img border="0" src="<%=request.getContextPath()%>/imgs/radiobox.png"/>
 
<nested:radio property="correct" value="true" onchange="AssessmentsForm.questionId.value='${qId}';AssessmentsForm.itemId.value='${iId}';AssessmentsForm.candidateId.value='${cId}';set(this.form,'updateRadioBox');this.form.submit();"/>
<bean:message key="assessment.submit.form.question.correct"/>
</td>
</nested:iterate>
</tr>
</nested:iterate>
</table>
</td>
</tr>
<tr>
<th></th>
<td>
<input type="button" value="<bean:message key="assessment.submit.form.add.hoption"/>"
onclick="AssessmentsForm.questionId.value='${qId}';
set(this.form,'addItemOption');
AssessmentsForm.action = AssessmentsForm.action+'#question${qId}';
this.form.submit();">
<input type="button" value="<bean:message key="assessment.submit.form.add.voption"/>"
onclick="AssessmentsForm.questionId.value='${qId}';
set(this.form,'addCandidateOption');
AssessmentsForm.action = AssessmentsForm.action+'#question${qId}';
this.form.submit();">
</td>
</tr>
</nested:equal>
 
<nested:notEqual name="questionView" value="matrix" property="type">
<nested:iterate property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<%
int candidatesListSizeInt2 = AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size();
String candidatesListSize2 = String.valueOf(candidatesListSizeInt2) ;
sess.put("candidatesListSize"+qId+iId, (java.io.Serializable) candidatesListSize2);
sess.serialize(request,response);
//adicionar a lista de nomes
List<String> nomesSessao4 = (List<String>) sess.get("nomesSessao");
//if(nomesSessao3.contains(""))
nomesSessao4.add("candidatesListSize"+qId+iId);
sess.put("nomesSessao", (java.io.Serializable) nomesSessao4);
sess.serialize(request,response);
%>
<nested:hidden property="id"/>
<nested:iterate property="possibleAnswers" indexId="cId">
<nested:hidden property="id"/>
<nested:notEqual name="questionView" value="text" property="type">
<nested:notEqual name="questionView" value="practical" property="type">
 
<tr>
<th align="right">
<nested:equal name="questionView" value="radio" property="type">
<img border="0" src="<%=request.getContextPath()%>/imgs/radiobox.png"/>
</nested:equal>
<nested:equal name="questionView" value="check" property="type">
<img border="0" src="<%=request.getContextPath()%>/imgs/checkbox.png"/>
</nested:equal>
</th>
<td>
<nested:text property="textpt" styleId="inputHorizontal"/>
<input type="button" class="removeButton" value=""
onclick="AssessmentsForm.questionId.value='${qId}';
AssessmentsForm.candidateId.value='${cId}';
set(this.form,'removeCandidateOption');
AssessmentsForm.action = AssessmentsForm.action+'#question${qId}';
this.form.submit();"/>
 
<nested:equal name="questionView" value="radio" property="type">
<nested:radio property="correct" value="true" onchange="AssessmentsForm.questionId.value='${qId}';AssessmentsForm.candidateId.value='${cId}';set(this.form,'updateRadioBox');this.form.submit();"/>
</nested:equal>
<nested:equal name="questionView" value="check" property="type">
<nested:checkbox property="correct"/>
</nested:equal>
<bean:message key="assessment.submit.form.question.correct"/>
</td>
</tr>
</nested:notEqual>
</nested:notEqual>
</nested:iterate>
</nested:iterate>
 
<nested:notEqual name="questionView" value="text" property="type">
<nested:notEqual name="questionView" value="practical" property="type">
<tr>
<th></th>
<td>
<input type="button" value="<bean:message key="assessment.submit.form.add.hoption"/>"
onclick="AssessmentsForm.questionId.value='${qId}';
set(this.form,'addCandidateOption');
AssessmentsForm.action = AssessmentsForm.action+'#question${qId}';
this.form.submit();">
</td>
</tr>
</nested:notEqual>
</nested:notEqual>
</nested:notEqual>
</table>
</nested:iterate>
 
<br>
<br>
 
<bean:message key="assessment.submit.form.add.question"/>
 
<logic:equal value="self-evaluation" property="assessmentView.type" name="AssessmentsForm">
<html:select property="questionType">
<logic:present name="AssessmentsForm" property="assessmentQuestionTypesSelfEvaluation">
<logic:iterate id="item" name="AssessmentsForm" property="assessmentQuestionTypesSelfEvaluation">
<html:option value="${item}">
<bean:message key="assessments.question.type.${item}"/>
</html:option>
</logic:iterate>
</logic:present>
</html:select>
</logic:equal>
<logic:equal value="evaluation" property="assessmentView.type" name="AssessmentsForm">
<html:select property="questionType">
<logic:present name="AssessmentsForm" property="assessmentQuestionTypes">
<logic:iterate id="item" name="AssessmentsForm" property="assessmentQuestionTypes">
<html:option value="${item}">
<bean:message key="assessments.question.type.${item}"/>
</html:option>
</logic:iterate>
</logic:present>
</html:select>
</logic:equal>
 
<input type="button" value="<bean:message key="add"/>"
onclick="set(this.form,'addQuestion');
AssessmentsForm.action = AssessmentsForm.action+'#question<%=AssessmentsForm.getCounter()%>';
this.form.submit();">
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'save');this.form.submit();">
</html:form>
/impl/src/web/user/assessments/switchCorrectAssessment.jsp
New file
0,0 → 1,89
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jomm:messages/>
<html:errors/>
 
<%
String fromAction = "";
String from = "";
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
%>
<html:form action="${user}/submitConfigureCorrectAssessment${fromAction}${from}">
<html:hidden property="assessmentView.id"/>
<input type="hidden" name="dispatch">
 
<table class="form">
<tr>
<th>
<bean:message key="assessment.submit.form.title"/>
</th>
<td>
<nested:write name="AssessmentsForm" property="assessmentView.title"/>
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.correction.form.number.responses"/>
</th>
<td>
<bean:write name="AssessmentsForm" property="assessmentView.numberOfResponses"/>/<bean:write name="AssessmentsForm" property="assessmentView.numberTotalOfResponses"/>
</td>
</tr>
<tr>
<th>
<bean:message key="assessments.evaluate.choices"/>
</th>
<td>
<html:select property="correctionAnonymous">
<logic:present name="AssessmentsForm" property="assessmentCorrectAnonymous">
<logic:iterate id="type" name="AssessmentsForm" property="assessmentCorrectAnonymous">
<html:option value="${type}">
<bean:message key="assessments.correctA.${type}"/>
</html:option>
</logic:iterate>
</logic:present>
</html:select>
</td>
<td>
<html:select property="correctionSelection">
<logic:present name="AssessmentsForm" property="assessmentCorrectSelection">
<logic:iterate id="type" name="AssessmentsForm" property="assessmentCorrectSelection">
<html:option value="${type}">
<bean:message key="assessments.correction.selection.${type}"/>
</html:option>
</logic:iterate>
</logic:present>
</html:select>
</td>
</tr>
</table>
<br>
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'confirmChoicesCorrect');this.form.submit();">
</html:form>
/impl/src/web/user/assessments/submitCorrectAssessmentResponse.jsp
New file
0,0 → 1,145
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
 
<jomm:messages/>
<html:errors/>
 
<html:form action="/user/submitCorrectAssessmentResponseFromServiceZone">
<input type="hidden" name="dispatch">
<html:hidden name="AssessmentsForm" property="assessmentView.id"/>
<html:hidden name="AssessmentsForm" property="assessmentResponseView.id"/>
<html:hidden property="correctionSelection"/>
<html:hidden property="correctionAnonymous"/>
 
<table class="form">
 
<nested:equal property="correctionAnonymous" value="notAnonymous">
<tr>
<th><bean:message key="assessment.correctTo"/></th>
<td>
<bean:write name="AssessmentsForm" property="assessmentResponseView.owner.name"/>
(<bean:write name="AssessmentsForm" property="assessmentResponseView.owner.code"/>)
<br><br>
</td>
</tr>
</nested:equal>
 
<tr>
<th></th>
<td colspan="2">
<input type="hidden" name="questionsListSizeC" value="<%=((AssessmentsForm)request.getAttribute("AssessmentsForm")).getAssessmentView().getQuestions().size()%>">
<nested:iterate id="questionView" name="AssessmentsForm" property="assessmentView.questions" indexId="qId">
<input type="hidden" name="itemsListSizeC${qId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().size()%>"/>
 
<nested:hidden property="id"/>
 
<table id="questionTableAssessment">
<tr>
<td colspan="200" class="questionLabelCell">
<nested:hidden property="textpt"/>
<nested:hidden property="type"/>
<nested:write property="textpt"/> (<nested:write property="quotation"/>)
<%--Parte da imagem, o <td> tem de ca ficar na mesma--%>
<nested:notEqual name="questionView" property="imageId" value="0">
<br><br>
<table cellpadding="0" cellspacing="0" border="0">
<tr> <td>
<img width="800px" height="800px" src="<%=request.getContextPath()%>/imageStream/${questionView.imageId}">
</td></tr>
</table>
</nested:notEqual>
</td>
</tr>
 
<nested:equal property="type" value="text">
<tr>
<td>
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSizeC${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<nested:iterate id="possibleAnswerI" property="possibleAnswers" indexId="pAId">
<input type="hidden" name="answersListSizeC" value="<%=AssessmentsForm.getAssessmentResponseView().getAnswers().size()%>"/>
<nested:iterate id="answer" property="assessmentResponseView.answers" name="AssessmentsForm" indexId="aId">
<nested:equal property="possibleAnswer.id" value="${possibleAnswerI.id}">
<nested:hidden property="id"/>
<nested:textarea property="textAnswer" styleId="assessmentTextarea"/>
<tr>
<td>
<nested:radio property="answerCorrectS" value="correct"/><bean:message key="assessment.answer.correct"/>
<nested:radio property="answerCorrectS" value="incorrect"/><bean:message key="assessment.answer.incorrect"/>
<nested:radio property="answerCorrectS" value="incomplete"/><bean:message key="assessment.answer.imcomplete"/>
<%--<nested:equal property="answerIncomplete" value="true">--%>
<nested:textarea property="percentage" styleId="assessmentQuestionPercentage"/>
<%--</nested:equal>--%>
</td>
</tr>
<tr>
<td><bean:message key="assessment.asnwer.note"/><nested:text property="note"/></td>
</tr>
</nested:equal>
</nested:iterate>
</nested:iterate>
</nested:iterate>
</td>
</tr>
</nested:equal>
 
<nested:equal property="type" value="practical">
<tr>
<td>
<nested:iterate id="item" property="questionItems" indexId="iId">
<input type="hidden" name="candidatesListSizeC${qId}${iId}" value="<%=AssessmentsForm.getAssessmentView().getQuestions().get(qId).getQuestionItems().get(iId).getPossibleAnswers().size()%>"/>
<nested:iterate id="possibleAnswerI" property="possibleAnswers" indexId="pAId">
<input type="hidden" name="answersListSizeC" value="<%=AssessmentsForm.getAssessmentResponseView().getAnswers().size()%>"/>
<nested:iterate id="answer" property="assessmentResponseView.answers" name="AssessmentsForm" indexId="aId">
<nested:equal property="possibleAnswer.id" value="${possibleAnswerI.id}">
<nested:hidden property="id"/>
<%--LOGO VEJO SE PRECISO DISTO<nested:hidden property="possibleAnswer.id"/>--%>
<nested:notEqual property="identifier" value="">
<nested:hidden property="identifier"/>
<a target="_blank" href="<%=request.getContextPath()%>/repositoryStream/${answer.identifier}">Ficheiro Entregue</a>
</nested:notEqual>
<tr>
<td>
<nested:radio property="answerCorrectS" value="correct"/><bean:message key="assessment.answer.correct"/>
<nested:radio property="answerCorrectS" value="incorrect"/><bean:message key="assessment.answer.incorrect"/>
<nested:radio property="answerCorrectS" value="incomplete"/><bean:message key="assessment.answer.imcomplete"/>
<nested:textarea property="percentage" styleId="assessmentQuestionPercentage"/>
</td>
</tr>
<tr>
<td><bean:message key="assessment.asnwer.note"/><nested:text property="note"/></td>
</tr>
</nested:equal>
</nested:iterate>
 
</nested:iterate>
</nested:iterate>
</td>
</tr>
</nested:equal>
</table>
<br><br>
</nested:iterate>
</td>
</tr>
</table>
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'submitCorrectResponse');this.form.submit();">
</html:form>
/impl/src/web/user/assessments/listQuestionsOrResponsesToCorrect.jsp
New file
0,0 → 1,88
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jomm:messages/>
<html:errors/>
<%
String fromAction = "";
String from = "";
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
%>
<%--<html:form action="${user}/chooseQuestionOrAssessmentToCorrect${fromAction}${from}">--%>
<html:form action="user/chooseQuestionOrAssessmentToCorrectFromServiceZone">
<nested:hidden property="correctionSelection"/>
<nested:hidden property="correctionAnonymous"/>
<input type="hidden" name="dispatch">
 
<logic:equal name="AssessmentsForm" property="correctionSelection" value="assessment">
<% if(AssessmentsForm.getAssessmentResponsesView().size() > 0){ %>
<nested:iterate id="responseView" name="AssessmentsForm" property="assessmentResponsesView">
<table class="form">
<tr>
<td>
<html:link action="/user/startSubmitCorrectAssessmentResponseFromServiceZone.do?respId=${responseView.id}"><bean:message key="assessment.correctTo"/>
<logic:equal name="AssessmentsForm" property="correctionAnonymous" value="notAnonymous">
<nested:write name="responseView" property="owner.name"/>
(<nested:write name="responseView" property="owner.code"/>)
</logic:equal>
<logic:equal name="AssessmentsForm" property="correctionAnonymous" value="anonymous">
<bean:message key="assessment.correctTo.anonymous"/>
</logic:equal>
</html:link>
<br>
</td>
</tr>
 
</table>
</nested:iterate>
<% } else { %>
<bean:message key="assessment.responses.empty"/>
<% } %>
</logic:equal>
 
<logic:equal name="AssessmentsForm" property="correctionSelection" value="question">
<% if(AssessmentsForm.getAssessmentQuestionsRView().size() > 0){ %>
<nested:iterate id="questionView" name="AssessmentsForm" property="assessmentQuestionsRView">
<table class="form">
<tr>
<td>
<div style="font-weight:bold;"><bean:message key="assessment.correctTo.question"/></div>
<html:link action="/user/startSubmitCorrectQuestionResponsesFromServiceZone.do?questId=${questionView.id}">
<nested:write name="questionView" property="textpt"/>
</html:link>
(Respostas: <nested:write name="questionView" property="numberOfResponses"/>)
<br>
</td>
</tr>
 
</table>
</nested:iterate>
<% } else { %>
<bean:message key="assessment.answers.empty"/>
<% } %>
</logic:equal>
 
</html:form>
/impl/src/web/user/assessments/submitCorrectQuestionResponses.jsp
New file
0,0 → 1,136
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
 
<jomm:messages/>
<html:errors/>
 
<html:form action="/user/submitCorrectQuestionResponsesFromServiceZone">
<input type="hidden" name="dispatch">
<html:hidden name="AssessmentsForm" property="assessmentView.id"/>
<html:hidden name="AssessmentsForm" property="assessmentResponseView.id"/>
<html:hidden property="correctionSelection"/>
<html:hidden property="correctionAnonymous"/>
 
<table class="form">
<input type="hidden" name="questionsListSizeCQuestion" value="<%=((AssessmentsForm)request.getAttribute("AssessmentsForm")).getAssessmentQuestionsRView().size()%>">
<nested:iterate id="questionView" name="AssessmentsForm" property="assessmentQuestionsRView">
<table id="questionTableAssessment">
<tr>
<td colspan="200" class="questionLabelCell">
<bean:message key="assessment.answer.question"/> <nested:write property="textpt"/>(<nested:write property="quotation"/>)
<%--Parte da imagem, o <td> tem de ca ficar na mesma--%>
<nested:notEqual name="questionView" property="imageId" value="0">
<br><br>
<table cellpadding="0" cellspacing="0" border="0">
<tr> <td>
<img width="800px" height="800px" src="<%=request.getContextPath()%>/imageStream/${questionView.imageId}">
</td></tr>
</table>
</nested:notEqual>
</td>
</tr>
</table>
<br><br>
 
<tr>
<th></th>
<td colspan="2">
<input type="hidden" name="answersListSizeCQuestion" value="<%=AssessmentsForm.getAssessmentQuestionAnswers().size()%>"/>
<nested:iterate id="answerView" name="AssessmentsForm" property="assessmentQuestionAnswers" indexId="aId">
<nested:hidden property="id"/>
<table id="questionTableAssessment">
<nested:equal name="questionView" property="type" value="text">
<tr>
<td>
<bean:message key="assessment.answer.owner"/>
<logic:equal name="AssessmentsForm" property="correctionAnonymous" value="notAnonymous">
<nested:write property="response.owner.name"/>
(<nested:write property="response.owner.code"/>)
</logic:equal>
<logic:equal name="AssessmentsForm" property="correctionAnonymous" value="anonymous">
<bean:message key="assessment.answer.owner.anonymous"/>
</logic:equal>
</td>
<tr>
<td>
<nested:hidden property="id"/>
<nested:textarea property="textAnswer" styleId="assessmentTextarea"/>
<tr>
<td>
<nested:radio property="answerCorrectS" value="correct"/><bean:message key="assessment.answer.correct"/>
<nested:radio property="answerCorrectS" value="incorrect"/><bean:message key="assessment.answer.incorrect"/>
<nested:radio property="answerCorrectS" value="incomplete"/><bean:message key="assessment.answer.imcomplete"/>
<%--<nested:equal property="answerIncomplete" value="true">--%>
<nested:textarea property="percentage" styleId="assessmentQuestionPercentage"/>
<%--</nested:equal>--%>
</td>
</tr>
<tr>
<td><bean:message key="assessment.asnwer.note"/><nested:text property="note"/></td>
</tr>
 
</td>
</tr>
</tr>
</nested:equal>
 
<nested:equal name="questionView" property="type" value="practical">
<tr>
<td>
<bean:message key="assessment.answer.owner"/>
<logic:equal name="AssessmentsForm" property="correctionAnonymous" value="notAnonymous">
<nested:write property="response.owner.name"/>
(<nested:write property="response.owner.code"/>)
</logic:equal>
<logic:equal name="AssessmentsForm" property="correctionAnonymous" value="anonymous">
<bean:message key="assessment.answer.owner.anonymous"/>
</logic:equal>
</td>
<tr>
<td>
<nested:hidden property="id"/>
<nested:notEqual property="identifier" value="">
<nested:hidden property="identifier"/>
<a target="_blank" href="<%=request.getContextPath()%>/repositoryStream/${answerView.identifier}">Ficheiro Entregue</a>
</nested:notEqual>
<tr>
<td>
<nested:radio property="answerCorrectS" value="correct"/><bean:message key="assessment.answer.correct"/>
<nested:radio property="answerCorrectS" value="incorrect"/><bean:message key="assessment.answer.incorrect"/>
<nested:radio property="answerCorrectS" value="incomplete"/><bean:message key="assessment.answer.imcomplete"/>
<nested:textarea property="percentage" styleId="assessmentQuestionPercentage"/>
</td>
</tr>
<tr>
<td><bean:message key="assessment.asnwer.note"/><nested:text property="note"/></td>
</tr>
</td>
</tr>
</tr>
</nested:equal>
</table>
<br><br>
</nested:iterate>
</td>
</tr>
</nested:iterate>
</table>
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'submitCorrectQuestionResponses');this.form.submit();">
</html:form>
/impl/src/web/user/assessments/scheduleAssessment.jsp
New file
0,0 → 1,150
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
 
<jsp:useBean id="AssessmentsForm" type="pt.estgp.estgweb.web.form.assessments.AssessmentsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jomm:messages/>
<html:errors/>
 
<%
String fromAction = "";
String from = "";
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
%>
<html:form action="${user}/scheduleAssessment${fromAction}${from}">
<html:hidden property="assessmentView.id"/>
<html:hidden property="assessmentView.type"/>
<input type="hidden" name="dispatch">
 
<table class="form">
<tr>
<th>
<bean:message key="assessment.submit.form.title"/>
</th>
<td>
<nested:write name="AssessmentsForm" property="assessmentView.title"/>
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.submit.form.type"/>
</th>
<td>
<bean:message key="assessments.type.${AssessmentsForm.assessmentView.type}"/>
</td>
</tr>
 
<logic:equal name="AssessmentsForm" property="assessmentView.type" value="self-evaluation">
<tr>
<th>
<bean:message key="assessment.submit.schedule.start.date"/>
*
</th>
<td>
<a href="javascript:cal.select(getObjectById('startDate'),'anchord1','yyyy/MM/dd')" name="anchor1" id="anchord1"><html:text styleClass="date" property="startDate" styleId="startDate" readonly="true"/></a>
<input type="button" class="removeButton" onClick="AssessmentsForm.startDate.value=null;">
</td>
</tr>
<tr>
<th>
<bean:message key="assessment.submit.schedule.end.date"/>
*
</th>
<td>
<a href="javascript:cal.select(getObjectById('endDate'),'anchord2','yyyy/MM/dd')" name="anchor2" id="anchord2"><html:text styleClass="date" property="endDate" styleId="endDate" readonly="true"/></a>
<input type="button" class="removeButton" onClick="AssessmentsForm.endDate.value=null;">
</td>
</tr>
</logic:equal>
<logic:equal name="AssessmentsForm" property="assessmentView.type" value="evaluation">
<tr>
<th>
<bean:message key="assessment.submit.schedule.assessment.date"/>
*
</th>
<td>
<a href="javascript:cal.select(getObjectById('startDate'),'anchord1','yyyy/MM/dd')" name="anchor1" id="anchord1"><html:text styleClass="date" property="startDate" styleId="startDate" readonly="true"/></a>
<input type="button" class="removeButton" onClick="AssessmentsForm.startDate.value=null;">
</td>
</tr>
</logic:equal>
 
<tr>
<th>
<bean:message key="assessment.submit.schedule.time"/>
*
</th>
<td>
<html:text property="time"/>
</td>
</tr>
 
<tr>
<th>
<bean:message key="assessment.submit.schedule.extraTime"/>
</th>
<td>
<html:text property="timeExtra"/>
</td>
</tr>
 
</table>
<br>
<bean:message key="assessment.submit.schedule.targetStudents"/>
<hr>
<div id="contentIntranet">
<div id="contentPane">
<table class="dataTable">
<tr>
<th></th>
<th><bean:message key="number"/></th>
<th><bean:message key="name"/></th>
<th><bean:message key="user"/></th>
</tr>
<logic:iterate name="AssessmentsForm" property="possibleUsersResponse" id="userPossible">
<tr>
<td>
<html:multibox property="selectedUsers">
<nested:write name="userPossible" property="id"/>
</html:multibox>
</td>
<td>
${userPossible.code}
</td>
<td>
${userPossible.name}
</td>
<td>
${userPossible.username}
</td>
</tr>
</logic:iterate>
</table>
</div>
</div>
 
<hr>
<input type="button" value="<bean:message key="confirm"/>"
onclick="set(this.form,'saveSchedule');this.form.submit();">
</html:form>
/impl/src/web/user/home/todos.jsp
67,7 → 67,17
imgOpen = "/imgs/openedboxNeg.gif";
 
}
//Filipe Matos
else
if(toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Assessments.getMessageKey())){
 
styleClass = "WARNING";
img = "/imgs/openedboxNeg.gif";
style = "";
imgClose = "/imgs/closedboxNeg.gif";
imgOpen = "/imgs/openedboxNeg.gif";
}
else
if (toDoCat.getDescription().equals(ModuleEnum.Reminders.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.CourseUnits.getMessageKey()))
{
styleClass = "";
/impl/src/web/user/home/topnavResponseAssessment.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startHome.do", "intranet.separator.home.back");
topNav.addNavPlace(null, "assessment.topnav.response.assessment");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavCorrectAssessmentQuestionResponses.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.correct.assessment.questions.responses");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavScheduleAssessment.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.schedule.assessment");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavEditScheduleAssessment.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.edit.schedule.assessment");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavCreateAssessment.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.create.assessment");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/serviceZone.jsp
73,6 → 73,44
<bean:message key="intranet.services"/>
</div>
<ul>
 
 
<!-- Filipe Matos -->
<baco:isModuleOn module="assessments">
<baco:hasRole role="teacher">
<baco:hasRole role="assessementsTester">
 
<li>
<bean:message key="assessments"/>
<ul>
<li>
<html:link action="/user/startSubmitAssessmentFromServiceZone">
<bean:message key="assessment.create.assessment"/>
</html:link>
</li>
<li>
<html:link action="/user/startListAssessmentsFromServiceZone">
<bean:message key="assessment.list.assessments"/>
</html:link>
</li>
</ul>
</li>
</baco:hasRole>
</baco:hasRole>
<baco:hasRole role="student">
<li>
<bean:message key="assessments"/>
<ul>
<li>
<html:link action="/user/startListAssessmentsFromServiceZone">
<bean:message key="assessment.list.assessments"/>
</html:link>
</li>
</ul>
</li>
</baco:hasRole>
</baco:isModuleOn>
<!---->
<baco:isModuleOn module="announcements">
<li>
<html:link action="/user/startSubmitAnnouncementFromServiceZone">
/impl/src/web/user/serviceZone/topnavConfigureCorrectAssessment.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.configure.correct");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavAssessmentToCorrect.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.to.correct");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavListAssessment.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.list.assessments");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavCorrectAssessmentResponse.jsp
New file
0,0 → 1,10
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="jomm.web.utils.NavPlaceServer"%>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "assessment.topnav.correct.assessment.response");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/libs.xml
64,5 → 64,8
<fileset dir="${common.lib.dir}/fop">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${common.lib.dir}/itextpdf">
<include name="**/*.jar"/>
</fileset>
</path>
</project>
/impl/build.xml
253,6 → 253,9
<fileset dir="${common.lib.dir}/fop">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${common.lib.dir}/itextpdf">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy file="${dist.dir}/estgweb.jar" todir="${build.dir.war}/WEB-INF/lib"/>
<copy todir="${build.dir.war}/WEB-INF" overwrite="true">
/common/itextpdf/itext-pdfa-5.4.3.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itext-pdfa-5.4.3-sources.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itextpdf-5.4.3.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itextpdf-5.4.3-sources.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itext-xtra-5.4.3.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itext-pdfa-5.4.3-javadoc.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itext-xtra-5.4.3-sources.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itextpdf-5.4.3-javadoc.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/common/itextpdf/itext-xtra-5.4.3-javadoc.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream