Subversion Repositories bacoAlunos

Rev

Rev 1746 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1746 Rev 1747
Line 23... Line 23...
23
        <tr>
23
        <tr>
24
            <th>SIGES</th>
24
            <th>SIGES</th>
25
            <th>Escola</th>
25
            <th>Escola</th>
26
            <th>Curso</th>
26
            <th>Curso</th>
27
            <th>Tipo</th>
27
            <th>Tipo</th>
-
 
28
            <th>Perfil</th>
28
            <th>SIGES</th>
29
            <th>SIGES</th>
29
            <th>Unidade</th>
30
            <th>Unidade</th>
30
            <th>Ficha</th>
31
            <th>Ficha</th>
31
        </tr>
32
        </tr>
32
    </thead>
33
    </thead>
Line 131... Line 132...
131
                            request.setAttribute("escolaDepartamentoNull",escolaDepartamentoNull);
132
                            request.setAttribute("escolaDepartamentoNull",escolaDepartamentoNull);
132
                            request.setAttribute("autoGeneratedUrl",autoGeneratedUrl);
133
                            request.setAttribute("autoGeneratedUrl",autoGeneratedUrl);
133
                            request.setAttribute("urlFail",urlFail);
134
                            request.setAttribute("urlFail",urlFail);
134
                %>
135
                %>
135
                        <tr>
136
                        <tr>
-
 
137
 
136
                            <td><%=c.getCode()%></td>
138
                            <td><%=c.getCode()%></td>
137
                            <td <logic:equal value="true" name="escolaDepartamentoNull">style="background-color: red"</logic:equal>>
139
                            <td <logic:equal value="true" name="escolaDepartamentoNull">style="background-color: red"</logic:equal>>
138
                                <logic:equal value="true" name="escolaDepartamentoNull">
140
                                <logic:equal value="true" name="escolaDepartamentoNull">
139
                                    S/Esco/Dep/Init
141
                                    S/Esco/Dep/Init
140
                                </logic:equal>
142
                                </logic:equal>
Line 142... Line 144...
142
                                    <%=c.getDepartment().getCourseSchool().getInitials()%></td>
144
                                    <%=c.getDepartment().getCourseSchool().getInitials()%></td>
143
                                </logic:equal>
145
                                </logic:equal>
144
 
146
 
145
                            <td><%=c.getName()%></td>
147
                            <td><%=c.getName()%></td>
146
                            <td><bean:message key="course.${course.degree}"/></td>
148
                            <td><bean:message key="course.${course.degree}"/></td>
147
 
-
 
-
 
149
                            <td></td>
148
                            <td <logic:equal value="false" name="unidadeSiges">style="background-color: red"</logic:equal> <logic:equal value="true" name="autoGeneratedSiges">style="background-color: #ffff00"</logic:equal>>
150
                            <td <logic:equal value="false" name="unidadeSiges">style="background-color: red"</logic:equal> <logic:equal value="true" name="autoGeneratedSiges">style="background-color: #ffff00"</logic:equal>>
149
                                <logic:equal value="true" name="unidadeSiges">
151
                                <logic:equal value="true" name="unidadeSiges">
150
 
152
 
151
                                    ${unidade.siges}
153
                                    ${unidade.siges}
152
                                    <logic:equal value="true" name="autoGeneratedSiges">
154
                                    <logic:equal value="true" name="autoGeneratedSiges">
