Subversion Repositories bacoAlunos

Rev

Rev 215 | Rev 277 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
214 jmachado 1
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
2
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
3
<%@ page import="pt.estgp.estgweb.domain.views.CourseView" %>
4
<%@ page import="java.util.List" %>
5
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
206 jmachado 6
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
7
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
8
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
9
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
12
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
13
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
214 jmachado 14
<%
15
    IServiceManager sm = ServiceManager.getInstance();
16
    String[] names = new String[]{};
17
    Object[] args = new Object[]{};
18
    List<CourseView> courseViews = (List<CourseView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCourses", args, names);
19
    request.setAttribute("Courses", courseViews);
20
%>
215 jmachado 21
 
206 jmachado 22
<jsp:useBean id="CourseUnitView" type="pt.estgp.estgweb.domain.views.CourseUnitView" scope="request"/>
23
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
214 jmachado 24
<html:errors/>
25
<jomm:messages/>
206 jmachado 26
<html:form styleClass="form" action="/user/courseUnitControllerAdminFromServiceZone" enctype="multipart/form-data">
214 jmachado 27
<input type="hidden" name="dispatch" value="createOrUpdateAdmin">
28
<html:hidden property="courseUnitView.id"/>
29
<html:hidden property="id"/>
30
<table>
31
<tr>
32
    <th>
33
        <bean:message key="courseunit.name"/>
34
    </th>
35
    <td>
36
        <html:text styleClass="text" property="courseUnitView.name"/>
37
    </td>
38
</tr>
39
<tr>
40
    <th>
41
        <bean:message key="courseunit.course"/>
42
    </th>
43
    <td>
44
        <html:select property="courseUnitView.courseId">
45
            <logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.views.CourseView">
46
                <html:option value="${course.id}">(${course.code}) ${course.name}</html:option>
47
            </logic:iterate>
48
        </html:select>
49
    </td>
50
</tr>
51
<tr>
52
    <th>
53
        <bean:message key="courseunit.code"/>
54
    </th>
55
    <td>
56
        <html:text styleClass="text" property="courseUnitView.code"/>
57
    </td>
58
</tr>
59
<tr>
60
    <th>
61
        <bean:message key="courseunit.semestre"/>
62
    </th>
63
    <td>
64
        <html:select property="courseUnitView.semestre">
65
            <html:option value="S1">S1</html:option>
66
            <html:option value="S2">S2</html:option>
67
        </html:select>
68
    </td>
69
</tr>
70
<tr>
71
    <th>
72
        <bean:message key="courseunit.importYear"/>
73
    </th>
74
    <td>
75
        <html:select property="courseUnitView.importYear">
76
            <logic:iterate id="item" name="CourseUnitsForm" property="importYears">
77
                <html:option value="${item}">${item}</html:option>
78
            </logic:iterate>
79
        </html:select>
80
    </td>
81
</tr>
82
<tr>
83
    <th>
84
        <bean:message key="courseunit.teachers"/>
85
    </th>
86
    <td>
87
        <html:select property="teacherId">
88
            <logic:present name="CourseUnitsForm" property="teachers">
89
                <logic:iterate id="teacher" name="CourseUnitsForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
90
                    <jomm:option itemName="teacher" itemProperty="id" comparableObjectName="CourseUnitsForm"
91
                                 comparableObjectProperty="teacherId">
92
                        (${teacher.code}) ${teacher.name}
93
                    </jomm:option>
94
                </logic:iterate>
206 jmachado 95
                <input type="button" value="<bean:message key="add"/>"
214 jmachado 96
                       onclick="set(this.form,'addTeacher');this.form.submit();">
97
            </logic:present>
98
        </html:select>
99
        <logic:greaterThan name="CourseUnitView" property="teachersSize" value="0">
100
            <table class="dataTable removeButton">
101
                <logic:iterate id="userView" name="CourseUnitView" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
102
                    <tr>
103
                        <th>
104
                                ${userView.code}
105
                        </th>
106
                        <th>
107
                                ${userView.name}
108
                        </th>
109
                        <td><input type="button" class="removeButton"
110
                                   onclick="CourseUnitsForm.id.value='${userView.id}';set(this.form,'removeTeacher');this.form.submit();">
111
                        </td>
112
                    </tr>
113
                </logic:iterate>
114
            </table>
115
        </logic:greaterThan>
116
    </td>
117
</tr>
276 jmachado 118
 
214 jmachado 119
<tr>
120
    <th>
121
        <bean:message key="courseunit.students"/>
122
    </th>
123
    <td>
276 jmachado 124
 
125
        <logic:lessEqual value="0" name="courseunit.id">
126
            <bean:message key="courseunit.to.add.students.save.first"/>
127
        </logic:lessEqual>
128
 
129
        <logic:greaterThan value="0" name="courseunit.id">
130
            <html:text styleClass="text" property="studentCode"/>
131
            <input type="button" value="<bean:message key="add"/>"
132
                   onclick="set(this.form,'addStudent');this.form.submit();">
133
            <logic:greaterThan name="CourseUnitView" property="studentsSize" value="0">
134
                <table class="dataTable removeButton">
135
                    <logic:iterate id="userView" name="CourseUnitView" property="students" type="pt.estgp.estgweb.domain.views.UserView">
136
                        <tr>
137
                            <th>
138
                                    ${userView.code}
139
                            </th>
140
                            <th>
141
                                    ${userView.username}
142
                            </th>
143
                            <th>
144
                                    ${userView.name}
145
                            </th>
146
                            <th>
147
                                    ${userView.email}
148
                            </th>
149
                            <th>
150
                                    ${userView.address}
151
                            </th>
152
                            <td><input type="button" class="removeButton"
153
                                       onclick="CourseUnitsForm.id.value='${userView.code}';set(this.form,'removeStudent');this.form.submit();">
154
                            </td>
155
                        </tr>
156
                    </logic:iterate>
157
                </table>
158
            </logic:greaterThan>
214 jmachado 159
        </logic:greaterThan>
160
    </td>
161
</tr>
206 jmachado 162
 
276 jmachado 163
 
214 jmachado 164
</table>
165
<input type="button" onclick="set(form,'createOrUpdateAdmin');form.submit()" value="<bean:message key="confirm"/>">
206 jmachado 166
</html:form>