Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 797 → Rev 800

/impl/importRoutines.xml
9,17 → 9,23
<java classname="pt.estgp.estgweb.services.sigesimports.ImportCourseService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201314"/>
</java>
</target>
</target>
<target name="sincronizeunits">
<java classname="pt.estgp.estgweb.services.sigesimports.SincronizeLastYearCourseUnitProgramsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201314"/>
<arg value="true"/>
<arg value="true"/>
</java>
</target>
<target name="teachers">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportTeachersService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportTeachersService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201314"/>
</java>
</target>
<target name="students">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportStudentsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportStudentsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201314"/>
</java>
</target>
<target name="grades">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
/impl/conf/language/MessageResourcesAnnouncements.properties
39,6 → 39,8
announcement.internal.no=Público
announcement.courseunit.internal=Interno aos alunos e docentes da unidade
 
annoucement.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/app.properties
1,7 → 1,7
 
#FICHEIRO DE CONFIGURACOES
 
import.year=201213
import.year=201314
tmp.dir=@tmp.dir@
data.dir=@data.dir@
use.ldap=@use.ldap@
/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/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/sigesimports/ImportTeachersService.java
64,7 → 64,8
for (BigDecimal c : codigos)
{
Docente d = service.getSiGesWEBSoap().getDocente(c, Globals.SIGES_INSTITUTION_CODE, year);
Teacher t = DaoFactory.getTeacherDaoImpl().loadBySigesCode(d.getCodigoFuncionario().intValue());
logger.info("Codigo Funcionario Importado:" + d.getCodigoFuncionario().intValue());
Teacher t = DaoFactory.getTeacherDaoImpl().loadBySigesCode(d.getCodigoFuncionario().intValue());
boolean newUser = false;
if (t == null)
{
/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/dao/impl/CourseDaoImpl.java
186,6 → 186,8
.list();
}
 
 
// Duarte Santos
public List<String> loadAreas()
{
/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/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/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/admin/announcements/submitAnnouncement.jsp
37,6 → 37,30
<baco:isAdmin>
<tr>
<th>
<bean:message key="announcement.position"/>
</th>
<td>
<html:select property="announcementView.position">
<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>