first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
157
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/AllegatoNews.java
Normal file
157
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/AllegatoNews.java
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class AllegatoNews extends DBAdapter implements Serializable {
|
||||
private long id_allegatoNews;
|
||||
|
||||
private long id_news;
|
||||
|
||||
private long clickThroughAN;
|
||||
|
||||
private String nomeFile;
|
||||
|
||||
private News news;
|
||||
|
||||
public AllegatoNews(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public AllegatoNews() {}
|
||||
|
||||
public void setId_allegatoNews(long newId_allegato) {
|
||||
this.id_allegatoNews = newId_allegato;
|
||||
}
|
||||
|
||||
public void setId_news(long newId_news) {
|
||||
this.id_news = newId_news;
|
||||
setNews(null);
|
||||
}
|
||||
|
||||
public void setNomeFile(String newNomeFile) {
|
||||
this.nomeFile = newNomeFile;
|
||||
}
|
||||
|
||||
public long getId_allegatoNews() {
|
||||
return this.id_allegatoNews;
|
||||
}
|
||||
|
||||
public long getId_news() {
|
||||
return this.id_news;
|
||||
}
|
||||
|
||||
public String getNomeFile() {
|
||||
return (this.nomeFile == null) ? "" : this.nomeFile;
|
||||
}
|
||||
|
||||
public String getNomeFileCompleto() {
|
||||
return getNomeFileCompleto(String.valueOf(getDocBase()) + getNews().getPathAllegato());
|
||||
}
|
||||
|
||||
public String getNomeFileCompleto(String l_path) {
|
||||
return String.valueOf(l_path) + getId_news() + "_" + getNomeFile();
|
||||
}
|
||||
|
||||
public String getNomeFileRel() {
|
||||
return String.valueOf(getParm("NEWS_ATTACH_PATH").getTesto()) + getId_news() + "_" + getNomeFile();
|
||||
}
|
||||
|
||||
public void setNews(News newNews) {
|
||||
this.news = newNews;
|
||||
}
|
||||
|
||||
public News getNews() {
|
||||
this.news = (News)getSecondaryObject(this.news, News.class, getId_news());
|
||||
return this.news;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {
|
||||
new File(getNomeFileCompleto()).delete();
|
||||
}
|
||||
|
||||
public Vectumerator findByCR(AllegatoNewsCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO_NEWS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (!CR.getSearchTxt().trim().isEmpty()) {
|
||||
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
|
||||
StringBuffer txt = new StringBuffer("(");
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator findById_news(long l_id_news, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO_NEWS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_news=" + l_id_news);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public void findByNewsNomeFile(long l_id_news, String l_id_nomeFile) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO_NEWS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_news=" + l_id_news);
|
||||
wc.addWc("A.nomeFile='" + l_id_nomeFile + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getClickThroughAN() {
|
||||
return this.clickThroughAN;
|
||||
}
|
||||
|
||||
public void setClickThroughAN(long clickThroughAN) {
|
||||
this.clickThroughAN = clickThroughAN;
|
||||
}
|
||||
|
||||
public void addClickThrough(String ipAddress, String entryPoint) {
|
||||
try {
|
||||
if (getDBState() == 1)
|
||||
synchronized (this) {
|
||||
setClickThroughAN(getClickThroughAN() + 1L);
|
||||
save();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
|
||||
public class AllegatoNewsCR extends CRAdapter {
|
||||
private long id_allegatoNews;
|
||||
|
||||
private long id_news;
|
||||
|
||||
private String nomeFile;
|
||||
|
||||
private News news;
|
||||
|
||||
public AllegatoNewsCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public AllegatoNewsCR() {}
|
||||
|
||||
public void setId_allegatoNews(long newId_allegato) {
|
||||
this.id_allegatoNews = newId_allegato;
|
||||
}
|
||||
|
||||
public void setId_news(long newId_news) {
|
||||
this.id_news = newId_news;
|
||||
setNews(null);
|
||||
}
|
||||
|
||||
public void setNomeFile(String newNomeFile) {
|
||||
this.nomeFile = newNomeFile;
|
||||
}
|
||||
|
||||
public long getId_allegatoNews() {
|
||||
return this.id_allegatoNews;
|
||||
}
|
||||
|
||||
public long getId_news() {
|
||||
return this.id_news;
|
||||
}
|
||||
|
||||
public String getNomeFile() {
|
||||
return (this.nomeFile == null) ? "" : this.nomeFile;
|
||||
}
|
||||
|
||||
public void setNews(News newNews) {
|
||||
this.news = newNews;
|
||||
}
|
||||
|
||||
public News getNews() {
|
||||
this.news = (News)getSecondaryObject(
|
||||
this.news,
|
||||
News.class, getId_news());
|
||||
return this.news;
|
||||
}
|
||||
}
|
||||
486
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/News.java
Normal file
486
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/News.java
Normal file
|
|
@ -0,0 +1,486 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.anag.Users;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.AddImgInterface;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.DBAdapterException;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.mail.MailMessage;
|
||||
import com.ablia.mail.MailProperties;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class News extends DBAdapter implements Serializable, AddImgInterface {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Date dataNews;
|
||||
|
||||
private Date dataFine;
|
||||
|
||||
private Date dataFineVld;
|
||||
|
||||
private Timestamp dataTmstUltAgg;
|
||||
|
||||
private long flgVisibile;
|
||||
|
||||
private long id_news;
|
||||
|
||||
public static final String P_NEWS_ATTACH_PATH = "NEWS_ATTACH_PATH";
|
||||
|
||||
private static final String DEFAULT_NEWS_ATTACH_PATH = "_news/_attach/";
|
||||
|
||||
private static final String P_PATH_MAIL_NEWS = "PATH_MAIL_NEWS";
|
||||
|
||||
private String pathAllegatoOld;
|
||||
|
||||
private long id_tipoNews;
|
||||
|
||||
private TipoNews tipoNews;
|
||||
|
||||
private Date dataInvio;
|
||||
|
||||
private static final String P_NEWS_LANG_DEFAULT = "NEWS_LANG_DEFAULT";
|
||||
|
||||
class ThreadInviaNews extends Thread {
|
||||
private final NewsCR CR;
|
||||
|
||||
public ThreadInviaNews(NewsCR l_CR) {
|
||||
this.CR = l_CR;
|
||||
if (!News.isThreadAttivo()) {
|
||||
News.threadInviaNews = true;
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
long numRecord = 0L;
|
||||
long l_delayMsgEmail = News.this.getParm("CODA_MESSAGGI_EMAIL_DELAY").getNumeroLong() * 1000L;
|
||||
Users users = new Users(this.CR.getApFull());
|
||||
NewsUsers nu = new NewsUsers(this.CR.getApFull());
|
||||
News news = new News(this.CR.getApFull());
|
||||
news.findByPrimaryKey(this.CR.getId_news());
|
||||
ResParm rp = new ResParm(true);
|
||||
Vectumerator<Users> vec;
|
||||
while ((vec = users.findUsersAbilitatiNewsByNews(this.CR.getId_news(), 1, 500)).hasMoreElements()) {
|
||||
while (vec.hasMoreElements()) {
|
||||
numRecord++;
|
||||
Users row = (Users)vec.nextElement();
|
||||
rp = News.inviaMessaggioMail(news, row);
|
||||
if (rp.getStatus()) {
|
||||
rp = nu.addUser(news.getId_news(), row.getId_users(), "");
|
||||
} else {
|
||||
rp = nu.addUser(news.getId_news(), row.getId_users(), rp.getMsg());
|
||||
}
|
||||
if (news.getDataInvio() == null) {
|
||||
news.setDataInvio(News.getToday());
|
||||
news.save();
|
||||
}
|
||||
News.threadInviaNewsMsg = "Attenzione! Thread invio news esecuzione!!! Record processati: " + numRecord;
|
||||
if (vec.hasMoreElements()) {
|
||||
System.out.println("sleep....");
|
||||
if (l_delayMsgEmail != 0L)
|
||||
sleep(l_delayMsgEmail);
|
||||
System.out.println(".. altro messaggio..");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
News.this.handleDebug(e);
|
||||
}
|
||||
News.threadInviaNews = false;
|
||||
System.out.println("Fine invio messaggio ");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean threadInviaNews = false;
|
||||
|
||||
public static String threadInviaNewsMsg = "";
|
||||
|
||||
private static final String DEFAULT_NEWS_IMG_PATH = "_news/_img/";
|
||||
|
||||
public static final String P_NEWS_IMG_PATH = "NEWS_IMG_PATH";
|
||||
|
||||
public static final String LIST_ALLEGATI = "listaAllegatiNews";
|
||||
|
||||
public News() {}
|
||||
|
||||
public News(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator<News> findByCR(NewsCR CR, int pageNumber, int pageRows) throws DBAdapterException, SQLException {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWS AS A ";
|
||||
s_Sql_Find = String.valueOf(s_Sql_Find) + " left JOIN TIPO_NEWS AS C ON A.id_tipoNews = C.id_tipoNews ";
|
||||
String s_Sql_Order = " order by A.dataNews desc";
|
||||
if (CR.getFlgOrderBy() == 0L)
|
||||
s_Sql_Order = " order by A.dataNews ASC";
|
||||
WcString wc = new WcString();
|
||||
if (!CR.getTitolo().isEmpty()) {
|
||||
s_Sql_Find = String.valueOf(s_Sql_Find) + " INNER JOIN DESC_TXT_LANG AS B ON B.tabella = 'NEWS' " +
|
||||
" AND ((B.campo = 'testo' AND B.idTabella = A.id_news and B.lang='it' ) " +
|
||||
" OR (B.campo = 'titolo' AND B.idTabella = A.id_news and B.lang='it' )) ";
|
||||
wc.addWc("B.descrizione like '%" + CR.getTitolo() + "%' ");
|
||||
}
|
||||
if (CR.getFlgVisibile() == 0L) {
|
||||
wc.addWc("(A.flgVisibile is null or A.flgVisibile=0)");
|
||||
} else if (CR.getFlgVisibile() > 0L) {
|
||||
wc.addWc("A.flgVisibile =" + CR.getFlgVisibile());
|
||||
}
|
||||
if (CR.getFlgPubblica() > 0L)
|
||||
wc.addWc("C.flgPubblica=" + CR.getFlgPubblica());
|
||||
if (CR.getId_tipoNews() > 0L)
|
||||
wc.addWc("A.id_tipoNews=" + CR.getId_tipoNews());
|
||||
if (CR.getDataNews() != null)
|
||||
wc.addWc("A.dataNews=?");
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_Order);
|
||||
int crCount = 1;
|
||||
if (CR.getDataNews() != null) {
|
||||
stmt.setDate(crCount, CR.getDataNews());
|
||||
crCount++;
|
||||
}
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
}
|
||||
|
||||
public Date getDataNews() {
|
||||
return this.dataNews;
|
||||
}
|
||||
|
||||
public String getFormattedDataNews() {
|
||||
return getDataFormat().format(this.dataNews);
|
||||
}
|
||||
|
||||
public Date getDataFineVld() {
|
||||
return this.dataFineVld;
|
||||
}
|
||||
|
||||
public Timestamp getDataTmstUltAgg() {
|
||||
return this.dataTmstUltAgg;
|
||||
}
|
||||
|
||||
public long getId_news() {
|
||||
return this.id_news;
|
||||
}
|
||||
|
||||
public void setDataNews(Date newData) {
|
||||
this.dataNews = newData;
|
||||
}
|
||||
|
||||
public void setDataFineVld(Date newDataFineVld) {
|
||||
this.dataFineVld = newDataFineVld;
|
||||
}
|
||||
|
||||
public void setDataTmstUltAgg(Timestamp newDataTmstUltAgg) {
|
||||
this.dataTmstUltAgg = newDataTmstUltAgg;
|
||||
}
|
||||
|
||||
public void setId_news(long newId_news) {
|
||||
this.id_news = newId_news;
|
||||
}
|
||||
|
||||
public void setFlgVisibile(long flgVisibile) {
|
||||
this.flgVisibile = flgVisibile;
|
||||
}
|
||||
|
||||
public long getFlgVisibile() {
|
||||
return this.flgVisibile;
|
||||
}
|
||||
|
||||
public String getVisibile() {
|
||||
return (this.flgVisibile == 1L) ? "Si" : "No";
|
||||
}
|
||||
|
||||
public String getPathAllegato() {
|
||||
return getParm("NEWS_ATTACH_PATH").getTesto();
|
||||
}
|
||||
|
||||
public String getPathAllegatoOld() {
|
||||
return (this.pathAllegatoOld == null) ? "" : this.pathAllegatoOld;
|
||||
}
|
||||
|
||||
public String getNewsAttachPath() {
|
||||
return getParm("NEWS_ATTACH_PATH").getTesto();
|
||||
}
|
||||
|
||||
public ResParm addAllegato(AllegatoNews row) {
|
||||
AllegatoNews bean = new AllegatoNews(getApFull());
|
||||
bean.findByNewsNomeFile(row.getId_news(), row.getNomeFile());
|
||||
if (bean.getDBState() == 1)
|
||||
return new ResParm(false, "Nome File Duplicato");
|
||||
row.setDBState(0);
|
||||
ResParm rp = row.save();
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ResParm delAllegato(AllegatoNews row) {
|
||||
AllegatoNews bean = new AllegatoNews(getApFull());
|
||||
bean.findByPrimaryKey(row.getId_allegatoNews());
|
||||
return bean.delete();
|
||||
}
|
||||
|
||||
public Vectumerator<News> getAllegati() {
|
||||
return new AllegatoNews(getApFull()).findById_news(getId_news(), 0, 0);
|
||||
}
|
||||
|
||||
public static final void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
Parm bean = new Parm(ap);
|
||||
String l_tipoParm = "NEWS";
|
||||
bean.findByCodice("NEWS_LANG_DEFAULT");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("NEWS_LANG_DEFAULT");
|
||||
bean.setDescrizione("NEWS_LANG_DEFAULT");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("it");
|
||||
bean.setNota(
|
||||
"LINGUA DI DEFAULT PER LA VISUALIZZAZIONE DELLE NEWS. SE NON C'E' LA DESCRIZIONE IL LINGUA PRENDO QUELLA DELLA LINGUA DI DEFAULT.<BR>UTILIZZARE I CODICE STANDARD (it, en, de, fr, ...=");
|
||||
bean.save();
|
||||
bean.findByCodice("NEWS_IMG_PATH");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("NEWS_IMG_PATH");
|
||||
bean.setDescrizione("NEWS_IMG_PATH");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("_news/_img/");
|
||||
bean.setNota("NEWS IMG PATH RELATIVO A docBase. Default: _news/_img/. (deve finire con /)");
|
||||
bean.save();
|
||||
bean.findByCodice("NEWS_ATTACH_PATH");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("NEWS_ATTACH_PATH");
|
||||
bean.setDescrizione("NEWS_ATTACH_PATH");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("_news/_attach/");
|
||||
bean.setNota("NEWS ATTACH PATH RELATIVO A docBase. Default: _news/_attach/. (deve finire con /)");
|
||||
bean.save();
|
||||
bean.findByCodice("PATH_IMG_NEWSLETTER");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PATH_IMG_NEWSLETTER");
|
||||
bean.setDescrizione("PATH_IMG_NEWSLETTER");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("_news/_newsletterImg/");
|
||||
bean.setNota("NEWSLETTER PATH IMMAGINI RELATIVO A docBase. Default: _news/_newsletterImg/. (deve finire con /)");
|
||||
bean.save();
|
||||
bean.findByCodice("PATH_MAIL_NEWS");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PATH_MAIL_NEWS");
|
||||
bean.setDescrizione("PATH_MAIL_NEWS");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("mailMessage/news.txt");
|
||||
bean.setNota("NEWS PATH RELATIVO AL TEMPLATE MAIL");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public long getId_tipoNews() {
|
||||
return this.id_tipoNews;
|
||||
}
|
||||
|
||||
public void setTipoNews(TipoNews newTipoNews) {
|
||||
this.tipoNews = newTipoNews;
|
||||
}
|
||||
|
||||
public TipoNews getTipoNews() {
|
||||
this.tipoNews = (TipoNews)getSecondaryObject(this.tipoNews, TipoNews.class, getId_tipoNews());
|
||||
return this.tipoNews;
|
||||
}
|
||||
|
||||
public void setId_tipoNews(long id_tipoNews) {
|
||||
this.id_tipoNews = id_tipoNews;
|
||||
setTipoNews(null);
|
||||
}
|
||||
|
||||
public String getPathAttach() {
|
||||
return getPathImmagini();
|
||||
}
|
||||
|
||||
public String getPathImmagini() {
|
||||
return getParm("NEWS_IMG_PATH").getTesto();
|
||||
}
|
||||
|
||||
public String getNewsLangDefault() {
|
||||
return getParm("NEWS_LANG_DEFAULT").getTesto();
|
||||
}
|
||||
|
||||
public boolean useDescLangTables() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getTitolo() {
|
||||
return getTitolo("it");
|
||||
}
|
||||
|
||||
public String getTitolo(String lang) {
|
||||
if (lang.isEmpty())
|
||||
lang = "it";
|
||||
String temp = getDescTxtLang("titolo", lang);
|
||||
if (temp.isEmpty())
|
||||
return getDescTxtLang("titolo", getNewsLangDefault());
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getTitolo(String lang, int stringCaseType) {
|
||||
String str = new String();
|
||||
str = convertStringCase(getTitolo(lang), stringCaseType);
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getTesto() {
|
||||
return getTesto("it");
|
||||
}
|
||||
|
||||
public String getTesto(String lang) {
|
||||
if (lang.isEmpty())
|
||||
lang = "it";
|
||||
getDescTxtLang("testo", lang);
|
||||
String temp = getDescTxtLang("testo", lang);
|
||||
if (temp.isEmpty())
|
||||
return getDescTxtLang("testo", getNewsLangDefault());
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getTesto(String lang, int stringCaseType) {
|
||||
String str = new String();
|
||||
str = convertStringCase(getTesto(lang), stringCaseType);
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getSommario() {
|
||||
return getSommario("it");
|
||||
}
|
||||
|
||||
public String getSommario(String lang) {
|
||||
if (lang.isEmpty())
|
||||
lang = "it";
|
||||
String temp = getDescTxtLang("sommario", lang);
|
||||
if (temp.isEmpty())
|
||||
return getDescTxtLang("sommario", getNewsLangDefault());
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getSommario(String lang, int stringCaseType) {
|
||||
String str = new String();
|
||||
str = convertStringCase(getSommario(lang), stringCaseType);
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return getLink("it");
|
||||
}
|
||||
|
||||
public String getLink(String lang) {
|
||||
if (lang.isEmpty())
|
||||
lang = "it";
|
||||
String temp = getDescTxtLang("link", lang);
|
||||
if (temp.isEmpty())
|
||||
return getDescTxtLang("link", getNewsLangDefault());
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getLink(String lang, int stringCaseType) {
|
||||
String str = new String();
|
||||
str = convertStringCase(getTitolo(lang), stringCaseType);
|
||||
return str;
|
||||
}
|
||||
|
||||
public Date getDataInvio() {
|
||||
return this.dataInvio;
|
||||
}
|
||||
|
||||
public void setDataInvio(Date dataInvio) {
|
||||
this.dataInvio = dataInvio;
|
||||
}
|
||||
|
||||
public static boolean isThreadAttivo() {
|
||||
return threadInviaNews;
|
||||
}
|
||||
|
||||
public synchronized ResParm inviaMessaggi(NewsCR CR) {
|
||||
if (!isThreadAttivo())
|
||||
return new ResParm(true, "Thread invio messaggi avviato....");
|
||||
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
|
||||
}
|
||||
|
||||
public void findLastNews() {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWS AS A ";
|
||||
String s_Sql_Order = " order by A.dataNews desc, A.id_news desc";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.flgVisibile=1");
|
||||
wc.addWc("(A.dataFine is null || A.dataFine>?)");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_Order);
|
||||
stmt.setDate(1, getToday());
|
||||
findFirstRecord(stmt);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getTitoloUrl(String lang) {
|
||||
String temp = getTitolo(lang);
|
||||
try {
|
||||
temp = temp.replace("/", "-");
|
||||
temp = temp.replace("€", "€");
|
||||
return URLEncoder.encode(temp, "utf-8");
|
||||
} catch (Exception e) {
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
public static final synchronized ResParm inviaMessaggioMail(News bean, Users users) {
|
||||
ResParm rp = new ResParm(true);
|
||||
MailProperties mp = new MailProperties();
|
||||
if (users.getEMail().isEmpty()) {
|
||||
mp.put("TO", users.getClifor().getEMail());
|
||||
} else {
|
||||
mp.put("TO", users.getEMail());
|
||||
}
|
||||
mp.put("FROM", bean.getParm("CODA_MESSAGGI_MAIL_FROM").getTesto());
|
||||
mp.put("SUBJECT", "Econpower: " + bean.getTitolo(users.getLang()));
|
||||
mp.put("ISHTML", "false");
|
||||
String mailMessage = String.valueOf(bean.getDocBase()) + bean.getParm("PATH_MAIL_NEWS").getTesto();
|
||||
MailMessage mf = new MailMessage(bean.getApFull(), mailMessage);
|
||||
mf.setQuestionMark(false);
|
||||
if (users.getId_clifor() == 0L) {
|
||||
mf.setString("cliente", users.getCognomeNome());
|
||||
} else {
|
||||
mf.setString("cliente", users.getClifor().getDescrizioneCliente());
|
||||
}
|
||||
mf.setString("sommario", bean.getSommario(users.getLang()));
|
||||
mp.put("MSG", mf.getMessage());
|
||||
MailMessage mm = new MailMessage(bean.getApFull());
|
||||
rp = mm.sendMailMessage(mp, false);
|
||||
return rp;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
return this.dataFine;
|
||||
}
|
||||
|
||||
public void setDataFine(Date dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
}
|
||||
}
|
||||
109
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/NewsCR.java
Normal file
109
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/NewsCR.java
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class NewsCR extends CRAdapter {
|
||||
public static final long ORDER_BY_DATA_ASC = 0L;
|
||||
|
||||
public static final long ORDER_BY_DATA_DESC = 1L;
|
||||
|
||||
private String titolo;
|
||||
|
||||
private long flgVisibile = -1L;
|
||||
|
||||
private Date dataNews;
|
||||
|
||||
private Date dataFine;
|
||||
|
||||
private long flgTipo;
|
||||
|
||||
private long id_news;
|
||||
|
||||
private long flgPubblica;
|
||||
|
||||
private long id_tipoNews;
|
||||
|
||||
private TipoNews tipoNews;
|
||||
|
||||
public NewsCR() {}
|
||||
|
||||
public NewsCR(ApplParmFull newAp) {
|
||||
super(newAp);
|
||||
}
|
||||
|
||||
public Date getDataNews() {
|
||||
return this.dataNews;
|
||||
}
|
||||
|
||||
public String getTitolo() {
|
||||
return (this.titolo == null) ? "" : this.titolo;
|
||||
}
|
||||
|
||||
public void setDataNews(Date newData) {
|
||||
this.dataNews = newData;
|
||||
}
|
||||
|
||||
public void setTitolo(String newTitolo) {
|
||||
this.titolo = newTitolo;
|
||||
}
|
||||
|
||||
public long getFlgTipo() {
|
||||
return this.flgTipo;
|
||||
}
|
||||
|
||||
public void setFlgTipo(long flgTipo) {
|
||||
this.flgTipo = flgTipo;
|
||||
}
|
||||
|
||||
public void setFlgVisibile(long flgVisibile) {
|
||||
this.flgVisibile = flgVisibile;
|
||||
}
|
||||
|
||||
public long getFlgVisibile() {
|
||||
return this.flgVisibile;
|
||||
}
|
||||
|
||||
public long getId_news() {
|
||||
return this.id_news;
|
||||
}
|
||||
|
||||
public void setId_news(long id_news) {
|
||||
this.id_news = id_news;
|
||||
}
|
||||
|
||||
public long getFlgPubblica() {
|
||||
return this.flgPubblica;
|
||||
}
|
||||
|
||||
public void setFlgPubblica(long flgPubblica) {
|
||||
this.flgPubblica = flgPubblica;
|
||||
}
|
||||
|
||||
public long getId_tipoNews() {
|
||||
return this.id_tipoNews;
|
||||
}
|
||||
|
||||
public TipoNews getTipoNews() {
|
||||
this.tipoNews = (TipoNews)getSecondaryObject(this.tipoNews, TipoNews.class, getId_tipoNews());
|
||||
return this.tipoNews;
|
||||
}
|
||||
|
||||
public void setId_tipoNews(long id_tipoNews) {
|
||||
this.id_tipoNews = id_tipoNews;
|
||||
setTipoNews(null);
|
||||
}
|
||||
|
||||
public void setTipoNews(TipoNews newTipoNews) {
|
||||
this.tipoNews = newTipoNews;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
return this.dataFine;
|
||||
}
|
||||
|
||||
public void setDataFine(Date dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
}
|
||||
}
|
||||
177
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/NewsUsers.java
Normal file
177
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/NewsUsers.java
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.anag.Users;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class NewsUsers extends DBAdapter implements Serializable {
|
||||
private static final long serialVersionUID = 6424449574380883136L;
|
||||
|
||||
private long id_newsUsers;
|
||||
|
||||
private long id_users;
|
||||
|
||||
private long id_news;
|
||||
|
||||
private Timestamp tmstInvio;
|
||||
|
||||
private News news;
|
||||
|
||||
private Users users;
|
||||
|
||||
private String result;
|
||||
|
||||
public NewsUsers(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public NewsUsers() {}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(NewsUsersCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWS_USERS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_news() > 0L)
|
||||
wc.addWc(" A.id_news = " + CR.getId_news());
|
||||
if (CR.getId_users() > 0L)
|
||||
wc.addWc(" A.id_users = " + CR.getId_users());
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(
|
||||
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public long getId_newsUsers() {
|
||||
return this.id_newsUsers;
|
||||
}
|
||||
|
||||
public void setId_newsUsers(long id_newsUsers) {
|
||||
this.id_newsUsers = id_newsUsers;
|
||||
}
|
||||
|
||||
public long getId_users() {
|
||||
return this.id_users;
|
||||
}
|
||||
|
||||
public void setId_users(long id_users) {
|
||||
this.id_users = id_users;
|
||||
}
|
||||
|
||||
public long getId_news() {
|
||||
return this.id_news;
|
||||
}
|
||||
|
||||
public void setId_news(long id_news) {
|
||||
this.id_news = id_news;
|
||||
}
|
||||
|
||||
public Timestamp getTmstInvio() {
|
||||
return this.tmstInvio;
|
||||
}
|
||||
|
||||
public void setTmstInvio(Timestamp tmstInvio) {
|
||||
this.tmstInvio = tmstInvio;
|
||||
}
|
||||
|
||||
public void findByNewsUsers(long l_id_news, long l_id_users) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWS_USERS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc(" A.id_news = " + l_id_news);
|
||||
wc.addWc(" A.id_users = " + l_id_users);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(
|
||||
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public News getNews() {
|
||||
this.news = (News)getSecondaryObject(this.news, News.class, getId_news());
|
||||
return this.news;
|
||||
}
|
||||
|
||||
public void setNews(News news) {
|
||||
this.news = news;
|
||||
}
|
||||
|
||||
public Users getUsers() {
|
||||
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
|
||||
return this.users;
|
||||
}
|
||||
|
||||
public void setUsers(Users users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Vectumerator findByNews(long l_id_news) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWS_USERS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc(" A.id_news = " + l_id_news);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(
|
||||
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public void findByUsers(long l_id_users) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWS_USERS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc(" A.id_users = " + l_id_users);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(
|
||||
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm addUser(long l_id_news, long l_id_user, String result) {
|
||||
findByNewsUsers(l_id_news, l_id_user);
|
||||
setId_news(l_id_news);
|
||||
setId_users(l_id_user);
|
||||
setTmstInvio(new Timestamp(Calendar.getInstance().getTimeInMillis()));
|
||||
setResult(result);
|
||||
ResParm rp = save();
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return (this.result == null) ? "" : this.result.trim();
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.anag.Users;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class NewsUsersCR extends CRAdapter {
|
||||
private long id_newsUsers;
|
||||
|
||||
private long id_users;
|
||||
|
||||
private long id_news;
|
||||
|
||||
private Date tmstInvio;
|
||||
|
||||
private News news;
|
||||
|
||||
private Users users;
|
||||
|
||||
public NewsUsersCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public NewsUsersCR() {}
|
||||
|
||||
public long getId_newsUsers() {
|
||||
return this.id_newsUsers;
|
||||
}
|
||||
|
||||
public void setId_newsUsers(long id_newsUsers) {
|
||||
this.id_newsUsers = id_newsUsers;
|
||||
}
|
||||
|
||||
public long getId_users() {
|
||||
return this.id_users;
|
||||
}
|
||||
|
||||
public void setId_users(long id_users) {
|
||||
this.id_users = id_users;
|
||||
}
|
||||
|
||||
public long getId_news() {
|
||||
return this.id_news;
|
||||
}
|
||||
|
||||
public void setId_news(long id_news) {
|
||||
this.id_news = id_news;
|
||||
}
|
||||
|
||||
public Date getTmstInvio() {
|
||||
return this.tmstInvio;
|
||||
}
|
||||
|
||||
public void setTmstInvio(Date tmstInvio) {
|
||||
this.tmstInvio = tmstInvio;
|
||||
}
|
||||
|
||||
public News getNews() {
|
||||
this.news = (News)getSecondaryObject(this.news, News.class, getId_news());
|
||||
return this.news;
|
||||
}
|
||||
|
||||
public Users getUsers() {
|
||||
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
|
||||
return this.users;
|
||||
}
|
||||
|
||||
public void setNews(News news) {
|
||||
this.news = news;
|
||||
}
|
||||
|
||||
public void setUsers(Users users) {
|
||||
this.users = users;
|
||||
}
|
||||
}
|
||||
179
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/Newsletter.java
Normal file
179
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/Newsletter.java
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.AddImgInterface;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.reg.EcDc;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Newsletter extends DBAdapter implements Serializable, AddImgInterface {
|
||||
private long id_newsletter;
|
||||
|
||||
private Date dataNewsletter;
|
||||
|
||||
private String testo_it;
|
||||
|
||||
private String testo_en;
|
||||
|
||||
private String titolo_it;
|
||||
|
||||
private String titolo_en;
|
||||
|
||||
private String imgTmst;
|
||||
|
||||
public static final String DEFAULT_NEWSLETTER_IMG_PATH = "_news/_newsletterImg/";
|
||||
|
||||
public static final String P_PATH_IMG_NEWSLETTER = "PATH_IMG_NEWSLETTER";
|
||||
|
||||
public Newsletter(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public Newsletter() {}
|
||||
|
||||
public void setId_newsletter(long newId_newsletter) {
|
||||
this.id_newsletter = newId_newsletter;
|
||||
}
|
||||
|
||||
public void setDataNewsletter(Date newDataNewsletter) {
|
||||
this.dataNewsletter = newDataNewsletter;
|
||||
}
|
||||
|
||||
public void setTitolo_it(String newTitolo_it) {
|
||||
this.titolo_it = newTitolo_it;
|
||||
}
|
||||
|
||||
public void setTitolo_en(String newTitolo_en) {
|
||||
this.titolo_en = newTitolo_en;
|
||||
}
|
||||
|
||||
public void setImgTmst(String newImgTmst) {
|
||||
this.imgTmst = newImgTmst;
|
||||
}
|
||||
|
||||
public long getId_newsletter() {
|
||||
return this.id_newsletter;
|
||||
}
|
||||
|
||||
public Date getDataNewsletter() {
|
||||
return this.dataNewsletter;
|
||||
}
|
||||
|
||||
public String getTitolo_it() {
|
||||
return (this.titolo_it == null) ? "" : this.titolo_it;
|
||||
}
|
||||
|
||||
public String getTitolo_en() {
|
||||
return (this.titolo_en == null) ? "" : this.titolo_en;
|
||||
}
|
||||
|
||||
public String getImgTmst() {
|
||||
return (this.imgTmst == null) ? "" : this.imgTmst;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(NewsletterCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from NEWSLETTER AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (!CR.getSearchTxt().trim().isEmpty()) {
|
||||
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
|
||||
" ");
|
||||
StringBuffer txt = new StringBuffer("(");
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
txt.append("(A.Cognome like '%" + token +
|
||||
"%' or A.Nome like '%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(
|
||||
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPathImgNewsletter() {
|
||||
return getParm("PATH_IMG_NEWSLETTER").getTesto();
|
||||
}
|
||||
|
||||
public String getTitolo() {
|
||||
return getTitolo_it();
|
||||
}
|
||||
|
||||
public String getLinkPreview() {
|
||||
if (getApFull() != null) {
|
||||
String temp = getParm("SERVERNAME").getTesto();
|
||||
try {
|
||||
return String.valueOf(temp) +
|
||||
"Newsletter.abl?id=" +
|
||||
URLEncoder.encode(
|
||||
EcDc.encode64String(String.valueOf(Math.random()) + "xyz" +
|
||||
getId_newsletter()), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
return "ERRORE encoding url";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getTitolo(String lang) {
|
||||
return getLangField("titolo", lang);
|
||||
}
|
||||
|
||||
public String getImgFileName(int imgNumber) {
|
||||
return getImgFileName(imgNumber, getImgTmst());
|
||||
}
|
||||
|
||||
public String getImgFileName(int imgNumber, String oldTmst) {
|
||||
return String.valueOf(getId_newsletter()) + "_" + oldTmst + "_" + imgNumber + ".jpg";
|
||||
}
|
||||
|
||||
public String getTesto_en() {
|
||||
return (this.testo_en == null) ? "" : this.testo_en;
|
||||
}
|
||||
|
||||
public void setTesto_en(String testo_en) {
|
||||
this.testo_en = testo_en;
|
||||
}
|
||||
|
||||
public String getTesto_it() {
|
||||
return (this.testo_it == null) ? "" : this.testo_it;
|
||||
}
|
||||
|
||||
public void setTesto_it(String testo_it) {
|
||||
this.testo_it = testo_it;
|
||||
}
|
||||
|
||||
public String getTesto() {
|
||||
return getTesto_it();
|
||||
}
|
||||
|
||||
public String getTesto(String lang) {
|
||||
return getLangField("testo", lang);
|
||||
}
|
||||
|
||||
public String getPathAttach() {
|
||||
return getPathImgNewsletter();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class NewsletterCR extends CRAdapter {
|
||||
private long id_newsletter;
|
||||
|
||||
private Date dataNewsletter;
|
||||
|
||||
private String titolo_it;
|
||||
|
||||
private String titolo_en;
|
||||
|
||||
private String imgTmst;
|
||||
|
||||
public NewsletterCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public NewsletterCR() {}
|
||||
|
||||
public void setId_newsletter(long newId_newsletter) {
|
||||
this.id_newsletter = newId_newsletter;
|
||||
}
|
||||
|
||||
public void setDataNewsletter(Date newDataNewsletter) {
|
||||
this.dataNewsletter = newDataNewsletter;
|
||||
}
|
||||
|
||||
public void setTitolo_it(String newTitolo_it) {
|
||||
this.titolo_it = newTitolo_it;
|
||||
}
|
||||
|
||||
public void setTitolo_en(String newTitolo_en) {
|
||||
this.titolo_en = newTitolo_en;
|
||||
}
|
||||
|
||||
public void setImgTmst(String newImgTmst) {
|
||||
this.imgTmst = newImgTmst;
|
||||
}
|
||||
|
||||
public long getId_newsletter() {
|
||||
return this.id_newsletter;
|
||||
}
|
||||
|
||||
public Date getDataNewsletter() {
|
||||
return this.dataNewsletter;
|
||||
}
|
||||
|
||||
public String getTitolo_it() {
|
||||
return (this.titolo_it == null) ? "" : this.titolo_it;
|
||||
}
|
||||
|
||||
public String getTitolo_en() {
|
||||
return (this.titolo_en == null) ? "" : this.titolo_en;
|
||||
}
|
||||
|
||||
public String getImgTmst() {
|
||||
return (this.imgTmst == null) ? "" : this.imgTmst;
|
||||
}
|
||||
|
||||
public String getTitolo() {
|
||||
return getTitolo_it();
|
||||
}
|
||||
}
|
||||
79
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/TipoNews.java
Normal file
79
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/news/TipoNews.java
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class TipoNews extends DBAdapter implements Serializable {
|
||||
private long id_tipoNews;
|
||||
|
||||
private long flgPubblica;
|
||||
|
||||
public TipoNews(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public TipoNews() {}
|
||||
|
||||
public void setId_tipoNews(long newId_tipoNews) {
|
||||
this.id_tipoNews = newId_tipoNews;
|
||||
}
|
||||
|
||||
public long getId_tipoNews() {
|
||||
return this.id_tipoNews;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(TipoNewsCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from TIPO_NEWS AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(
|
||||
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public long getFlgPubblica() {
|
||||
return this.flgPubblica;
|
||||
}
|
||||
|
||||
public void setFlgPubblica(long flgPubblica) {
|
||||
this.flgPubblica = flgPubblica;
|
||||
}
|
||||
|
||||
public boolean useDescLangTables() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return getDescrizione("it");
|
||||
}
|
||||
|
||||
public String getDescrizione(String lang) {
|
||||
if (lang.isEmpty())
|
||||
lang = "it";
|
||||
return getDescTxtLang("descrizione", lang);
|
||||
}
|
||||
|
||||
public String getDescrizione(String lang, int stringCaseType) {
|
||||
String str = new String();
|
||||
str = convertStringCase(getDescrizione(lang), stringCaseType);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.ablia.news;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
|
||||
public class TipoNewsCR extends CRAdapter {
|
||||
private long id_tipoNews;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
public TipoNewsCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public TipoNewsCR() {}
|
||||
|
||||
public void setId_tipoNews(long newId_tipoNews) {
|
||||
this.id_tipoNews = newId_tipoNews;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public long getId_tipoNews() {
|
||||
return this.id_tipoNews;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ablia.news.servlet;
|
||||
|
||||
import com.ablia.news.AllegatoNews;
|
||||
import com.ablia.servlet.GetFileSvlt;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/_news/_attach/*"})
|
||||
public class GetNewsAttachSvlt extends GetFileSvlt {
|
||||
protected String getFileName(HttpServletRequest req, HttpServletResponse res) {
|
||||
AllegatoNews bean = new AllegatoNews(getApFull(req));
|
||||
bean.findByPrimaryKey(getRequestLongParameter(req, "id"));
|
||||
boolean isWeb = (getRequestLongParameter(req, "w") == 1L);
|
||||
if (isWeb)
|
||||
bean.addClickThrough(req.getRemoteAddr(), req.getServletPath());
|
||||
String fileName = bean.getNomeFileCompleto();
|
||||
return fileName;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package com.ablia.news.servlet;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.DBAdapterException;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.news.News;
|
||||
import com.ablia.news.NewsCR;
|
||||
import com.ablia.news.TipoNews;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.sql.SQLException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/News.abl"})
|
||||
public class NewsSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = 476646217816287146L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
News bean = (News)beanA;
|
||||
req.setAttribute("listaAllegati", bean.getAllegati());
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new News(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new NewsCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _last(HttpServletRequest req, HttpServletResponse res) {
|
||||
News news = new News(getApFull(req));
|
||||
news.findLastNews();
|
||||
req.setAttribute("bean", news);
|
||||
setJspPage("/news.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _getTimelineOld(HttpServletRequest req, HttpServletResponse res) {
|
||||
String lang = (String)req.getSession().getAttribute("lang");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
NewsCR CR = new NewsCR();
|
||||
CR.getFlgPubblica();
|
||||
CR.getId_tipoNews();
|
||||
Vectumerator<News> vec = new News(getApFull(req)).findByCR(CR, 0, 0);
|
||||
sb.append("{\"timeline\":{");
|
||||
sb.append("\"headline\":\"\",");
|
||||
sb.append("\"type\":\"default\",");
|
||||
sb.append("\"text\":\"<p>News TechnoPlants</p>\",");
|
||||
sb.append("\"date\":[{");
|
||||
StringBuilder sbd = new StringBuilder();
|
||||
while (vec.hasMoreElements()) {
|
||||
News news = (News)vec.nextElement();
|
||||
if (sbd.length() > 0)
|
||||
sbd.append("},{");
|
||||
sbd.append("\"startDate\":\"" + news.getDataNews().toString().replace("-", ",") + "\",");
|
||||
if (news.getDataFine() != null) {
|
||||
sbd.append("\"endDate\":\"" + news.getDataFine().toString().replace("-", ",") + "\",");
|
||||
} else {
|
||||
sbd.append("\"endDate\":\"" + news.getDataNews().toString().replace("-", ",") + "\",");
|
||||
}
|
||||
sbd.append("\"headline\":\"" + news.getTitolo(lang) + "\",");
|
||||
sbd.append("\"text\":\"prova\",");
|
||||
sbd.append("\"tag\":\"" + news.getTipoNews().getDescrizione(lang) + "\",");
|
||||
sbd.append("\"asset\":");
|
||||
sbd.append("{");
|
||||
if (news.getId_tipoNews() == 3L) {
|
||||
if (!news.getLink(lang).isEmpty())
|
||||
sbd.append("\"media\":\"" + news.getLink(lang) + "\"");
|
||||
} else {
|
||||
if (isFileExist(String.valueOf(getDocBase()) + news.getPathImmagini() + news.getImgFileName(2)))
|
||||
sbd.append("\"media\":\"" + news.getPathImmagini() + news.getImgFileName(2) + "\",");
|
||||
if (isFileExist(String.valueOf(getDocBase()) + news.getPathImmagini() + news.getImgFileName(1)))
|
||||
sbd.append("\"thumbnail\":\"" + news.getPathImmagini() + news.getImgFileName(1) + "\",");
|
||||
sbd.append("\"caption\":\"" + news.getLink(lang) + "\"");
|
||||
}
|
||||
sbd.append("}");
|
||||
}
|
||||
if (sbd.length() > 0)
|
||||
sb.append(sbd.toString());
|
||||
sb.append("}]}}");
|
||||
} catch (DBAdapterException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
sendHtmlMsgResponse(req, res, sb.toString());
|
||||
}
|
||||
|
||||
public void _getTimeline(HttpServletRequest req, HttpServletResponse res) {
|
||||
String lang = (String)req.getSession().getAttribute("lang");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
NewsCR CR = new NewsCR();
|
||||
CR.setFlgVisibile(1L);
|
||||
CR.getId_tipoNews();
|
||||
Vectumerator<News> vec = new News(getApFull(req)).findByCR(CR, 0, 0);
|
||||
sb.append("{");
|
||||
sb.append("\"events\":[{");
|
||||
StringBuilder sbd = new StringBuilder();
|
||||
while (vec.hasMoreElements()) {
|
||||
News news = (News)vec.nextElement();
|
||||
if (sbd.length() > 0)
|
||||
sbd.append("},{");
|
||||
String temp = news.getDataNews().toString();
|
||||
sbd.append("\"start_date\":{\"month\": \"");
|
||||
sbd.append(temp.substring(8, 10));
|
||||
sbd.append("\",\"day\": \"");
|
||||
sbd.append(temp.substring(5, 7));
|
||||
sbd.append("\",\"year\": \"");
|
||||
sbd.append(temp.substring(0, 4));
|
||||
sbd.append("\"},");
|
||||
if (news.getDataFine() != null) {
|
||||
temp = news.getDataFine().toString();
|
||||
sbd.append("\"end_date\":{\"month\": \"");
|
||||
sbd.append(temp.substring(8, 10));
|
||||
sbd.append("\",\"day\": \"");
|
||||
sbd.append(temp.substring(5, 7));
|
||||
sbd.append("\",\"year\": \"");
|
||||
sbd.append(temp.substring(0, 4));
|
||||
sbd.append("\"},");
|
||||
} else {
|
||||
temp = news.getDataNews().toString();
|
||||
sbd.append("\"end_date\":{\"month\": \"");
|
||||
sbd.append(temp.substring(8, 10));
|
||||
sbd.append("\",\"day\": \"");
|
||||
sbd.append(temp.substring(5, 7));
|
||||
sbd.append("\",\"year\": \"");
|
||||
sbd.append(temp.substring(0, 4));
|
||||
sbd.append("\"},");
|
||||
}
|
||||
sbd.append("\"text\":{");
|
||||
sbd.append("\"headline\":\"" + news.getTitolo(lang) + "\",");
|
||||
sbd.append("\"text\":\"" + news.getTesto(lang).replace("\"", "'") + "\"");
|
||||
sbd.append("}");
|
||||
if (!news.getLink(lang).isEmpty()) {
|
||||
sbd.append(",\"media\":{\"url\": \"" + news.getLink(lang) + "\"");
|
||||
sbd.append(",\"caption\":\"" + news.getLink(lang) + "\"");
|
||||
sbd.append("}");
|
||||
continue;
|
||||
}
|
||||
if (isFileExist(String.valueOf(getDocBase()) + news.getPathImmagini() + news.getImgFileName(2))) {
|
||||
sbd.append(",\"media\":{\"url\": \"" + news.getPathImmagini() + news.getImgFileName(2) + "\"");
|
||||
sbd.append(",\"caption\":\"" + news.getTitolo(lang) + "\"");
|
||||
sbd.append("}");
|
||||
continue;
|
||||
}
|
||||
if (isFileExist(String.valueOf(getDocBase()) + news.getPathImmagini() + news.getImgFileName(1))) {
|
||||
sbd.append(",\"media\":{\"url\": \"" + news.getPathImmagini() + news.getImgFileName(1) + "\"");
|
||||
sbd.append(",\"caption\":\"" + news.getTitolo(lang) + "\"");
|
||||
sbd.append("}");
|
||||
}
|
||||
}
|
||||
if (sbd.length() > 0)
|
||||
sb.append(sbd.toString());
|
||||
sb.append("}]}");
|
||||
} catch (DBAdapterException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
sendHtmlMsgResponse(req, res, sb.toString());
|
||||
}
|
||||
|
||||
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("flgOrderBy", "1");
|
||||
return super.beforeSearch(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.ablia.news.servlet;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.news.Newsletter;
|
||||
import com.ablia.news.NewsletterCR;
|
||||
import com.ablia.reg.EcDc;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/Newsletter.abl"})
|
||||
public class NewsletterSvlt extends AblServletSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Newsletter(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new NewsletterCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
|
||||
String id = getRequestParameter(req, "id");
|
||||
if (!id.isEmpty()) {
|
||||
String idd = EcDc.decode64String(id);
|
||||
int nidx = idd.indexOf("xyz");
|
||||
if (nidx > 0)
|
||||
req.setAttribute("id_newsletter", idd.substring(nidx + 3,
|
||||
idd.length()));
|
||||
}
|
||||
super.showBean(req, res);
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.ablia.news.servlet.admin;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.news.AllegatoNews;
|
||||
import com.ablia.news.News;
|
||||
import com.ablia.news.NewsCR;
|
||||
import com.ablia.news.TipoNews;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import com.ablia.util.AbMessages;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.File;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class CopyOfNewsSvlt extends AblServletSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
News bean = (News)beanA;
|
||||
req.setAttribute("listaAllegati", bean.getAllegati());
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new News(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new NewsCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void manageMultipartRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
String targetDir = String.valueOf(getDocBase()) + getParm("PATH_TMP").getTesto();
|
||||
String[] fileNameParameters = { "nomeFile" };
|
||||
try {
|
||||
if (getLoginUserGrant(req, new News().getTableBeanName()) >= 3L) {
|
||||
if (manageMultipartRequestParameters(req, 2000,
|
||||
fileNameParameters, null, null, targetDir)) {
|
||||
processNoEncTypeRequest(req, res);
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req),
|
||||
"MR_FILE_ERROR"));
|
||||
showBean(req, res);
|
||||
}
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req),
|
||||
"GRANT_NO_RW"));
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id = 0L;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
l_id = getRequestLongParameter(req, "id_news");
|
||||
News bean = new News(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (getAct(req).equals("addAllegato")) {
|
||||
AllegatoNews row = new AllegatoNews(getApFull(req));
|
||||
fillObject(req, row);
|
||||
rp = bean.addAllegato(row);
|
||||
rp.append(creaFileAllegato(bean, req, res));
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
} else if (getAct(req).equals("delAllegato")) {
|
||||
AllegatoNews row = new AllegatoNews(getApFull(req));
|
||||
fillObject(req, row);
|
||||
rp = bean.delAllegato(row);
|
||||
sendMessage(
|
||||
req,
|
||||
String.valueOf(AbMessages.getMessage(getLocale(req),
|
||||
"SAVE_OK")) + ": Allegato Cancellato");
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
forceMessage(req,
|
||||
AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
synchronized (this) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
News bean = (News)beanA;
|
||||
String targetDir = bean.getPathAllegato();
|
||||
File pathDir = new File(targetDir);
|
||||
if (!pathDir.exists())
|
||||
pathDir.mkdirs();
|
||||
String targetFile = String.valueOf(targetDir) + "/" + bean.getId_news() + "_";
|
||||
Vectumerator completeFileNames = (Vectumerator)
|
||||
req.getAttribute("completeAttachName");
|
||||
Vectumerator fileNames = (Vectumerator)
|
||||
req.getAttribute("attachName");
|
||||
if (completeFileNames.hasMoreElements()) {
|
||||
String sourceFile = (String)completeFileNames.nextElement();
|
||||
String fileName = (String)fileNames.elementAt(0);
|
||||
targetFile = String.valueOf(targetFile) + fileName;
|
||||
if (isFileExist(sourceFile)) {
|
||||
new File(targetFile).delete();
|
||||
new File(sourceFile).renameTo(new File(targetFile));
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUser(req).getId_users() == 1L &&
|
||||
getCmd(req).equals("init")) {
|
||||
News.initApplicationParms(getApFull(req));
|
||||
sendMessage(req, "Parametri news creati.");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected boolean isLoadImageServlet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getAttachPath(HttpServletRequest req) {
|
||||
String act = getAct(req);
|
||||
if (act.equals("addAllegato"))
|
||||
return getParm("NEWS_ATTACH_PATH").getTesto();
|
||||
return getParm("NEWS_IMG_PATH").getTesto();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
package com.ablia.news.servlet.admin;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.news.AllegatoNews;
|
||||
import com.ablia.news.News;
|
||||
import com.ablia.news.NewsCR;
|
||||
import com.ablia.news.NewsUsers;
|
||||
import com.ablia.news.TipoNews;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import com.ablia.util.AbMessages;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.File;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/news/News.abl"})
|
||||
public class NewsSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = -6717828355281261494L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
News bean = (News)beanA;
|
||||
req.setAttribute("listaAllegati", bean.getAllegati());
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
req.setAttribute("listaUsers", new NewsUsers(getApFull(req)).findByNews(bean.getId_news()));
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new News(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new NewsCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id = 0L;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
l_id = getRequestLongParameter(req, "id_news");
|
||||
News bean = new News(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (getAct(req).equals("addAllegato")) {
|
||||
AllegatoNews row = new AllegatoNews(getApFull(req));
|
||||
fillObject(req, row);
|
||||
rp = bean.addAllegato(row);
|
||||
rp.append(creaFileAllegato(bean, req, res));
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
} else if (getAct(req).equals("delAllegato")) {
|
||||
AllegatoNews row = new AllegatoNews(getApFull(req));
|
||||
fillObject(req, row);
|
||||
rp = bean.delAllegato(row);
|
||||
sendMessage(req, String.valueOf(AbMessages.getMessage(getLocale(req), "SAVE_OK")) + ": Allegato Cancellato");
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
synchronized (this) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
News bean = (News)beanA;
|
||||
String targetDir = String.valueOf(getDocBase()) + bean.getPathAllegato();
|
||||
File pathDir = new File(targetDir);
|
||||
if (!pathDir.exists())
|
||||
pathDir.mkdirs();
|
||||
String targetFile = String.valueOf(targetDir) + "/" + bean.getId_news() + "_";
|
||||
Vectumerator completeFileNames = (Vectumerator)req.getAttribute("completeAttachName");
|
||||
Vectumerator fileNames = (Vectumerator)req.getAttribute("attachName");
|
||||
if (completeFileNames.hasMoreElements()) {
|
||||
String sourceFile = (String)completeFileNames.nextElement();
|
||||
String fileName = (String)fileNames.elementAt(0);
|
||||
targetFile = String.valueOf(targetFile) + fileName;
|
||||
if (isFileExist(sourceFile)) {
|
||||
new File(targetFile).delete();
|
||||
new File(sourceFile).renameTo(new File(targetFile));
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUser(req).getId_users() == 1L &&
|
||||
getCmd(req).equals("init")) {
|
||||
News.initApplicationParms(getApFull(req));
|
||||
sendMessage(req, "Parametri news creati.");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected boolean isLoadImageServlet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getAttachPath(HttpServletRequest req) {
|
||||
String act = getAct(req);
|
||||
if (act.equals("addAllegato"))
|
||||
return getParm("NEWS_ATTACH_PATH").getTesto();
|
||||
return getParm("NEWS_IMG_PATH").getTesto();
|
||||
}
|
||||
|
||||
protected ResParm afterImgFileSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
News bean = (News)beanA;
|
||||
ResParm rp = super.afterImgFileSave(bean, req, res);
|
||||
return rp;
|
||||
}
|
||||
|
||||
public void _inviaNews(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_news = getRequestLongParameter(req, "id_news");
|
||||
NewsCR CR = new NewsCR(getApFull(req));
|
||||
CR.setId_news(l_id_news);
|
||||
News bean = new News(getApFull(req));
|
||||
bean.inviaMessaggi(CR);
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("flgOrderBy", Long.valueOf(1L));
|
||||
return super.beforeSearch(req, res);
|
||||
}
|
||||
|
||||
public void _addAllegato(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
News bean = new News(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_news");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
String fileName = getRequestParameter(req, "fileNameOnServer_1");
|
||||
String targetDir = String.valueOf(getDocBase()) + bean.getPathAllegato();
|
||||
File pathDir = new File(targetDir);
|
||||
if (!pathDir.exists())
|
||||
pathDir.mkdirs();
|
||||
String targetFile = String.valueOf(targetDir) + "/" + bean.getId_news() + "_" + fileName;
|
||||
String sourceFile = String.valueOf(getDocBase()) + getPathTmp() + fileName;
|
||||
if (isFileExist(sourceFile)) {
|
||||
new File(targetFile).delete();
|
||||
new File(sourceFile).renameTo(new File(targetFile));
|
||||
}
|
||||
AllegatoNews row = new AllegatoNews(apFull);
|
||||
fillObject(req, row);
|
||||
row.setNomeFile(fileName);
|
||||
ResParm rp = bean.addAllegato(row);
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _delAllegato(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id = 0L;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
l_id = getRequestLongParameter(req, "id_news");
|
||||
News bean = new News(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
AllegatoNews row = new AllegatoNews(getApFull(req));
|
||||
fillObject(req, row);
|
||||
rp = bean.delAllegato(row);
|
||||
sendMessage(req, String.valueOf(AbMessages.getMessage(getLocale(req), "SAVE_OK")) + ": Allegato Cancellato");
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ablia.news.servlet.admin;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.news.NewsUsers;
|
||||
import com.ablia.news.NewsUsersCR;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/news/NewsUsers.abl"})
|
||||
public class NewsUsersSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = -6381039631036562905L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new NewsUsers(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new NewsUsersCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.ablia.news.servlet.admin;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.news.Newsletter;
|
||||
import com.ablia.news.NewsletterCR;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import com.ablia.util.AbMessages;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.File;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/news/Newsletter.abl"})
|
||||
public class NewsletterSvlt extends AblServletSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Newsletter(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new NewsletterCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id = 0L;
|
||||
l_id = getRequestLongParameter(req, "id_news");
|
||||
Newsletter bean = new Newsletter(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req),
|
||||
"SAVE_FAIL"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
synchronized (this) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
synchronized (this) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
Newsletter bean = (Newsletter)beanA;
|
||||
String targetDir = String.valueOf(getDocBase()) + bean.getPathImgNewsletter();
|
||||
Vectumerator fileNames = (Vectumerator)
|
||||
req.getAttribute("completeAttachName");
|
||||
String imgTmst = getTimeNameForFileUpload();
|
||||
boolean l_newImg = false;
|
||||
while (fileNames.hasMoreElements()) {
|
||||
String currentFileName = (String)fileNames.nextElement();
|
||||
if (currentFileName.indexOf("/img") >= 0) {
|
||||
l_newImg = true;
|
||||
int idx = Integer.parseInt(currentFileName.substring(
|
||||
currentFileName.lastIndexOf("_") + 1,
|
||||
currentFileName.lastIndexOf(".")));
|
||||
if (isFileExist(currentFileName)) {
|
||||
new File(String.valueOf(targetDir) + bean.getImgFileName(idx)).delete();
|
||||
new File(currentFileName).renameTo(new File(String.valueOf(targetDir) +
|
||||
bean.getImgFileName(idx, imgTmst)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l_newImg)
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
String currentFileName = String.valueOf(targetDir) + bean.getImgFileName(i);
|
||||
if (isFileExist(currentFileName))
|
||||
new File(currentFileName).renameTo(new File(String.valueOf(targetDir) +
|
||||
bean.getImgFileName(i, imgTmst)));
|
||||
}
|
||||
if (getRequestLongParameter(req, "cmdCancellaImmagine1") == 1L) {
|
||||
String fileName = String.valueOf(targetDir) + bean.getImgFileName(1);
|
||||
new File(fileName).delete();
|
||||
}
|
||||
if (getRequestLongParameter(req, "cmdCancellaImmagine2") == 1L) {
|
||||
String fileName = String.valueOf(targetDir) + bean.getImgFileName(2);
|
||||
new File(fileName).delete();
|
||||
}
|
||||
if (l_newImg) {
|
||||
bean.setImgTmst(imgTmst);
|
||||
rp = bean.save();
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getAttachPath(HttpServletRequest req) {
|
||||
return ((Newsletter)getBean(req)).getPathImgNewsletter();
|
||||
}
|
||||
|
||||
protected boolean isLoadImageServlet() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ablia.news.servlet.admin;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.news.TipoNews;
|
||||
import com.ablia.news.TipoNewsCR;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/news/TipoNews.abl"})
|
||||
public class TipoNewsSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new TipoNews(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new TipoNewsCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package com.ablia.news.taglib;
|
||||
|
||||
import com.ablia.news.News;
|
||||
import com.ablia.news.NewsCR;
|
||||
import com.ablia.taglib.AbstractDbTag;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import javax.servlet.jsp.JspException;
|
||||
|
||||
public class NewsTag extends AbstractDbTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String rowbeanname;
|
||||
|
||||
private Vectumerator<News> theList;
|
||||
|
||||
private long flgPubblica;
|
||||
|
||||
private long orderby;
|
||||
|
||||
private long limit = 0L;
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try {
|
||||
boolean flgOk = false;
|
||||
News obj = null;
|
||||
while (this.theList.hasMoreElements()) {
|
||||
if (!(obj = (News)this.theList.nextElement()).getTitolo().equals(
|
||||
"")) {
|
||||
flgOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flgOk) {
|
||||
this.pageContext.setAttribute(getRowbeanname(), obj);
|
||||
this.pageContext.getRequest().setAttribute("listaAllegatiNews",
|
||||
obj.getAllegati());
|
||||
return 2;
|
||||
}
|
||||
this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter());
|
||||
return 0;
|
||||
} catch (IOException ioexception) {
|
||||
throw new JspException(ioexception.getMessage());
|
||||
} catch (Exception exception) {
|
||||
throw new JspException(exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void doInitBody() {}
|
||||
|
||||
public int doStartTag() {
|
||||
try {
|
||||
NewsCR CR = new NewsCR();
|
||||
CR.setFlgVisibile(1L);
|
||||
if (getFlgPubblica() != 0L)
|
||||
CR.setFlgPubblica(this.flgPubblica);
|
||||
CR.setFlgOrderBy(getOrderby());
|
||||
if (getLimit() == 0L) {
|
||||
this.theList = new News(getApFull()).findByCR(CR, 0, 0);
|
||||
} else {
|
||||
this.theList = new News(getApFull()).findByCR(CR, 1, (int)getLimit());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.theList = new Vectumerator();
|
||||
}
|
||||
if (this.theList == null)
|
||||
return 0;
|
||||
this.theList.moveFirst();
|
||||
boolean flgOk = false;
|
||||
News obj = null;
|
||||
while (this.theList.hasMoreElements()) {
|
||||
if (!(obj = (News)this.theList.nextElement()).getTitolo().equals(
|
||||
"")) {
|
||||
flgOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flgOk) {
|
||||
this.pageContext.setAttribute(getRowbeanname(), obj);
|
||||
this.pageContext.getRequest().setAttribute("listaAllegatiNews",
|
||||
obj.getAllegati());
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getRowbeanname() {
|
||||
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
|
||||
}
|
||||
|
||||
public void setRowbeanname(String s) {
|
||||
this.rowbeanname = s;
|
||||
}
|
||||
|
||||
public long getFlgPubblica() {
|
||||
return this.flgPubblica;
|
||||
}
|
||||
|
||||
public void setFlgPubblica(long flgPubblica) {
|
||||
this.flgPubblica = flgPubblica;
|
||||
}
|
||||
|
||||
public long getOrderby() {
|
||||
return this.orderby;
|
||||
}
|
||||
|
||||
public void setOrderby(long orderby) {
|
||||
this.orderby = orderby;
|
||||
}
|
||||
|
||||
public long getLimit() {
|
||||
return this.limit;
|
||||
}
|
||||
|
||||
public void setLimit(long limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.ablia.news.taglib;
|
||||
|
||||
import javax.servlet.jsp.tagext.TagData;
|
||||
import javax.servlet.jsp.tagext.TagExtraInfo;
|
||||
import javax.servlet.jsp.tagext.VariableInfo;
|
||||
|
||||
public class NewsTagExtraInfo extends TagExtraInfo {
|
||||
public VariableInfo[] getVariableInfo(TagData tagdata) {
|
||||
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ?
|
||||
tagdata.getAttributeString("rowbeanname") :
|
||||
"rowBean";
|
||||
String rowBeanClass = "com.ablia.news.News";
|
||||
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true,
|
||||
0),
|
||||
new VariableInfo("listaAllegatiNews",
|
||||
"com.ablia.util.Vectumerator", true,
|
||||
0) };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
News_3_00_04_080216
|
||||
08-02-2016 aggiunto parametro lingua default news per output testi
|
||||
29-04-13 aggiustamento attach\n
|
||||
29-03-13 addimginterface\n
|
||||
16-10-12 aallineato alla nuova versione ablia.jar\n
|
||||
02-04-12 aggironato alla versione standard immagini e attach\n
|
||||
05-10-2011 corretto ricerche su allegato_news\n
|
||||
19-07-2011 aggiunto tipo news, allegato diventa alletago_news + aggirnamenti pagine web\n
|
||||
Loading…
Add table
Add a link
Reference in a new issue