Subversion Repositories bacoAlunos

Rev

Rev 1306 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ 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 if(pt.estgp.estgweb.utils.DatesUtils.getSemestre().equals("S2")) {%>
                <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>
            <% } %>

            <% //TODO FALTA AQUI OS TRIMESTRES S1 S2 T1 T2 T3 T4%>
        </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>

Generated by GNU Enscript 1.6.5.2.