/branches/v3/impl/conf/WEB-INF/struts/struts-pae-questionarios.xml |
---|
100,6 → 100,7 |
validate="true" |
input="page.pae.questionario.pedagogico.message"> |
<forward name="success" path="page.pae.questionario.see"/> |
<forward name="seeAll" path="page.pae.see.questionarios"/> |
</action> |
<!--Outros no futuro |
/branches/v3/impl/conf/app.properties |
---|
17,6 → 17,8 |
user.session.timeout.minutes=60 |
site.url=@site.url@ |
#USAR APENAS ESTES DOIS EMAILS NAO DA PARA MAIS |
admin.email=@admin.email.1@ |
admin.email.2=@admin.email.2@ |
36,7 → 38,7 |
#to use example: bacodev1@estgp.pt bacodev2@estgp.pt |
email.user.prefix=@email.user.prefix@ |
email.user.sufix=@email.user.sufix@ |
email.user.count=20 |
email.user.count=@email.user.count@ |
email.user=bacodev@estgp.pt |
email.password=@email.password@ |
704,8 → 706,8 |
system.redirections.policy.index.welcome=@system.redirections.policy.index.welcome@ |
system.redirections.policy.authentication.action=@system.redirections.policy.authentication.action@ |
system.redirections.policy.authentication.logout.action=@system.redirections.policy.authentication.logout.action@ |
system.mail.standard.certificated.home.page=@system.mail.standard.certificated.home.page@ |
###AQUI PODEMOS USAR OU TRA INTRANET OU OUTRO PORTAL PUBLICO |
system.intranet.url=@system.intranet.url@ |
system.public.url=@system.public.url@ |
/branches/v3/impl/conf/template/email/courseUnitAnnouncement_pt.txt |
---|
1,4 → 1,5 |
# 0 : Course Unit Name |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
/branches/v3/impl/conf/berserk/sd.xml |
---|
2828,6 → 2828,19 |
</filterChains> |
</service> |
<service> |
<name>QuestionarioSendMessageAllProcessing</name> |
<implementationClass>pt.estgp.estgweb.services.questionarios.QuestionariosService</implementationClass> |
<description></description> |
<isTransactional>true</isTransactional> |
<defaultMethod>sendMessageAllProcessing</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="AuthenticatedUsers"/> |
<chain name="AdminsOrQuestionarioAdminsOrPedagogico"/> |
</filterChains> |
</service> |
<service> |
<name>SalvarFicheiro</name> |
/branches/v3/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
139,6 → 139,9 |
public static final String EMAIL_SERVER_PASSWORD = ConfigProperties.getProperty("email.password"); |
public static final String ADMIN_EMAIL = ConfigProperties.getProperty("admin.email"); |
public static final String ADMIN_EMAIL_2 = ConfigProperties.getProperty("admin.email.2"); |
442,6 → 445,7 |
public static final String ROLE_INVITED = "invited"; |
public static final String SYSTEM_EMAIL_CERTIFICATED_HOME_PAGE = ConfigProperties.getProperty("system.mail.standard.certificated.home.page"); |
public static final String SYSTEM_THEME = ConfigProperties.getProperty("system.theme"); |
public static final String AUTHENTICATE_SERVICE = ConfigProperties.getProperty("authentication.policy.service"); |
public static final String AUTHENTICATE_SERVICE_USERNAME_KEY = ConfigProperties.getProperty("authentication.policy.username.msg.key"); |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/email/impl/EmailTransport.java |
---|
New file |
0,0 → 1,135 |
package pt.estgp.estgweb.services.email.impl; |
import org.apache.log4j.Logger; |
import pt.estgp.estgweb.Globals; |
import javax.mail.MessagingException; |
import javax.mail.PasswordAuthentication; |
import javax.mail.Session; |
import javax.mail.Transport; |
import java.util.Properties; |
/** |
* Created by jorgemachado on 13/06/16. |
*/ |
public class EmailTransport |
{ |
private static final Logger logger = Logger.getLogger(EmailTransport.class); |
Session session = null; |
Transport transport = null; |
String sendFromAddress; |
String password; |
String identifier; |
public EmailTransport(String identifier, String sendFromAddress,String password) |
{ |
this.identifier = identifier; |
this.sendFromAddress = sendFromAddress; |
this.password = password; |
} |
public synchronized Transport getEmailTransport() |
{ |
if(session == null || transport == null || !transport.isConnected()) |
{ |
logger.info("Transport(" + identifier + ") CONNECTION TO TRANSPORT DOES NOT EXIST OR FAIL WILL REOPEN : " + sendFromAddress + " password: " + password); |
} |
else |
{ |
System.out.println("Transport(" + identifier + ") OK --> RETURNING Transport"); |
return transport; |
} |
// Set up properties for mail session |
//Properties props = System.getProperties(); |
Properties props = new Properties(); |
props.put("mail.smtp.host", Globals.EMAIL_SERVER_HOST); |
props.setProperty("mail.transport.protocol", "smtp");//todo new |
javax.mail.Authenticator authenticator = null; |
if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("TLS")==0) |
{ |
logger.info("Transport(" + identifier + ") Using Email Security TLS"); |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.starttls.enable", "true"); |
props.put("mail.smtp.port", ""+ Globals.EMAIL_SERVER_SECURITY_TLS); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
System.out.println("Email from:" + sendFromAddress + " pass:" + password); |
return new PasswordAuthentication(sendFromAddress, password); |
} |
}; |
} |
else if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("SSL")==0) |
{ |
logger.info("Transport(" + identifier + ") Using Email Security SSL"); |
props.put("mail.smtp.socketFactory.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
props.put("mail.smtp.socketFactory.class", |
"javax.net.ssl.SSLSocketFactory"); |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
System.out.println("Email from:" + sendFromAddress + " pass:" + password); |
return new PasswordAuthentication(sendFromAddress,password); |
} |
}; |
} |
else |
{ |
} |
System.out.println("Transport(" + identifier + ") Autenticator != null :" + (authenticator != null)); |
// Get session |
/*Session session = authenticator != null ? |
Session.getDefaultInstance(props, authenticator) |
: Session.getDefaultInstance(props) ; |
*/ |
session = authenticator != null ? |
Session.getInstance(props, authenticator) |
: Session.getInstance(props) ; |
try { |
transport = session.getTransport("smtp"); |
System.out.println("Transport(" + identifier + ") before connect isConnected:" + transport.isConnected()); |
transport.connect(); |
System.out.println("Transport(" + identifier + ") after connect isConnected:" + transport.isConnected()); |
} catch (MessagingException e) { |
logger.error(e,e); |
return null; |
} |
session.setDebug(true); |
session.setDebugOut(System.out); |
return transport; |
} |
public String getIdentifier() { |
return identifier; |
} |
public Session getSession() { |
return session; |
} |
public Transport getTransport() { |
return transport; |
} |
public String getSendFromAddress() { |
return sendFromAddress; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/email/impl/EmailTransportPool.java |
---|
New file |
0,0 → 1,89 |
package pt.estgp.estgweb.services.email.impl; |
import org.apache.log4j.Logger; |
import pt.estgp.estgweb.Globals; |
import javax.mail.Transport; |
import java.util.ArrayList; |
import java.util.List; |
/** |
* Created by jorgemachado on 13/06/16. |
*/ |
public class EmailTransportPool |
{ |
private static final Logger logger = Logger.getLogger(EmailTransportPool.class); |
private List<EmailTransport> pool = new ArrayList<EmailTransport>(); |
//SINGLETON INSTANCE |
static EmailTransportPool instance = new EmailTransportPool(); |
public static EmailTransportPool getInstance(){ |
return instance; |
} |
String[] serverEmails; |
private EmailTransportPool() |
{ |
serverEmails = new String[Globals.EMAIL_SERVER_USER_COUNT]; |
for(int i = 1;i<= Globals.EMAIL_SERVER_USER_COUNT;i++) |
{ |
serverEmails[i-1] = Globals.EMAIL_SERVER_USER_PREFIX + i + Globals.EMAIL_SERVER_USER_SUFIX; |
} |
if(Globals.SYSTEM_EMAIL_USE_ROUND_ROBIN) |
{ |
for(String emailFrom: serverEmails) |
{ |
String pass = Globals.EMAIL_SERVER_PASSWORD; |
logger.info("POOL: Adding to POOL " + emailFrom + " with pass: " + pass); |
createTransport(emailFrom,emailFrom,pass); |
} |
} |
else |
{ |
logger.info("POOL: Will use only system mail box"); |
createTransport(Globals.SYSTEM_EMAIL_BOX,Globals.SYSTEM_EMAIL_BOX,Globals.EMAIL_SERVER_PASSWORD); |
} |
} |
private void createTransport(String identifier, String emailFrom, String emailServerPassword) |
{ |
EmailTransport emailTransport = new EmailTransport(identifier,emailFrom,emailServerPassword); |
pool.add(emailTransport); |
} |
int indexPool = -1; |
public synchronized EmailTransport getAvailableTransportFromPool() |
{ |
int tries = pool.size(); |
while(tries > 0) |
{ |
tries--; |
indexPool++; |
if(indexPool >= pool.size()) |
indexPool = 0; |
EmailTransport emailTransport = pool.get(indexPool); |
Transport transport = emailTransport.getEmailTransport(); |
if(transport.isConnected()) |
{ |
logger.warn("EMAIL POOL: Transport (" + emailTransport.getIdentifier() + ") is OK connected, will return this one"); |
return emailTransport; |
} |
else |
{ |
logger.warn("EMAIL POOL: Transport (" + emailTransport.getIdentifier() + ") is not connected, will try another"); |
} |
} |
logger.warn("EMAIL POOL: Transport (There are no available transports)"); |
return null; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java |
---|
5,6 → 5,8 |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.enums.LangEnum; |
import pt.estgp.estgweb.services.email.impl.EmailTransport; |
import pt.estgp.estgweb.services.email.impl.EmailTransportPool; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import pt.estgp.estgweb.utils.Email; |
12,12 → 14,15 |
import pt.estgp.estgweb.web.utils.DatesUtils; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import javax.mail.*; |
import javax.mail.Message; |
import javax.mail.MessagingException; |
import javax.mail.internet.InternetAddress; |
import javax.mail.internet.MimeMessage; |
import java.io.UnsupportedEncodingException; |
import java.text.MessageFormat; |
import java.util.*; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.List; |
/** |
* @author Jorge Machado |
31,24 → 36,123 |
private static final String gradeUnitTemplate = Globals.TEMPLATE_EMAIL_PATH + "/" + Globals.EMAIL_GRADE_UNIT_TEMPLATE; |
String sendFromAddress; |
/*static String sendFromAddress;*/ |
public SendEmailService() { |
sendFromAddress = Globals.SYSTEM_EMAIL_USE_ROUND_ROBIN ? |
getRoundRobinEmailUser() : Globals.SYSTEM_EMAIL_BOX; |
} |
static String[] serverEmails; |
/*static String[] serverEmails; |
static int serverEmailPos = -1; |
static Session session = null; |
static Transport transport = null; |
static{ |
static |
{ |
serverEmails = new String[Globals.EMAIL_SERVER_USER_COUNT]; |
for(int i = 1;i<= Globals.EMAIL_SERVER_USER_COUNT;i++) |
{ |
serverEmails[i-1] = Globals.EMAIL_SERVER_USER_PREFIX + i + Globals.EMAIL_SERVER_USER_SUFIX; |
} |
} |
public static synchronized Transport getEmailTransport() |
{ |
if(session == null || transport == null || !transport.isConnected()) |
{ |
sendFromAddress = Globals.SYSTEM_EMAIL_USE_ROUND_ROBIN ? |
getRoundRobinEmailUser() : Globals.SYSTEM_EMAIL_BOX; |
logger.info("CONNECTION TO TRANSPORT FAIL WILL REOPEN : " + sendFromAddress + " using round robin: " + Globals.SYSTEM_EMAIL_USE_ROUND_ROBIN); |
} |
else |
{ |
System.out.println("TRANSPORT OK RETURNING"); |
return transport; |
} |
// Set up properties for mail session |
//Properties props = System.getProperties(); |
Properties props = new Properties(); |
props.put("mail.smtp.host", Globals.EMAIL_SERVER_HOST); |
props.setProperty("mail.transport.protocol", "smtp");//todo new |
final String username = Globals.EMAIL_SERVER_USERNAME; |
final String password = Globals.EMAIL_SERVER_PASSWORD; |
javax.mail.Authenticator authenticator = null; |
if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("TLS")==0) |
{ |
logger.info("Using Email Security TLS"); |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.starttls.enable", "true"); |
props.put("mail.smtp.port", ""+ Globals.EMAIL_SERVER_SECURITY_TLS); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
System.out.println("Email from:" + sendFromAddress + " pass:" + password); |
return new PasswordAuthentication(sendFromAddress, password); |
} |
}; |
} |
else if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("SSL")==0) |
{ |
logger.info("Using Email Security SSL"); |
props.put("mail.smtp.socketFactory.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
props.put("mail.smtp.socketFactory.class", |
"javax.net.ssl.SSLSocketFactory"); |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
System.out.println("Email from:" + sendFromAddress + " pass:" + password); |
return new PasswordAuthentication(sendFromAddress,password); |
} |
}; |
} |
else |
{ |
} |
System.out.println("Autenticator != null :" + (authenticator != null)); |
// Get session |
//Session session = authenticator != null ? |
// Session.getDefaultInstance(props, authenticator) |
// : Session.getDefaultInstance(props) ; |
session = authenticator != null ? |
Session.getInstance(props, authenticator) |
: Session.getInstance(props) ; |
try { |
System.out.println("toString:" + session.getTransport("smtp").toString()); |
transport = session.getTransport("smtp"); |
System.out.println("before connect isConnected:" + transport.isConnected()); |
transport.connect(); |
System.out.println("after connect isConnected:" + transport.isConnected()); |
} catch (MessagingException e) { |
logger.error(e,e); |
return null; |
} |
session.setDebug(true); |
session.setDebugOut(System.out); |
return transport; |
} |
private static synchronized String getRoundRobinEmailUser() |
{ |
serverEmailPos++; |
58,8 → 162,8 |
} |
return serverEmails[serverEmailPos]; |
} |
*/ |
public void sendEmail(Email email) throws ServiceException |
{ |
sendEmail(email,null,null); |
74,64 → 178,15 |
} |
try{ |
//Transport transport = getEmailTransport(); |
//MimeMessage message = new MimeMessage(session); |
EmailTransport emailTransport = EmailTransportPool.getInstance().getAvailableTransportFromPool(); |
MimeMessage message = new MimeMessage(emailTransport.getSession()); |
// Set up properties for mail session |
Properties props = System.getProperties(); |
props.put("mail.smtp.host", Globals.EMAIL_SERVER_HOST); |
final String username = Globals.EMAIL_SERVER_USERNAME; |
final String password = Globals.EMAIL_SERVER_PASSWORD; |
javax.mail.Authenticator authenticator = null; |
if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("TLS")==0) |
{ |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.starttls.enable", "true"); |
props.put("mail.smtp.port", ""+ Globals.EMAIL_SERVER_SECURITY_TLS); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
return new PasswordAuthentication(sendFromAddress, password); |
} |
}; |
} |
else if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("SSL")==0) |
{ |
props.put("mail.smtp.socketFactory.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
props.put("mail.smtp.socketFactory.class", |
"javax.net.ssl.SSLSocketFactory"); |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
return new PasswordAuthentication(sendFromAddress,password); |
} |
}; |
} |
else |
{ |
} |
// Get session |
Session session = authenticator != null ? |
Session.getDefaultInstance(props, authenticator) |
: Session.getDefaultInstance(props) ; |
//Session session = authenticator != null ? |
// Session.getInstance(props, authenticator) |
// : Session.getInstance(props) ; |
//session.getTransport().connect(); |
session.setDebug(true); |
session.setDebugOut(System.out); |
// Create message |
MimeMessage message = new MimeMessage(session); |
// Set the recipients of the message |
boolean valid = false; |
for (String recipient : email.getRecipients()) |
170,10 → 225,10 |
logger.info("FROM:" + email.getFrom() + " but using: " + sendFromAddress); |
logger.info("FROM:" + email.getFrom() + " but using: " + emailTransport.getSendFromAddress()); |
//if(email.getFromName() != null) |
try { |
message.setFrom(new InternetAddress(sendFromAddress,sendFromAddress)); |
message.setFrom(new InternetAddress(emailTransport.getSendFromAddress(),emailTransport.getSendFromAddress())); |
} catch (UnsupportedEncodingException e) { |
logger.error(e,e); |
//message.setFrom(new InternetAddress(sendFromAddress)); |
211,8 → 266,8 |
Transport.send(message); |
//session.getTransport().sendMessage(message,message.getAllRecipients()); |
emailTransport.getTransport().send(message); |
//session.getTransport("smtp").sendMessage(message,message.getAllRecipients()); |
//session.getTransport().close(); |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/email/EMAILJobPersonalizedCertificated.java |
---|
63,6 → 63,8 |
cloned.setRecipients(new ArrayList<String>()); |
SendEmailService sendEmailService = new SendEmailService(); |
for(long userId: cloned.getUserIds()) |
{ |
100,7 → 102,7 |
String finalUrl = URL_PREFIX + certificate; |
new SendEmailService().sendEmail(cloned,finalUrl,nome); |
sendEmailService.sendEmail(cloned, finalUrl, nome); |
try { |
logger.info("Watting to send another email: sent to" + toEmail); |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/questionarios/QuestionariosService.java |
---|
10,6 → 10,7 |
import pt.estgp.estgweb.services.email.EMAILJobPersonalizedCertificated; |
import pt.estgp.estgweb.services.email.SendEmailService; |
import pt.estgp.estgweb.services.jobs.JobScheduleService; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import pt.estgp.estgweb.utils.Email; |
import pt.estgp.estgweb.utils.EmailPersonalizedCertificated; |
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException; |
224,6 → 225,13 |
} |
public int sendMessageAllProcessing(boolean onlyNotAnswered,String msg,String emailFrom,String personFrom, String subject,UserSession userSession) |
{ |
String source = "questionarios em processamento message"; |
AnnouncementDaoImpl.FindUsersIdResult result = DaoFactory.getQuestionarioDaoImpl().findUsersIdsPedagogicoAllProcessing(onlyNotAnswered); |
return sendEmails(null, msg, emailFrom, personFrom, subject, userSession, source, result); |
} |
private int sendEmails(Long id, String msg, String emailFrom, String personFrom, String subject, UserSession userSession, String source, AnnouncementDaoImpl.FindUsersIdResult result) { |
List<Long> usersToConsume = result.userIds; |
241,22 → 249,44 |
// contador++; |
// } |
String suffix = Globals.SYSTEM_EMAIL_CERTIFICATED_HOME_PAGE; |
if(suffix.startsWith("/")) |
suffix = suffix.substring(1); |
String url = Globals.SITE_URL.endsWith("/") ? Globals.SITE_URL + suffix : Globals.SITE_URL + "/" + suffix; |
EmailPersonalizedCertificated e = sendEmailService.getMessageEmailAdulteredFromEmailIppCertificated(emailFrom, |
personFrom, |
subject, |
msg, |
userSession.getUser(), |
usersToConsume, |
Globals.SITE_URL + "/user/homePae.do"); |
url); |
e.setHtml(true); |
EMAILJobPersonalizedCertificated emailJob = new EMAILJobPersonalizedCertificated(e); |
JobScheduleService.getInstance().scheduleNow(emailJob,"Message Email (" + source + ":id " + id + ") from " + userSession.getUsername() + " as " + personFrom + " - subject:" + subject ,userSession); |
//} |
enviarComprovativoAoRemetente(id, msg, emailFrom, personFrom, subject, userSession, source,usersToConsume.size()); |
enviarComprovativoAAdministracao(id, msg, emailFrom, personFrom, subject, userSession, source,usersToConsume.size()); |
return result.users; |
} |
private void enviarComprovativoAAdministracao(Long id, String msg, String emailFrom, String personFrom, String subject, UserSession userSession, String source,int sentTo) |
{ |
Email e = sendEmailService.getMessageEmailAdulteredFromEmailIpp(emailFrom, |
personFrom, |
subject + " (COMPROVATIVO PAE) ", |
"<u>Caros membros da administração este é um comprovativo de um email enviado pelo PAE pelo user: " + userSession.getUser().getName() + " - Este é um comprovativo do seu envio de mensagem a " + sentTo + " Alunos</u><br/><br/>" + msg, |
ConfigProperties.getListValuesByPrefix("admin.email"), |
userSession.getUser()); |
e.setHtml(true); |
EMAILJob emailJob = new EMAILJob(e); |
JobScheduleService.getInstance().scheduleNow(emailJob,"Message Email (" + source + ":id " + id + ") from " + userSession.getUsername() + " as " + personFrom + " - subject:" + subject ,userSession); |
} |
private void enviarComprovativoAoRemetente(Long id, String msg, String emailFrom, String personFrom, String subject, UserSession userSession, String source,int sentTo) |
{ |
Map<String,String> emailsComprovativos = new HashMap<String, String>(); |
/branches/v3/impl/src/java/pt/estgp/estgweb/domain/dao/impl/QuestionarioDaoImpl.java |
---|
111,6 → 111,25 |
else |
return 0; |
} |
public long getNumeroAlunosComRespostas(long questionarioId) |
{ |
Query q = AbstractDao.getCurrentSession().createQuery("SELECT " + |
" count(distinct a.aluno.id) AS respostasAlunos " + |
"from " + QuestionarioPedagogicoCursoAfeto.class.getName() + " c " + |
"JOIN c.questionario q " + |
"JOIN c.unidadesAfetas u " + |
"JOIN u.tipologiasRequisitadas t " + |
"JOIN t.alunosRequisitados a " + |
"JOIN a.respostaRequisitada rR " + |
"JOIN rR.resposta r " + |
"WHERE q.id = :id "); |
q.setLong("id",questionarioId); |
Object result = q.uniqueResult(); |
if(result != null) |
return (Long) result; |
return 0; |
} |
public long getNumeroUnidadesUsadas(long questionarioId) |
{ |
Query q = getCurrentSession().createQuery |
232,7 → 251,45 |
} |
public AnnouncementDaoImpl.FindUsersIdResult findUsersIdsPedagogicoAllProcessing(boolean onlyNotAnswered) |
{ |
AnnouncementDaoImpl.FindUsersIdResult findUsersResult = new AnnouncementDaoImpl.FindUsersIdResult(); |
List<Long> users = new ArrayList<Long>(); |
findUsersResult.userIds = users; |
Query q = AbstractDao.getCurrentSession().createQuery("SELECT " + |
" u.id " + |
"from " + QuestionarioPedagogicoAlunoRequisitado.class.getName() + " aR " + |
"JOIN aR.respostaRequisitada rR " + |
"JOIN rR.user u " + |
"WHERE " + |
"( " + |
" aR.tipologiaRequisitada.unidadeAfeta.cursoAfeto.questionario.state = :sP1 " + |
" OR " + |
" aR.tipologiaRequisitada.unidadeAfeta.cursoAfeto.questionario.state = :sP2 " + |
")" + |
(onlyNotAnswered? " AND rR.resposta is null " : "" ) + |
"GROUP BY u.id"); |
q.setString("sP1",QuestionarioImpl.State.PROCESSING.name()); |
q.setString("sP2",QuestionarioImpl.State.PROCESSING_WITH_ANSWERS.name()); |
List<Object> results = (List<Object>) q.list(); |
for(Object result: results) |
{ |
findUsersResult.userIds.add((Long) result); |
} |
findUsersResult.users = results.size(); |
return findUsersResult; |
} |
public static class QuestionarioStatsVars |
{ |
public long cursos; |
247,6 → 304,7 |
public long profsTimeStudents; |
public long respostasRequisitadas; |
public long respostasObtidas; |
public long alunosQueResponderam; |
} |
288,6 → 346,7 |
questionarioStatsVars.profsDeUsadas = (Long) results[6]; |
questionarioStatsVars.tipologiasUsadas = (Long) results[7]; |
questionarioStatsVars.profsTimeStudents = (Long) results[8]; |
questionarioStatsVars.alunosQueResponderam = getNumeroAlunosComRespostas(questionarioId); |
questionarioStatsVars.respostasRequisitadas = getNumeroRespostasRequisitadas(questionarioId); |
questionarioStatsVars.respostasObtidas = getNumeroRespostas(questionarioId); |
questionarioStatsVars.unidadesUsadas = getNumeroUnidadesUsadas(questionarioId); |
/branches/v3/impl/src/java/pt/estgp/estgweb/domain/dao/impl/QuestionarioPedagogicoCursoAfetoDaoImpl.java |
---|
128,5 → 128,23 |
return 0; |
} |
public long countAlunos(long cursoAfetoId) |
{ |
Query q = AbstractDao.getCurrentSession().createQuery("SELECT " + |
" count(distinct a.aluno.id) AS respostasAlunos " + |
"from " + QuestionarioPedagogicoCursoAfeto.class.getName() + " c " + |
"JOIN c.unidadesAfetas u " + |
"JOIN u.tipologiasRequisitadas t " + |
"JOIN t.alunosRequisitados a " + |
"JOIN a.respostaRequisitada rR " + |
"WHERE c.id = :id "); |
q.setLong("id",cursoAfetoId); |
Object result = q.uniqueResult(); |
if(result != null) |
return (Long) result; |
return 0; |
} |
} |
/branches/v3/impl/src/java/pt/estgp/estgweb/web/controllers/questionarios/QuestionarioController.java |
---|
334,6 → 334,30 |
public ActionForward sendEmailQuestionariosProcessing(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable |
{ |
QuestionarioMessage frm = (QuestionarioMessage) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = {"onlyNotAnswered","id","msg","emailFrom","personFrom","subject"}; |
Object[] args = { |
frm.isOnlyNotAnswered(), |
frm.getMessage(), |
frm.getFromEmail(), |
frm.getFromPerson(), |
frm.getSubject() |
}; |
int size = (Integer) sm.execute(RequestUtils.getRequester(request, response),"QuestionarioSendMessageAllProcessing",args,names); |
addMessage(request,"submit.todo.message.success","" + size); |
return mapping.findForward("seeAll"); |
} |
} |
/branches/v3/impl/src/doc/estgweb.eap |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/branches/v3/impl/src/doc/BacoV32016/linuxInstall/How To Set Up Master Slave Replication in MySQL _ DigitalOcean_files.zip |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/branches/v3/impl/src/doc/BacoV32016/linuxInstall/mysql/mysqlreplication.txt |
---|
New file |
0,0 → 1,108 |
#PARA MYSQL SLAVE JA EM FUNCIONAMENTO COM BASE EM UM MASTER E FUNCIONANDO COM FICHEIROS |
STOP SLAVE; |
SET GLOBAL master_info_repository = 'TABLE'; |
SET GLOBAL relay_log_info_repository = 'TABLE'; |
depois alterar no my.conf na parte do mysqld para isto |
[mysqld] |
master-info-repository=TABLE |
relay-log-info-repository=TABLE |
##################################### |
SERVER EXEMPLO: 172.20.100.141 |
SLAVE EXEMPLO: 172.20.100.20 |
NO MASTER QUE VAI SER REPLICADO |
sudo apt-get install mysql-server mysql-client |
sudo nano /etc/mysql/my.cnf |
#comentar a linha assim: |
#bind-address = 127.0.0.1 |
#procurar a linha server-id e colocar assim: |
server-id = 1 |
#definir o log file e a base de dados que poderá ser replicada: |
log_bin = /var/log/mysql/mysql-bin.log |
binlog_do_db = pae |
#Como temos trasaction ISOLATION READ_COMMITED |
#adicionat a linha |
binlog_format=row |
#reiniciar tomcat |
/etc/init.d/mysql restart |
#AGORA ENTRAMOS NO MYSQL |
mysql -u root |
#GARANTIR DIREITOS DE REPLICACAO AO SLAVE |
GRANT REPLICATION SLAVE ON *.* TO 'baco'@'172.20.100.20' IDENTIFIED BY 'baco1232008estg'; |
FLUSH PRIVILEGES; |
#FAZER DUMP DA BASE DE DADOS |
mysql> \u pae |
Reading table information for completion of table and column names |
You can turn off this feature to get a quicker startup with -A |
Database changed |
mysql> FLUSH TABLES WITH READ LOCK; |
Query OK, 0 rows affected (0.00 sec) |
mysql> SHOW MASTER STATUS; |
+------------------+----------+--------------+------------------+ |
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | |
+------------------+----------+--------------+------------------+ |
| mysql-bin.000001 | 107 | pae | | |
+------------------+----------+--------------+------------------+ |
1 row in set (0.00 sec) |
mysql> UNLOCK TABLES; |
ENTRAR EM NOVO TERMNAL SEM MECHER NESTE |
mysqldump -u root -p --opt pae > pae-para-slave.sql |
#NO MYSQL |
UNLOCK TABLES; |
QUIT; |
#COPIAR O FICHEIRO PARA O SLAVE 172.20.100.20 |
#SE FOR EM LINUX FAZER ASSIM EXEMPLO que copia para a pasta onde estamos que é o ".": |
scp jmachado@pae.ipportalegre.pt:/home/jmachado/pae-para-slave.sql . |
#entrar no mysql do salve |
create database pae; |
#sair |
quit |
#carregar base de dados |
mysql -uroot -pbaco1232008estg pae < pae-para-slave.sql |
elay-log = /var/log/mysql/mysql-relay-bin.log |
log_bin = /var/log/mysql/mysql-bin.log |
binlog_do_db = newdatabase |
sudo service mysql restart |
The next step is to enable the replication from within the MySQL shell. |
Open up the the MySQL shell once again and type in the following details, replacing the values to match your information: |
CHANGE MASTER TO MASTER_HOST='172.20.100.141',MASTER_USER='baco', MASTER_PASSWORD='baco1232008estg', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS= 107; |
START SLAVE; |
SHOW SLAVE STATUS |
/branches/v3/impl/src/web/admin/profile/profilePersonalData.jsp |
---|
352,7 → 352,7 |
<html:text styleClass="readOnly form-control" property="birthDayDate" maxlength="100"/> |
</baco:isAdmin> |
<baco:isNotAdmin> |
<<html:text styleClass="readOnly form-control" property="birthDayDate" maxlength="100" readonly="true"/> |
<html:text styleClass="readOnly form-control" property="birthDayDate" maxlength="100" readonly="true"/> |
</baco:isNotAdmin> |
</div> |
371,7 → 371,7 |
<div class="form-group"> |
<label class="control-label col-sm-2" ><bean:message key="address"/></label> |
<div class="col-sm-10"> |
<html:text property="userView.address" maxlength="250" /> |
<html:text styleClass="form-control" property="userView.address" maxlength="250" /> |
</div> |
</div> |
<div class="form-group"> |
/branches/v3/impl/src/web/layout/themes/estg/separators.jsp |
---|
126,13 → 126,13 |
</html:link> |
</li> |
</baco:isAdmin> |
<baco:isNotAdmin> |
<%-- <baco:isNotAdmin> |
<li> |
<html:link action="/user/homePae"> |
<span class="glyphicon glyphicon-log-out"></span> MODO PAE |
</html:link> |
</li> |
</baco:isNotAdmin> |
</baco:isNotAdmin>--%> |
<li> |
<a href="<%=request.getContextPath()%><%=Globals.SYSTEM_REDIRECTIONS_POLICY_AUTHENTICATION_LOGOUT_ACTION%>"> |
<span class="glyphicon glyphicon-log-out"></span> <bean:message key="logout"/> |
/branches/v3/impl/src/web/public/announcements/announcementsPortalLeft.jsp |
---|
69,12 → 69,12 |
if (item.getSmallImage() != null) |
{ |
%> |
<img src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"> |
<img style="max-width: 100%;" src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"> |
<%} |
else if (item.getBigImage() != null) |
{ |
%> |
<img src="<%=request.getContextPath()%>/imageStream/<%=item.getBigImage().getId()%>"> |
<img style="max-width: 100%;" src="<%=request.getContextPath()%>/imageStream/<%=item.getBigImage().getId()%>"> |
<% |
} |
%> |
/branches/v3/impl/src/web/user/home/todos.jsp |
---|
30,128 → 30,131 |
Object[] args = new Object[]{}; |
List<IToDoCat> todos = (List<IToDoCat>) sm.execute(RequestUtils.getRequester(request, response), "CommonServicesGetAllTodosCat", args, names); |
%> |
<!--TODOS SIZE: <%=todos.size()%>--> |
<% |
if (todos != null && todos.size() > 0) |
{ |
%> |
<div class="row"> |
<div class="col-md-12 col-sm-12 col-xs-12"> |
<div class="panel panel-primary"> |
<div class="panel-heading"><bean:message key="intranet.todo"/></div> |
<div class="panel-body"> |
<div class="panel panel-primary"> |
<div class="panel-heading"><bean:message key="intranet.todo"/></div> |
<div class="panel-body"> |
<% |
if (todos == null || todos.size() == 0) |
{ |
%> |
<div class="zerofound"> |
<bean:message key="todo.zero.todos"/> |
</div> |
<% |
} |
else |
{ |
%> |
<% |
for (IToDoCat toDoCat : todos) |
{ |
String imgClose; |
String imgOpen; |
String style; |
String img; |
String styleClass; |
// Duarte Santos |
if (toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Surveys.getMessageKey())) |
{ |
styleClass = "WARNING"; |
img = "/imgs/openedboxNeg.gif"; |
style = ""; |
imgClose = "/imgs/closedboxNeg.gif"; |
imgOpen = "/imgs/openedboxNeg.gif"; |
<% |
for (IToDoCat toDoCat : todos) |
{ |
String imgClose; |
String imgOpen; |
String style; |
String img; |
String styleClass; |
// Duarte Santos |
if (toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Surveys.getMessageKey())) |
{ |
styleClass = "WARNING"; |
img = "/imgs/openedboxNeg.gif"; |
style = ""; |
imgClose = "/imgs/closedboxNeg.gif"; |
imgOpen = "/imgs/openedboxNeg.gif"; |
} |
//Filipe Matos |
else |
if(toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Assessments.getMessageKey())){ |
} |
//Filipe Matos |
else |
if(toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Assessments.getMessageKey())){ |
styleClass = "WARNING"; |
img = "/imgs/openedboxNeg.gif"; |
style = ""; |
imgClose = "/imgs/closedboxNeg.gif"; |
imgOpen = "/imgs/openedboxNeg.gif"; |
} |
else |
if (toDoCat.getDescription().equals(ModuleEnum.Reminders.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.CourseUnits.getMessageKey())) |
{ |
styleClass = ""; |
img = "/imgs/openedbox.gif"; |
style = ""; |
imgClose = "/imgs/closedbox.gif"; |
imgOpen = "/imgs/openedbox.gif"; |
} |
else |
{ |
styleClass = ""; |
img = "/imgs/closedbox.gif"; |
style = Globals.HIDDEN; |
imgClose = "/imgs/closedbox.gif"; |
imgOpen = "/imgs/openedbox.gif"; |
} |
%> |
styleClass = "WARNING"; |
img = "/imgs/openedboxNeg.gif"; |
style = ""; |
imgClose = "/imgs/closedboxNeg.gif"; |
imgOpen = "/imgs/openedboxNeg.gif"; |
} |
else |
if (toDoCat.getDescription().equals(ModuleEnum.Reminders.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.CourseUnits.getMessageKey())) |
{ |
styleClass = ""; |
img = "/imgs/openedbox.gif"; |
style = ""; |
imgClose = "/imgs/closedbox.gif"; |
imgOpen = "/imgs/openedbox.gif"; |
} |
else |
{ |
styleClass = ""; |
img = "/imgs/closedbox.gif"; |
style = Globals.HIDDEN; |
imgClose = "/imgs/closedbox.gif"; |
imgOpen = "/imgs/openedbox.gif"; |
} |
%> |
<div class="panel-body-h1 <%=styleClass%>"> |
<%=MessageResources.getMessage(request, toDoCat.getDescription())%> (<%=toDoCat.getTotalToDo()%>) <img alt="abrir" src="<%=request.getContextPath() + img%>" onclick="this.src=showOrHide('<%=toDoCat.getDescription()%>','<%=request.getContextPath() + imgClose%>','<%=request.getContextPath() + imgOpen%>')" > |
</div> |
<div class="list-group"> |
<div class="list-group-item list-group-item-warning"><%=MessageResources.getMessage(request, toDoCat.getDescription())%> (<%=toDoCat.getTotalToDo()%>)</div> |
<ul id="<%=toDoCat.getDescription()%>" style="<%=style%>"> |
<% |
for (IToDo todo : toDoCat.getAllToDos()) |
{ |
if (todo.getUrl() != null) |
{ |
%> |
<li> |
<a href="<%=request.getContextPath() + todo.getUrl()%>"> |
<font class="<%=styleClass%>"> |
<% |
if(todo.getCatArg0() == null && todo.getCatKey() != null) |
<%--<ul id="<%=toDoCat.getDescription()%>" style="<%=style%>">--%> |
<% |
for (IToDo todo : toDoCat.getAllToDos()) |
{ |
if (todo.getUrl() != null) |
{ |
out.print(MessageResources.getMessage(request,todo.getCatKey()) + ":"); |
} |
else if(todo.getCatArg0() != null && todo.getCatKey() != null) |
{ |
out.print(MessageResources.getMessage(request,todo.getCatKey(),todo.getCatArg0()) + ":"); |
} |
%> |
<div class="list-group-item"> |
%> |
<a href="<%=request.getContextPath() + todo.getUrl()%>"> |
<% |
if(todo.getCatArg0() == null && todo.getCatKey() != null) |
{ |
out.print(MessageResources.getMessage(request,todo.getCatKey()) + ":"); |
} |
else if(todo.getCatArg0() != null && todo.getCatKey() != null) |
{ |
out.print(MessageResources.getMessage(request,todo.getCatKey(),todo.getCatArg0()) + ":"); |
} |
%> |
<%=todo.getDescription()%> |
<img src="<%=request.getContextPath()%>/imgs/preencher.gif" width="35px"/> |
</a> |
</div> |
<% |
} |
else |
{ |
%> |
<div class="list-group-item"> |
<%=todo.getLabelInsideCat(request)%> |
</font> |
</a> |
</div> |
<% |
} |
} |
%> |
</li> |
</div> |
<% |
} |
else |
{ |
%> |
<li> |
<%=todo.getLabelInsideCat(request)%> |
</li> |
<% |
} |
} |
%> |
</ul> |
<% |
} |
%> |
<% |
} |
%> |
</div> |
</div> |
</div> |
</div> |
<% |
} |
%> |
/branches/v3/impl/src/web/user/home/student.jsp |
---|
50,6 → 50,9 |
<bean:message key="profile.bad.profile.student.iregular.user.class"/> |
</div> |
</logic:notMatch> |
<jsp:include page="todos.jsp"/> |
<div class="row"> |
<div class="col-md-6 col-sm-12 col-xs-12"> |
180,8 → 183,6 |
<baco:isModuleOn module="courseunits"> |
<jsp:include page="/user/home/courseUnitsAnnouncements.jsp"/> |
</baco:isModuleOn> |
<baco:isModuleOn module="todos"> |
<jsp:include page="/user/home/todos.jsp"/> |
</baco:isModuleOn> |
</div> |
</div> |
/branches/v3/impl/src/web/user/home/todosAfazer.jsp |
---|
72,7 → 72,7 |
out.print(MessageResources.getMessage(request,todo.getCatKey(),todo.getCatArg0()) + ":"); |
} |
%> |
<%=todo.getLabelInsideCat(request)%> |
<%=todo.getDescription()%> |
</a> |
<img src="<%=request.getContextPath()%>/imgs/preencher.gif" width="35px"/> |
<% |
/branches/v3/impl/src/web/user/questionarios/docs/REPORT_DOCENTE_1.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/branches/v3/impl/src/web/user/questionarios/docs/ApresentacaoPedagogico.ppt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/branches/v3/impl/src/web/user/questionarios/docs/REPORT_DOCENTE_EXEMPLO.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/branches/v3/impl/src/web/user/questionarios/docs/OLAPQuestionarios.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/branches/v3/impl/src/web/user/questionarios/questionariosSee.jsp |
---|
3,6 → 3,7 |
<%@ page import="pt.estgp.estgweb.domain.QuestionarioImpl" %> |
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
<%@ page import="java.util.List" %> |
<%@ page import="java.net.URLEncoder" %> |
<%@ 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" %> |
22,9 → 23,15 |
<div class="panel panel-primary"> |
<div class="panel-heading clearfix"> |
Questionários |
<baco:hasRole role="questionarios.admin,all,admin"> |
<html:link styleClass="btn btn-default btn-sm pull-right" action="/user/startNewQuestionario">Criar Novo <span class="glyphicon glyphicon-plus"> </span></html:link> |
</baco:hasRole> |
<% |
String desc = URLEncoder.encode("Mensagem para os alunos de todos os Questionários em Processamento","ISO-8859-1"); |
request.setAttribute("desc",desc); |
%> |
<html:link styleClass="btn btn-default pull-right" action="/user/startQuestionariosPaeMessagePedagogico.do?&formDescription=${desc}&targetDispatch=sendEmailQuestionariosProcessing"> |
<span class="glyphicon glyphicon-envelope"> </span> Enviar Mensagem A Todos Os Inquiridos |
</html:link> |
<a class="btn btn-default" href="#" data-toggle="modal" data-target="#modalHelpQuestionario"> |
<span class="glyphicon glyphicon-question-sign"></span> Ajuda sobre Processo dos Questionários |
</a> |
/branches/v3/impl/src/web/user/questionarios/headerQuestionarios.jsp |
---|
6,6 → 6,55 |
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
<%@ taglib prefix="baco" uri="http://www.estgp.pt/baco/" %> |
<style> |
.imgsmall |
{ |
width: 100px; |
align-self: center; |
} |
.imgtoogle { cursor:zoom-in; } |
.imgtoogle:-webkit-full-screen { cursor:zoom-out; } |
.imgtoogle:-moz-full-screen { cursor:zoom-out; } |
.imgtoogle:-ms-fullscreen { cursor:zoom-out; } |
.imgtoogle:fullscreen { cursor:zoom-out; } |
</style> |
<script> |
$(document).ready(function(){ |
$('.imgsmall').click( function() { |
$(this).removeClass("imgsmall"); |
toggleFullscreen(this); |
}); |
}); |
function toggleFullscreen(elem) { |
elem = elem || document.documentElement; |
if (!document.fullscreenElement && !document.mozFullScreenElement && |
!document.webkitFullscreenElement && !document.msFullscreenElement) { |
if (elem.requestFullscreen) { |
elem.requestFullscreen(); |
} else if (elem.msRequestFullscreen) { |
elem.msRequestFullscreen(); |
} else if (elem.mozRequestFullScreen) { |
elem.mozRequestFullScreen(); |
} else if (elem.webkitRequestFullscreen) { |
elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); |
} |
} else { |
if (document.exitFullscreen) { |
document.exitFullscreen(); |
} else if (document.msExitFullscreen) { |
document.msExitFullscreen(); |
} else if (document.mozCancelFullScreen) { |
document.mozCancelFullScreen(); |
} else if (document.webkitExitFullscreen) { |
document.webkitExitFullscreen(); |
} |
$(elem).addClass("imgsmall"); |
} |
} |
</script> |
<div class="modal fade" id="modalHelpQuestionario" role="dialog" > |
<div class="modal-dialog" data-width="960" style="display: block; width: 960px; margin-top: 50px;" aria-hidden="false"> |
18,23 → 67,38 |
<div class="modal-body"> |
<div class="panel panel-default"> |
<baco:isAdmin> |
<h3>Questões relativas a papeis e permissões</h3> |
<ul> |
<li>Para aceder ao painel de ferramentas dos questionarios tem de ser administrador (admin ou questionarios.admin) ou ter o papel de Questionários Básicas (questionarios.gerais) ou services</li> |
<li>Uma atividade só fica disponivel se o estado do questionário estiver na posição onde a tarefa é possivel de executar</li> |
<li>Administradores de Questionários (questionarios.admin) ou de Sistema (admin) têm permissões totais no Módulo</li> |
<li>Administradores de Questionários (questionarios.admin) Validação (questionarios.atribuicoes.admin, questionarios.atribuicoes.check_teachers) de Atribuições podem validar as unidades quanto aos alunos e docentes afetados</li> |
<li>Professores, Membros das Comissões e Pedagógico terão acesso às respostas na sua Home Page numa página especialmente concebida para o efeito</li> |
</ul> |
<h3>Modelo de Dados</h3> |
<img src="<%=request.getContextPath()%>/user/questionarios/QuestionariosDomain.bmp" width="100%"> |
</baco:isAdmin> |
<h3>Modelo de Atividades</h3> |
<img src="<%=request.getContextPath()%>/user/questionarios/QuestionarioProcesso.bmp" width="90%"/> |
<div class="panel-body"> |
<baco:isAdmin> |
<h3 class="well">Questões relativas a papeis e permissões</h3> |
<ul> |
<li>Para aceder ao painel de ferramentas dos questionarios tem de ser administrador (admin ou questionarios.admin) ou ter o papel de Questionários Básicas (questionarios.gerais) ou services</li> |
<li>Uma atividade só fica disponivel se o estado do questionário estiver na posição onde a tarefa é possivel de executar</li> |
<li>Administradores de Questionários (questionarios.admin) ou de Sistema (admin) têm permissões totais no Módulo</li> |
<li>Administradores de Questionários (questionarios.admin) Validação (questionarios.atribuicoes.admin, questionarios.atribuicoes.check_teachers) de Atribuições podem validar as unidades quanto aos alunos e docentes afetados</li> |
<li>Professores, Membros das Comissões e Pedagógico terão acesso às respostas na sua Home Page numa página especialmente concebida para o efeito</li> |
</ul> |
<h3 class="well well-sm">Modelo de Dados</h3> |
<img class="imgtoogle imgsmall" src="<%=request.getContextPath()%>/user/questionarios/QuestionariosDomain.bmp" width="100%"> |
</baco:isAdmin> |
<h3>Modelo de Estados</h3> |
<img src="<%=request.getContextPath()%>/user/questionarios/QuestionarioState.bmp" width="90%"/> |
<h2 class="well">Documentação partilhada para utilizadores privilegiados do sistema de Questionários</h2> |
<h3 class="well well-sm">Modelo de Relatório Exemplo Para Estudo</h3> |
<a target="_blank" href="<%=request.getContextPath()%>/user/questionarios/docs/REPORT_DOCENTE_EXEMPLO.pdf"><img class="imgsmall" src="<%=request.getContextPath()%>/user/questionarios/docs/REPORT_DOCENTE_1.png"/></a> |
<h3 class="well well-sm">Modelo de Atividades</h3> |
<img class="imgtoogle imgsmall" src="<%=request.getContextPath()%>/user/questionarios/QuestionarioProcesso.bmp" width="90%"/> |
<h3 class="well well-sm">Modelo de Estados</h3> |
<img class="imgtoogle imgsmall" src="<%=request.getContextPath()%>/user/questionarios/QuestionarioState.bmp" width="90%"/> |
<h3 class="well well-sm">Dimensões para Resultados</h3> |
<img class="imgtoogle imgsmall" src="<%=request.getContextPath()%>/user/questionarios/docs/OLAPQuestionarios.bmp" width="90%"/> |
<h3 class="well well-sm">Apresentação</h3> |
<a target="_blank" href="<%=request.getContextPath()%>/user/questionarios/docs/ApresentacaoPedagogico.ppt">Apresentação PAE</a> |
</div> |
</div> |
<button type="button" class="btn btn-success" data-dismiss="modal">Voltar</button> |
/branches/v3/impl/src/web/user/questionarios/pedagogicoEstudante/questionariosDocenteAbertos.jsp |
---|
11,7 → 11,8 |
Query q = AbstractDao.getCurrentSession().createQuery( |
"select t from t in class " + QuestionarioPedagogicoTipologiaRequisitada.class.getName() + |
" where t.docenteAfeto.id = " + UserSession.getUser().getId() + " and " + |
" JOIN t.unidadeAfeta ua " + |
" where ua.usar = true and t.docenteAfeto.id = " + UserSession.getUser().getId() + " and " + |
" (t.unidadeAfeta.cursoAfeto.questionario.state = :s1 OR t.unidadeAfeta.cursoAfeto.questionario.state = :s2)" |
); |
q.setString("s1","PROCESSING_WITH_ANSWERS"); |
77,13 → 78,13 |
if(tipologiaRequisitada.getUnidadeAfeta().getCursoAfeto() == cursoAfeto) |
{ |
%> |
<div class="list-group-item clearfix" > |
<% |
Query qRespondidos = AbstractDao.getCurrentSession().createQuery("" + |
"select count(distinct r.id) from t in class " + QuestionarioPedagogicoTipologiaRequisitada.class.getName() + " " + |
96,18 → 97,24 |
//List e = qRespondidos.list(); |
Object respondidos = qRespondidos.uniqueResult(); |
if(tipologiaRequisitada.getAlunosRequisitados().size() > 0) |
{ |
%> |
<label class="label label-pill <%=respondidos == null ? "label-warning" : "label-success"%>" style="font-size: 1em"><%=respondidos == null ? 0 : ((Long)respondidos)%></label> |
respondidos de |
<label class="label label-pill label-info" style="font-size: 1em"><%=tipologiaRequisitada.getAlunosRequisitados().size()%></label> |
<div class="list-group-item clearfix" > |
<label class="label label-pill <%=respondidos == null ? "label-warning" : "label-success"%>" style="font-size: 1em"><%=respondidos == null ? 0 : ((Long)respondidos)%></label> |
respondidos de |
<label class="label label-pill label-info" style="font-size: 1em"><%=tipologiaRequisitada.getAlunosRequisitados().size()%></label> |
<span style="margin-left: 10px" class="glyphicon glyphicon-arrow-right"> </span> |
<span style="margin-left: 10px" class="glyphicon glyphicon-arrow-right"> </span> |
<label class="bg-info " style="padding: 2px"><%=tipologiaRequisitada.getUnidadeAfeta().getNome()%></label> |
(<%=tipologiaRequisitada.getUnidadeAfeta().getCodigoUnidade()%>) |
<label class="badge badge-info"><%=tipologiaRequisitada.getDsTipologia()%></label> |
</div> |
<label class="bg-info " style="padding: 2px"><%=tipologiaRequisitada.getUnidadeAfeta().getNome()%></label> |
(<%=tipologiaRequisitada.getUnidadeAfeta().getCodigoUnidade()%>) |
<label class="bg-primary " style="padding: 2px"><%=tipologiaRequisitada.getCdTurma()%></label> |
<label class="badge badge-info"><%=tipologiaRequisitada.getDsTipologia()%></label> |
</div> |
<% |
} |
} |
} |
%> |
/branches/v3/impl/src/web/user/questionarios/pedagogicoEstudante/questionarioDashBoard.jsp |
---|
85,11 → 85,13 |
<th>Unidades Não Selecionadas</th> |
<th>Unidades Selecionadas</th> |
<th>Turmas Selecionadas</th> |
<th>Alunos com Resposta %</th> |
<th>Alunos com Resposta</th> |
<th>Alunos Selecionados</th> |
<th>Professores Selecionados</th> |
<th>Tipologias Selecionadas</th> |
<th>Respostas %</th> |
<th>Respostas</th> |
<th>Por Responder</th> |
<th>Respostas Requisitadas</th> |
</thead> |
99,11 → 101,53 |
<td><%=questionarioStatsVars.unidades - questionarioStatsVars.unidadesUsadas%></td> |
<td><%=questionarioStatsVars.unidadesUsadas%></td> |
<td><%=questionarioStatsVars.turmas%></td> |
<td> |
<% |
int percentage = (int) (questionarioStatsVars.alunosQueResponderam/questionarioStatsVars.alunosDeUsadas); |
String percentageColor = "danger"; |
if(percentage < 20) |
percentageColor = "danger"; |
else if(percentage < 40) |
percentageColor = "warning"; |
else if(percentage < 60) |
percentageColor = "info"; |
else |
percentageColor = "success"; |
%> |
<div class="progress"> |
<div class="progress-bar progress-bar-<%=percentageColor%>" role="progressbar" aria-valuenow="<%=percentage%>" |
aria-valuemin="0" aria-valuemax="100" style="width:<%=percentage%>%"> |
<%=percentage%>% |
</div> |
</div> |
</td> |
<td><label class="label label-<%=percentageColor%>" style="font-size: 1em"><%=questionarioStatsVars.alunosQueResponderam%></label></td> |
<td><%=questionarioStatsVars.alunosDeUsadas%></td> |
<td><%=questionarioStatsVars.profsDeUsadas%></td> |
<td><%=questionarioStatsVars.tipologiasUsadas%></td> |
<td><label class="label label-success" style="font-size: 1em"><%=questionarioStatsVars.respostasObtidas%></label></td> |
<td><label class="label label-danger" style="font-size: 1em"><%=(questionarioStatsVars.respostasRequisitadas-questionarioStatsVars.respostasObtidas)%></label></td> |
<td> |
<% |
percentage = (int) (questionarioStatsVars.respostasObtidas/questionarioStatsVars.respostasRequisitadas); |
percentageColor = "danger"; |
if(percentage < 20) |
percentageColor = "danger"; |
else if(percentage < 40) |
percentageColor = "warning"; |
else if(percentage < 60) |
percentageColor = "info"; |
else |
percentageColor = "success"; |
%> |
<div class="progress"> |
<div class="progress-bar progress-bar-<%=percentageColor%>" role="progressbar" aria-valuenow="<%=percentage%>" |
aria-valuemin="0" aria-valuemax="100" style="width:<%=percentage%>%"> |
<%=percentage%>% |
</div> |
</div> |
</td> |
<td><label class="label label-<%=percentageColor%>" style="font-size: 1em"><%=questionarioStatsVars.respostasObtidas%></label></td> |
<td><label class="label label-info" style="font-size: 1em"><%=questionarioStatsVars.respostasRequisitadas%></label></td> |
</tbody> |
116,9 → 160,11 |
<th>Código</th> |
<th>Curso</th> |
<th>Unidades</th> |
<th>% Alunos</th> |
<th>Alunos com resposta</th> |
<th>Alunos</th> |
<th>% Respostas</th> |
<th>Respostas</th> |
<th>Por Responder</th> |
<th>Total</th> |
<th></th> |
</thead> |
130,7 → 176,15 |
QuestionarioPedagogicoCursoAfeto cursoAfeto = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().load(cursoId); |
long respostasCurso = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().countRespostas(cursoId); |
long alunosComRespostasCurso = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().countAlunosComRespostas(cursoId); |
long alunosTotalCurso = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().countAlunos(cursoId); |
if(alunosTotalCurso == 0) |
alunosTotalCurso = 1; |
if(alunosTotalCurso == 0) |
alunosTotalCurso = 1; |
request.setAttribute("cursoAfeto",cursoAfeto); |
if(cursoAfeto.getStatRespostasRequisitadas() > 0) |
{ |
%> |
<tr> |
<td><%=cursoAfeto.getNomeInstituicao()%></td> |
142,9 → 196,52 |
</a> |
</td> |
<td><label class="label <%=alunosComRespostasCurso > 0 ? "label-success":"label-warning"%>" style="font-size: 1em"><%=alunosComRespostasCurso%></label></td> |
<td><label class="label <%=respostasCurso > 0 ? "label-success":"label-warning"%>" style="font-size: 1em"><%=respostasCurso%></label></td> |
<td><label class="label label-danger" style="font-size: 1em"><%=cursoAfeto.getStatRespostasRequisitadas() - respostasCurso%></label></td> |
<td> |
<% |
percentage = (int) (alunosComRespostasCurso/alunosTotalCurso); |
percentageColor = "danger"; |
if(percentage < 20) |
percentageColor = "danger"; |
else if(percentage < 40) |
percentageColor = "warning"; |
else if(percentage < 60) |
percentageColor = "info"; |
else |
percentageColor = "success"; |
%> |
<div class="progress"> |
<div class="progress-bar progress-bar-<%=percentageColor%>" role="progressbar" aria-valuenow="<%=percentage%>" |
aria-valuemin="0" aria-valuemax="100" style="width:<%=percentage%>%"> |
<%=percentage%>% |
</div> |
</div> |
</td> |
<td><label class="label label-<%=percentageColor%>" style="font-size: 1em"><%=alunosComRespostasCurso%></label></td> |
<td><label class="label label-info" style="font-size: 1em"><%=alunosTotalCurso%></label></td> |
<td> |
<% |
percentage = (int) (respostasCurso/cursoAfeto.getStatRespostasRequisitadas()); |
percentageColor = "danger"; |
if(percentage < 20) |
percentageColor = "danger"; |
else if(percentage < 40) |
percentageColor = "warning"; |
else if(percentage < 60) |
percentageColor = "info"; |
else |
percentageColor = "success"; |
%> |
<div class="progress"> |
<div class="progress-bar progress-bar-<%=percentageColor%>" role="progressbar" aria-valuenow="<%=percentage%>" |
aria-valuemin="0" aria-valuemax="100" style="width:<%=percentage%>%"> |
<%=percentage%>% |
</div> |
</div> |
</td> |
<td><label class="label label-<%=percentageColor%>" style="font-size: 1em"><%=respostasCurso%></label></td> |
<td><label class="label label-info" style="font-size: 1em"><%=cursoAfeto.getStatRespostasRequisitadas()%></label></td> |
<td> |
<% |
157,6 → 254,7 |
</td> |
</tr> |
<% |
} |
} |
AbstractDao.getCurrentSession().getTransaction().commit(); |
%> |
/branches/v3/impl/src/web/user/questionarios/pedagogicoEstudante/respostasRequisitadas.jsp |
---|
83,10 → 83,12 |
%> |
<div class="list-group-item clearfix" > |
<a href="<%=request.getContextPath()%>/user/startRespostaQuestionario.do?alunoRequisitadoId=<%=alunoRequisitado.getId()%>"> |
<label class="bg-info" style="padding: 2px"> |
<a href="<%=request.getContextPath()%>/user/startRespostaQuestionario.do?alunoRequisitadoId=<%=alunoRequisitado.getId()%>"> |
<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getNome()%> |
(<%=alunoRequisitado.getTipologiaRequisitada().getUnidadeAfeta().getCodigoUnidade()%>) |
</a> |
</a> |
</label> |
<label class="label label-pill label-info" style="font-size: 1em"><%=alunoRequisitado.getTipologiaRequisitada().getNomeDocente()%></label> |
<label class="badge badge-info"><%=alunoRequisitado.getTipologiaRequisitada().getDsTipologia()%></label> |
</div> |
/branches/v3/impl/src/web/user/questionarios/pedagogicoEstudante/topnavQuestionarioPedagogicoSendMessage.jsp |
---|
15,7 → 15,7 |
qId = "" + questionarioMessage.getQuestionarioId(); |
} |
} |
Long questionarioId = Long.parseLong(qId); |
Long questionarioId = qId != null ? Long.parseLong(qId) : 0; |
/* |
IServiceManager sm = ServiceManager.getInstance(); |
27,7 → 27,9 |
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request); |
topNav.addNavPlace("/user/homePae.do", "intranet.separator.home.back"); |
topNav.addNavPlace("/user/seeQuestionarios.do", "surveys"); |
topNav.addNavPlace("/user/seeQuestionario.do?questionarioId=" + questionarioId, "survey.see",""+questionarioId); |
if(questionarioId > 0) |
topNav.addNavPlace("/user/seeQuestionario.do?questionarioId=" + questionarioId, "survey.see",""+questionarioId); |
topNav.addNavPlace(null, "questionario.send.message.top.nav"); |
%> |
<jsp:include page="/layout/topnav.jsp"/> |
/branches/v3/impl/build.properties |
---|
40,6 → 40,7 |
authentication.policy.service=Authenticate |
authentication.policy.username.msg.key=username |
authentication.policy.password.msg.key=password |
system.mail.standard.certificated.home.page=/user/home.do |
#mode.pae.enabled=true |
#system.theme=ipp |
169,6 → 170,7 |
email.password=DUMMY_PASSWORD_GMAIL |
email.user.prefix=bacodev |
email.user.sufix=@estgp.pt |
email.user.count=10 |
#email templates |
sms.templates.dir=/template/sms |
250,5 → 252,5 |
test.control.var=false |
admin.email.1=ci@estgp.pt |
admin.email.2=jmachado@estgp.pt |
admin.email.1=jmachado@estgp.pt |
admin.email.2=ci@estgp.pt |
/branches/v3/impl/build.xml |
---|
205,6 → 205,7 |
<include name="**/*.xsl"/> |
</fileset> |
</copy> |
<replace file="${build.dir.war}/css/style.css"> |
<replacefilter token="@contextPath@" value="${tomcat.context.path}"/> |
</replace> |
476,7 → 477,10 |
<replacefilter token="@email.password@" value="${email.password}"/> |
<replacefilter token="@email.user.sufix@" value="${email.user.sufix}"/> |
<replacefilter token="@email.user.count@" value="${email.user.count}"/> |
<replacefilter token="@email.use.round.robin@" value="${email.use.round.robin}"/> |
<replacefilter token="@email.use.security@" value="${email.use.security}"/> |
<replacefilter token="@email.user.prefix@" value="${email.user.prefix}"/> |
<replacefilter token="@email.from@" value="${email.from}"/> |
491,7 → 495,9 |
<replacefilter token="@system.redirections.policy.index.welcome@" value="${system.redirections.policy.index.welcome}"/> |
<replacefilter token="@system.redirections.policy.authentication.action@" value="${system.redirections.policy.authentication.action}"/> |
<replacefilter token="@system.redirections.policy.authentication.logout.action@" value="${system.redirections.policy.authentication.logout.action}"/> |
<replacefilter token="@system.mail.standard.certificated.home.page@" value="${system.mail.standard.certificated.home.page}"/> |
<replacefilter token="@system.intranet.url@" value="${system.intranet.url}"/> |
<replacefilter token="@system.public.url@" value="${system.public.url}"/> |