Subversion Repositories bacoAlunos

Rev

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

<%@ page import="pt.estgp.estgweb.domain.views.CourseView" %>
<%@ 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.List" %>
<%@ page import="java.util.Collections" %>
<%@ 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-nested.tld" prefix="nested" %>
<%@ 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-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<script>
    function alertPermissions()
    {
        alert("Este procedimento afecta as permissões atuais no sistema de ficheiros da intranet. Após salvar estas alterações, por favor gere o BAT de geração de pastas e corra-o novamente na raiz do servidor IONLINE")
    }
    function alertFolders(place)
    {
        alert("Caro administrador, lembramos-lhe que alterar o " + place + " de uma unidade curricular implica trocar a pasta de ficheiros da intranet do " + place + " onde esta se encontrava para o " + place + " onde actualmente se encontra. O BACO irá actualizar a nova LOCALIZAÇÃO da pasta de ficheiros na sua base de dados. Mas a pasta terá de ser fisicamente alterada pela administração de sistemas.");
    }

</script>
<%
    IServiceManager sm = ServiceManager.getInstance();
    String[] names = new String[]{};
    Object[] args = new Object[]{};
    List<CourseView> courseViews = (List<CourseView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCourses", args, names);
    request.setAttribute("Courses", courseViews);

    List<pt.estgp.estgweb.domain.views.UserView> teachers =(List<pt.estgp.estgweb.domain.views.UserView>)  sm.execute(RequestUtils.getRequester(request, response), "LoadTeachers", args, names);
    /*Collections.sort(teachers,new Comparator<pt.estgp.estgweb.domain.views.UserView>(){

        @Override
        public int compare(pt.estgp.estgweb.domain.views.UserView o1, pt.estgp.estgweb.domain.views.UserView o2) {
            if(o1.getName()!=null && o2.getName() != null)
                return o1.getName().compareTo(o2.getName());
            if(o1.getName()==null)
                return 1;
            return -1;
        }

    });*/
    request.setAttribute("Teachers", teachers);
%>

<jsp:useBean id="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<html:errors/>
<jomm:messages/>

<ul>
    <li><html:link action="/user/startLoadCourseUnitFromHome.do?id=${CourseUnitView.id}">Página da Unidade</html:link></li>
    <li><html:link action="/startLoadCourseUnitProgram.do?courseUnitId=${CourseUnitView.id}">Ficha Curricular</html:link></li>
</ul>
<%
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 styleClass="form" action="${user}/courseUnitControllerAdmin${fromAction}${from}" enctype="multipart/form-data">

<%--<html:form styleClass="form" action="/user/courseUnitControllerAdminFromServiceZone" enctype="multipart/form-data">--%>

<input type="hidden" name="dispatch" value="createOrUpdateAdmin">
<html:hidden property="courseUnitView.id"/>
<html:hidden property="id"/>
<table>
<tr>
    <th>
        <bean:message key="courseunit.name"/>
    </th>
    <td>
        <html:text styleClass="text" property="courseUnitView.name"/>
    </td>
</tr>
<tr>
    <th>
        <bean:message key="courseunit.course"/>
    </th>
    <td>
        <html:select onchange="alertFolders('curso')" property="courseUnitView.courseId">
            <logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.views.CourseView">
                <html:option value="${course.id}">(${course.code}) ${course.name}</html:option>
            </logic:iterate>
        </html:select>
    </td>
</tr>
<tr>
    <th>
        <bean:message key="courseunit.code"/>
    </th>
    <td>
        <html:text styleClass="text" property="courseUnitView.code"/>
    </td>
</tr>
<tr>
    <th>
        <bean:message key="courseunit.semestre"/>
    </th>
    <td>
        <html:select onchange="alertFolders('semestre')" property="courseUnitView.semestre">
            <html:option value="S1"><bean:message key="courseunit.S1"/></html:option>
            <html:option value="S2"><bean:message key="courseunit.S2"/></html:option>
            <html:option value="A"><bean:message key="courseunit.A"/></html:option>
            <html:option value="T1"><bean:message key="courseunit.T1"/></html:option>
            <html:option value="T2"><bean:message key="courseunit.T2"/></html:option>
            <html:option value="T3"><bean:message key="courseunit.T3"/></html:option>
            <html:option value="T4"><bean:message key="courseunit.T4"/></html:option>
        </html:select>
    </td>
</tr>
<tr>
    <th>
        <bean:message key="courseunit.importYear"/>
    </th>
    <td>
        <html:select onchange="alertFolders('ano')" property="courseUnitView.importYear">
            <logic:iterate id="item" name="CourseUnitsForm" property="importYears">
                <html:option value="${item}">${item}</html:option>
            </logic:iterate>
        </html:select>
    </td>
</tr>
    <tr>
        <th>
            <bean:message key="courseunit.turma"/>
        </th>
        <td>
            <html:text styleClass="text" property="courseUnitView.cdTurma"/> (Esta ação vai influênciar as importações SIGES)
        </td>
    </tr>
<tr>
    <th>
        <bean:message key="courseunit.pathIntranet"/>
    </th>
    <td>
        <html:text styleClass="text" readonly="true" property="courseUnitView.pathIntranet"/> (Para preencher gerar pastas nos serviços)
    </td>
</tr>

<tr>
    <th>
        <bean:message key="courseunit.responsable"/>
    </th>
    <td>
        <html:select onchange="alertPermissions();" property="courseUnitView.responsableId">
            <html:option value="0"></html:option>
            <logic:iterate id="teacher" name="CourseUnitsForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
                <html:option value="${teacher.id}">(${teacher.code}) ${teacher.name}</html:option>
            </logic:iterate>
        </html:select>
    </td>
</tr>
<tr>
    <th>
        <bean:message key="courseunit.teachers"/>
    </th>
    <td>
        <logic:lessEqual value="0" name="CourseUnitView" property="id">
            <i><bean:message key="courseunit.to.add.teachers.save.first"/></i>
        </logic:lessEqual>

        <logic:greaterThan value="0" name="CourseUnitView" property="id">
            <html:select property="teacherId">
                <logic:present name="CourseUnitsForm" property="teachers">
                    <logic:iterate id="teacher" name="CourseUnitsForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
                        <jomm:option itemName="teacher" itemProperty="id" comparableObjectName="CourseUnitsForm"
                                     comparableObjectProperty="teacherId">
                            (${teacher.code}) ${teacher.name}
                        </jomm:option>
                    </logic:iterate>
                    <input type="button" value="<bean:message key="add"/>"
                           onclick="alertPermissions();set(this.form,'addTeacher');this.form.submit();">
                </logic:present>
            </html:select>
            <logic:greaterThan name="CourseUnitView" property="teachersSize" value="0">
                <table class="dataTable removeButton">
                    <logic:iterate id="userView" name="CourseUnitView" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
                        <tr>
                            <th>
                                    ${userView.code}
                            </th>
                            <th>
                                    ${userView.name}
                            </th>
                            <td><input type="button" class="removeButton"
                                       onclick="CourseUnitsForm.id.value='${userView.id}';set(this.form,'removeTeacher');this.form.submit();">
                            </td>
                        </tr>
                    </logic:iterate>
                </table>
            </logic:greaterThan>
        </logic:greaterThan>
    </td>
</tr>

<tr>
    <th>
        <bean:message key="courseunit.students"/>
    </th>
    <td>

        <logic:lessEqual value="0" name="CourseUnitView" property="id">
            <i><bean:message key="courseunit.to.add.students.save.first"/></i>
        </logic:lessEqual>

        <logic:greaterThan value="0" name="CourseUnitView" property="id">
            <html:text styleClass="text" property="studentCode"/>
            <input type="button" value="<bean:message key="add"/>"
                   onclick="if(this.form.studentCode.value=='0' || this.form.studentCode.value==''){alert('Por favor coloque o numero de aluno antes de adicionar');}else{alertPermissions();set(this.form,'addStudent');this.form.submit();}">
            <logic:greaterThan name="CourseUnitView" property="studentsSize" value="0">
                
                <table id="myTable" class="tablesorter dataTable removeButton"> 
                    <thead> 
                        <tr> 
                            <th>Código Siges</th> 
                            <th>Username</th> 
                            <th>Nome</th> 
                            <th>Email</th> 
                            <th>Telefone</th> 
                        </tr> 
                     </thead> 
                    <tbody> 
                    <logic:iterate id="userView" name="CourseUnitView" property="studentsOrderedByNumber" type="pt.estgp.estgweb.domain.views.UserView">
                        <tr>
                            <td>
                                    ${userView.code}
                            </td>
                            <td>
                                    ${userView.username}
                            </td>
                            <td>
                                    ${userView.name}
                            </td>
                            <td>
                                    ${userView.email}
                            </td>
                            <td>
                                    ${userView.phonenumber}
                            </td>
                            <td><input type="button" class="removeButton"
                                       onclick="CourseUnitsForm.id.value='${userView.code}';set(this.form,'removeStudent');this.form.submit();">
                            </td>
                        </tr>
                    </logic:iterate>
                    </tbody> 
                </table>
            </logic:greaterThan>
        </logic:greaterThan>
    </td>
</tr>


</table>
<input type="button" onclick="set(form,'createOrUpdateAdmin');form.submit()" value="<bean:message key="confirm"/>">
</html:form>

Generated by GNU Enscript 1.6.5.2.