Line 177... Line 179...
177
                    {
179
                    {
178
                        for(Curso.Semestre.Perfil perfil : semestre.getPerfil())
180
                        for(Curso.Semestre.Perfil perfil : semestre.getPerfil())
179
                        {
181
                        {
180
                            for(UnidadeType unidade : semestre.getUnidade())
182
                            for(UnidadeType unidade : semestre.getUnidade())
181
                            {
183
                            {
-
 
184
                                request.setAttribute("unidade",unidade);
-
 
185
                                boolean unidadeSiges = unidade.getSiges() != null && unidade.getSiges().trim().length() > 0;
-
 
186
                                boolean autoGeneratedSiges = false;
-
 
187
                                boolean escolaDepartamentoNull = false;
-
 
188
                                boolean autoGeneratedUrl = false;
-
 
189
                                boolean urlFail = false;
-
 
190
 
-
 
191
                                if(c.getDepartment() == null || c.getDepartment().getCourseSchool() == null || c.getDepartment().getCourseSchool().getInitials() == null)
-
 
192
                                {
-
 
193
                                    escolaDepartamentoNull = true;
-
 
194
                                }
-
 
195
 
-
 
196
                                if(!unidadeSiges)
-
 
197
                                {
-
 
198
                                    CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().findUnitByCourseNameYear(c.getId(),unidade.getNome(),importYear);
-
 
199
                                    if(cu != null)
-
 
200
                                    {
-
 
201
                                        unidadeSiges = true;
-
 
202
                                        autoGeneratedSiges = true;
-
 
203
 
-
 
204
                                        unidade.setSiges(cu.getCode());
-
 
205
                                        if(escolaDepartamentoNull)
-
 
206
                                        {
-
 
207
                                            //ja foi colocado em cima
-
 
208
                                        }
-
 
209
                                        else if(c.getDepartment().getCourseSchool().getInitials().equals("ESTG"))
-
 
210
                                        {
-
 
211
                                            unidade.setUrlFichaCurricular("http://www.estgp.pt/startLoadCourseUnitProgramSiges.do?unitCode=" + unidade.getSiges() + "&courseCode=" + c.getCode() + "&semestre=" + semestre.getId());
-
 
212
                                            autoGeneratedUrl = true;
-
 
213
                                        }
-
 
214
                                    }
-
 
215
                                }
-
 
216
                                else if(!escolaDepartamentoNull &&
-
 
217
                                        c.getDepartment().getCourseSchool().getInitials().equals("ESTG") &&
-
 
218
                                        (unidade.getUrlFichaCurricular() == null || unidade.getUrlFichaCurricular().length() ==0 ))
-
 
219
                                {
-
 
220
                                    autoGeneratedUrl = true;
-
 
221
                                    unidade.setUrlFichaCurricular("http://www.estgp.pt/startLoadCourseUnitProgramSiges.do?unitCode=" + unidade.getSiges() + "&courseCode=" + c.getCode() + "&semestre=" + semestre.getId());
-
 
222
                                }
-
 
223
 
-
 
224
                                try{
-
 
225
                                    int code = pt.estgp.estgweb.web.utils.HttpUtils.getResponseCode(unidade.getUrlFichaCurricular());
-
 
226
                                    if(code != 200)
-
 
227
                                    {
-
 
228
                                        urlFail = true;
-
 
229
                                        System.out.println("Erro a carregar ficha: " + unidade.getUrlFichaCurricular());
-
 
230
                                    }
-
 
231
                                }catch(Throwable f404)
-
 
232
                                {
-
 
233
                                    urlFail = true;
-
 
234
                                    System.out.println("Erro a carregar ficha: " + unidade.getUrlFichaCurricular());
-
 
235
                                }
-
 
236
 
-
 
237
                                request.setAttribute("autoGeneratedSiges",autoGeneratedSiges);
-
 
238
                                request.setAttribute("unidadeSiges",unidadeSiges);
-
 
239
                                request.setAttribute("escolaDepartamentoNull",escolaDepartamentoNull);
-
 
240
                                request.setAttribute("autoGeneratedUrl",autoGeneratedUrl);
-
 
241
                                request.setAttribute("urlFail",urlFail);
-
 
242
                                %>
-
 
243
                                <tr>
-
 
244
                                    <td><%=c.getCode()%></td>
-
 
245
                                    <td <logic:equal value="true" name="escolaDepartamentoNull">style="background-color: red"</logic:equal>>
-
 
246
                                        <logic:equal value="true" name="escolaDepartamentoNull">
-
 
247
                                            S/Esco/Dep/Init
-
 
248
                                        </logic:equal>
-
 
249
                                        <logic:equal value="false" name="escolaDepartamentoNull">
-
 
250
                                        <%=c.getDepartment().getCourseSchool().getInitials()%></td>
-
 
251
                                    </logic:equal>
182
 
252
 
-
 
253
                                    <td><%=c.getName()%></td>
-
 
254
                                    <td><bean:message key="course.${course.degree}"/></td>
-
 
255
                                    <td><%=perfil.getNome()%></td>
-
 
256
                                    <td <logic:equal value="false" name="unidadeSiges">style="background-color: red"</logic:equal> <logic:equal value="true" name="autoGeneratedSiges">style="background-color: #ffff00"</logic:equal>>
-
 
257
                                        <logic:equal value="true" name="unidadeSiges">
-
 
258
 
-
 
259
                                            ${unidade.siges}
-
 
260
                                            <logic:equal value="true" name="autoGeneratedSiges">
-
 
261
                                                (Auto)
-
 
262
                                            </logic:equal>
-
 
263
                                        </logic:equal>
-
 
264
                                        <logic:equal value="false" name="unidadeSiges">
-
 
265
                                            Nao Tem
-
 
266
                                        </logic:equal>
-
 
267
                                    </td>
-
 
268
                                    <td>${unidade.nome}</td>
-
 
269
                                    <td <logic:equal value="true" name="urlFail">style="background-color: red"</logic:equal>>
-
 
270
                                        <logic:equal value="true" name="autoGeneratedUrl">
-
 
271
                                            <label <logic:equal value="true" name="autoGeneratedUrl">style="background-color: #ffff00"</logic:equal>>(Auto)</label>
-
 
272
                                        </logic:equal>
-
 
273
                                        <logic:equal value="true" name="urlFail">
-
 
274
                                            (Falhou)
-
 
275
                                        </logic:equal>
-
 
276
                                        <a href="<%=unidade.getUrlFichaCurricular()%>"><span class="glyphicon glyphicon-download"></span></a>
-
 
277
                                    </td>
-
 
278
                                </tr>
-
 
279
                                <%
-
 
280
                            if(autoGeneratedSiges || autoGeneratedUrl)
-
 
281
                                courseService.savePlanoEstudosEditado(c.getId(),plan.getId(),curso,plan,UserSession);
183
                            }
282
                            }
184
                        }
283
                        }
185
                    }
284
                    }
186
                }
285
                }
187
            }
286
            }