ModalLogin: SiteWrapper:
AdvancedContent:


ViewContact:


DirectAction: // Generated by the Maven Archetype Plug-in package it.xplants.alutec.app; import it.xplants.alutec.components.EditUser; import it.xplants.alutec.components.EmailPasswordLost; import it.xplants.alutec.components.EmailUserRegistration; import it.xplants.alutec.components.Main; import it.xplants.alutec.components.ResetPassword; import it.xplants.alutec.components.UserAccount; import it.xplants.alutec.components.UserRegistration; import it.xplants.alutec.components.ViewArticle; import it.xplants.alutec.components.ViewBlogArticle; import it.xplants.alutec.components.ViewBlogArticleList; import it.xplants.alutec.components.ViewBlogList; import it.xplants.alutec.components.ViewCart; import it.xplants.alutec.components.ViewCategory; import it.xplants.alutec.components.ViewConfigAluflex; import it.xplants.alutec.components.ViewConfigBanchi; import it.xplants.alutec.components.ViewConfigNastri; import it.xplants.alutec.components.ViewContact; import it.xplants.alutec.components.ViewDownload; import it.xplants.alutec.components.ViewMessagePage; import it.xplants.alutec.components.ViewPaymentDelivery; import it.xplants.alutec.components.ViewProduct; import it.xplants.alutec.components.ViewProducts; import it.xplants.alutec.components.ViewProject; import it.xplants.alutec.components.ViewProjects; import it.xplants.alutec.components.ViewRFID; import it.xplants.alutec.components.ViewRFIDLanguage; import it.xplants.alutec.components.ViewSearch; import it.xplants.alutec.components.ViewSection; import it.xplants.alutec.components.ViewTechDownload; import it.xplants.alutec.email.EmailHelper; import it.xplants.appserver.JSONResponse; import it.xplants.plupload.extensions.PLUpload; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.nio.file.Files; import java.text.SimpleDateFormat; import java.util.Date; import javax.mail.MessagingException; import javax.mail.internet.AddressException; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WORequest; import com.webobjects.eoaccess.EOUtilities; import com.webobjects.eocontrol.EOEditingContext; import com.webobjects.eocontrol.EOQualifier; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSMutableArray; import com.webobjects.foundation.NSMutableDictionary; import com.webobjects.foundation.NSTimestamp; import er.extensions.appserver.ERXApplication; import er.extensions.appserver.ERXResponse; import er.extensions.eof.ERXEC; import er.extensions.eof.ERXQ; import er.extensions.foundation.ERXMutableURL; import er.extensions.localization.ERXLocalizer; import er.javamail.ERJavaMail; import er.javamail.ERMailDeliveryHTML; import er.javamail.ERMailFileAttachment; import it.xplants.xtro.XTContainer; import it.xplants.xtro.XTFormSubmission; import it.xplants.xtro.XTOrder; import it.xplants.xtro.XTUser; import it.xplants.xtro.appserver.XTDirectAction; import it.xplants.xtro.appserver.interfaces.XTDirectActionAnnotation; import it.xplants.xtro.appserver.tools.AppSupport; import it.xplants.xtro.extensions.XTClass; import it.xplants.xtro.helper.XTContainerHelper; import it.xplants.xtro.utilities.XTQ; import it.xplants.xtro.utilities.ZipUtils; public class DirectAction extends XTDirectAction { public DirectAction(WORequest request) { super(request); } private final static Logger log = Logger.getLogger(DirectAction.class); // download public WOActionResults zipAction() throws IOException { try { XTContainer container = container(); EOQualifier qualifier = ERXQ.and(XTClass.FILE.qualifier(), XTQ.baseQualifier(user()), XTQ.children(container)); NSArray containers = XTContainer.fetchXTContainers(editingContext(), qualifier, null); File tmpDir = Files.createTempDirectory("dl").toFile(); File tmp = null; try { String tmpDirPath = tmpDir.getAbsolutePath(); String fileName = new SimpleDateFormat("yyyyMMddHHmm").format(new Date()) + "-" + container.primaryKey(); tmpDir = new File(tmpDir.getAbsolutePath() + File.separator + fileName); tmpDir.mkdirs(); for (XTContainer c : containers) { XTContainerHelper.toFile(c, null, tmpDir, AppSupport.MAIN_LANGUAGE_CODE); } tmp = new File(tmpDirPath + File.separator + fileName + ".zip"); ZipUtils.zip(tmpDir, tmp); String mimeType = "multipart/x-zip", disp = "attachment;"; ERXResponse resp = new ERXResponse(); resp.setStatus(200); FileInputStream inStream = new FileInputStream(tmp); // resp.setStorePageInBacktrackCache(false); resp.disableClientCaching(); resp.removeHeadersForKey("Cache-Control"); resp.removeHeadersForKey("cache-control"); resp.removeHeadersForKey("pragma"); resp.setHeader(mimeType, "Content-Type"); resp.setHeader(disp + " filename=\"" + tmp.getName() + "\"", "content-disposition"); resp.setContentStream(inStream, 1024, tmp.length()); return resp; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { tmpDir.delete(); if (tmp != null) tmp.delete(); } } catch (Exception e) { // TODO: handle exception } return new ERXResponse(404); } public WOActionResults viewSearchAction() { setContainer(XTContainer.fetchXTContainerWithName(editingContext(), "search", user())); return getPage(ViewSearch.class); } public WOActionResults defaultAction() { setContainer(site()); return getPage(Main.class.getName()); } public WOActionResults viewProductAction() { return getPage(ViewProduct.class); } public WOActionResults viewRFIDAction() { return getPage(ViewRFID.class); } public WOActionResults viewRFIDLanguageAction() { return getPage(ViewRFIDLanguage.class); } public WOActionResults viewSectionAction() { return getPage(ViewSection.class); } public WOActionResults viewProductsAction() { return getPage(ViewProducts.class); } public WOActionResults viewBlogListAction() { return getPage(ViewBlogList.class); } public WOActionResults viewBlogArticleListAction() { return getPage(ViewBlogArticleList.class); } public WOActionResults viewProjectAction() { return getPage(ViewProject.class); } public WOActionResults viewArticleAction() { return getPage(ViewArticle.class); } public WOActionResults viewBlogArticleAction() { return getPage(ViewBlogArticle.class); } @XTDirectActionAnnotation(validClasses = "CATEGORY") public WOActionResults viewCategoryAction() { return getPage(ViewCategory.class); } public WOActionResults viewProjectsAction() { return getPage(ViewProjects.class); } public WOActionResults viewTechDownloadAction() { return getPage(ViewTechDownload.class); } public WOActionResults viewContactAction() { return getPage(ViewContact.class); } public WOActionResults viewConfigAluflexAction() { return getPage(ViewConfigAluflex.class); } public WOActionResults viewConfigNastriAction() { return getPage(ViewConfigNastri.class); } public WOActionResults viewConfigBanchiAction() { return getPage(ViewConfigBanchi.class); } public WOActionResults viewDownloadAction() { return getPage(ViewDownload.class); } private XTContainer shopContainer() { return XTContainer.fetchXTContainerWithName(editingContext(), "shop"); } public WOActionResults userAccountAction() { setContainer(shopContainer()); if (user() != null) { useSession(); return getPage(UserAccount.class); } return defaultShopAction(); } public WOActionResults forgotPasswordAction() { setContainer(site()); ViewMessagePage page = (ViewMessagePage) getPage(ViewMessagePage.class); page.info = "Indica il tuo indirizzo email"; return page; } public WOActionResults retrieveAccountDataAction() { setContainer(site()); String email = stringFormValueForKey("email"); if (email == null) email = stringFormValueForKey("username"); if (email == null) email = stringFormValueForKey(XTUser.THE_EMAIL_KEY); if (email == null) email = stringFormValueForKey(XTUser.THE_USERNAME_KEY); ViewMessagePage page = (ViewMessagePage) getPage(ViewMessagePage.class); if (email != null) { NSArray users = XTUser.fetchXTUsers(editingContext(), XTUser.THE_USERNAME.is(email).or(XTUser.THE_EMAIL.is(email)), null); if (users.count() > 0) { for (XTUser xtUser : users) { ERMailDeliveryHTML mail = new ERMailDeliveryHTML(); try { EmailPasswordLost mailcomponent = pageWithName(EmailPasswordLost.class); mailcomponent.user = xtUser; mail.setComponent(mailcomponent); mail.setFromAddress(EmailHelper.mailFrom(), EmailHelper.mailFromName()); mail.setSubject(EmailHelper.newRegistrationSubject(languageCode())); mail.setToAddress(email, xtUser.displayString()); mail.sendMail(); page.success = "Ti abbiamo reinviato la password all'indirizzo email specificato"; } catch (Exception e) { e.printStackTrace(); } } } else { page.error = "Siamo spiacenti non abbiamo trovato la tua registrazione"; } } return page; } public WOActionResults resetPasswordAction() { String uid = request().stringFormValueForKey("uid"); XTUser user = XTUser.fetchUserForUID(editingContext(), uid); String cc = request().stringFormValueForKey("cc"); String mm = request().stringFormValueForKey("mm"); String id = request().stringFormValueForKey("id"); if (cc.equals(user.theConfirmationCode()) && mm.equals(user.theEmail()) && Integer.parseInt(id) == user.idXTUser()) { ResetPassword page = ERXApplication.erxApplication().pageWithName(ResetPassword.class, context()); page.user = user; return page; } return new ERXResponse("Accesso negato", 403); } public WOActionResults updatePasswordAction() { String uid = request().stringFormValueForKey("uid"); XTUser user = XTUser.fetchUserForUID(editingContext(), uid); String pp = request().stringFormValueForKey("pp"); String pp2 = request().stringFormValueForKey("pp2"); String cc = request().stringFormValueForKey("cc"); String mm = request().stringFormValueForKey("mm"); String id = request().stringFormValueForKey("id"); if (cc.equals(user.theConfirmationCode()) && mm.equals(user.theEmail()) && Integer.parseInt(id) == user.idXTUser() && pp.equals(pp2)) { user.setTheConfirmationCode(org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric(48)); user.setThePassword(pp); user.setTheModificationDate(new NSTimestamp()); user.editingContext().saveChanges(); ResetPassword page = ERXApplication.erxApplication().pageWithName(ResetPassword.class, context()); page.success = true; return page; } return new ERXResponse("Accesso negato", 403); } public WOActionResults newRegistrationAction() { setContainer(site()); useSession(); UserRegistration page = null; page = pageWithName(UserRegistration.class); page.setEditingContext(editingContext()); return page; } public static boolean userMustCompleteRegistration(XTUser user) { if (user == null) { return true; } if (user.theName() == null) { return true; } if (user.theSurname() == null) { return true; } if (user.mainAddress() == null) { return true; } if (user.mainAddress().theStreet() == null) { return true; } if (user.mainAddress().theZipCode() == null) { return true; } if (user.mainAddress().theState() == null) { return true; } if (user.mainAddress().idCountry() == null) { return true; } return !user.allowPrivacy(); } public WOActionResults viewCartAction() { setContainer(shopContainer()); if (existingSession() != null) { if (xtroSession().currentCart() != null) { xtroSession().currentCart().clearCaches(); } } return getPage(ViewCart.class); } public XTOrder currentCart() { if (existingSession() != null) { return xtroSession().currentCart(); } return null; } public WOActionResults editAccountAction() { setContainer(site()); if (existingSession() != null) { if (user() != null) { EditUser page = (EditUser) getPage(EditUser.class); page.editAccountData = false; EOEditingContext ec = ERXEC.newEditingContext(); page.setSelectedRecord(user().localInstanceIn(ec)); return page; } } return newRegistrationAction(); } public WOActionResults confirmCartAction() { setContainer(site()); if (existingSession() != null) { ViewPaymentDelivery page = (ViewPaymentDelivery) getPage(ViewPaymentDelivery.class); if (currentCart() != null && user() != null) { if (userMustCompleteRegistration(user())) { EditUser editUserPage = (EditUser) editAccountAction(); editUserPage.context().request().setUserInfoForKey("Devi completare la tua registrazione", "warning"); editUserPage.context().request().setUserInfoForKey(true, "goToCheckout"); return editUserPage; } try { page.setTheCart(currentCart().localInstanceIn(page.editingContext())); } catch (Exception e) { e.printStackTrace(); } } return page; } return pageNotFoundAction(); } /* public WOActionResults loginAction() { useSession(); try { if (request().stringFormValueForKey("username") != null && user() == null) { setContainer(site()); ViewMessagePage page = (ViewMessagePage) getPage(ViewMessagePage.class); page.error = session().localizer().localizedStringForKeyWithDefault("Siamo spiacenti, ma il tuo accesso è fallito, verifica che i dati inseriti siano corretti"); return page; } String destinationPage = request().stringFormValueForKey("page"); if (user() != null) { if (currentCart() != null && currentCart().customer() == null) { XTUser u = user().localInstanceIn(currentCart().editingContext()); currentCart().setCustomerRelationship(u); currentCart().editingContext().saveChanges(); } else { EOQualifier qualifier = // @formatter:off ERXQ.and(XTOrder.THE_STATUS.is(XTOrder.STATUS_OPEN), XTOrder.FLAG_DELETED.isFalse(), XTOrder.FLAG_WISH_LIST.isFalse(), XTOrder.THE_STATUS_PAYMENT.is(XTOrder.PendingTransaction), XTOrder.CUSTOMER.is(user()), XTOrder.FLAG_FINALIZED.isFalse()); // @formatter:on NSArray orders = XTOrder.fetchXTOrders(editingContext(), qualifier, XTOrder.DATE_ORDER.descs()); if (orders != null && !orders.isEmpty()) xtroSession().setCurrentCart(orders.objectAtIndex(0)); } } if (destinationPage != null && destinationPage.equalsIgnoreCase("ViewPaymentDelivery")) { return confirmCartAction(); } return defaultShopAction(); } catch (Exception e) { } ViewMessagePage page = (ViewMessagePage) getPage(ViewMessagePage.class); page.error = "ATTENZIONE! Il tuo tentativo di accesso non è riuscito"; return page; } */ public WOActionResults loginAction() { useSession(); try { XTContainer container = container(); String da = request().stringFormValueForKey("da"); if (da.equals("login")) { da = "default"; } ERXMutableURL murl = new ERXMutableURL("/Apps/WebObjects/" + ERXApplication.application().name() + ".woa/wa/" + da); murl.setQueryParameter("id", container.primaryKey()); murl.setQueryParameter("lang", languageCode()); if (request().stringFormValueForKey("username") != null && user() == null) { setContainer(site()); murl.addQueryParameter("error", session().localizer().localizedStringForKeyWithDefault("Siamo spiacenti, ma il tuo accesso è fallito, verifica che i dati inseriti siano corretti")); } else if (user() != null) { murl.setQueryParameter("wosid", session().sessionID()); } ERXResponse redirect = new ERXResponse(301); redirect.setHeader(murl.toExternalForm(), "Location"); return redirect; } catch (Exception e) { } return pageNotFoundAction(); } public WOActionResults defaultShopAction() { setContainer(shopContainer()); return getPage(Main.class); } public WOActionResults fastRegistrationAction() { if (!valid_reCAPTCHA()) return new ERXResponse("non hai superato il recaptcha"); setContainer(site()); String regEmail = request().stringFormValueForKey("reg-email"); String regPassword = request().stringFormValueForKey("reg-password"); String regPasswordConfirmation = request().stringFormValueForKey("reg-password-confirmation"); String regNewsletter = request().stringFormValueForKey("newsletter"); boolean allowNewsletter = regNewsletter != null && (regNewsletter.equalsIgnoreCase("checked") || regNewsletter.equalsIgnoreCase("on") || regNewsletter.equalsIgnoreCase("true")); ERMailDeliveryHTML mail = new ERMailDeliveryHTML(); ViewMessagePage page = (ViewMessagePage) getPage(ViewMessagePage.class); if (regEmail == null) { page.error = "Non hai indicato l'indirizzo email"; return page; } if (!ERJavaMail.sharedInstance().isValidEmail(regEmail)) { page.error = "Non hai indicato l'indirizzo email correttamente"; return page; } if (regPassword == null) { page.error = "Non hai indicato la password"; return page; } if (regPassword.length() < 8) { page.error = "Non hai indicato la password correttamente, deve essere di 8 caratteri"; return page; } if (!regPassword.equals(regPasswordConfirmation)) { page.error = "Non hai indicato la password correttamente"; return page; } try { XTUser user = XTUser.createActiveUser(editingContext(), regEmail); user.setThePassword(regPassword); user.setTheEmail(regEmail); if (allowNewsletter) { user.setFlagSubscribeNewsletter(true); } editingContext().saveChanges(); useSession(); page.success = "Complimenti, la tua registrazione è completata!"; xtroSession().setEndUser(user.localInstanceIn(session().defaultEditingContext())); EmailUserRegistration regMailPage = pageWithName(EmailUserRegistration.class); mail.setComponent(regMailPage); regMailPage.setUser(user); try { mail.setFromAddress(AppSupport.AdminEmail()); mail.setToAddress(regEmail); mail.setBCCAddresses(new NSArray(ERJavaMail.sharedInstance().adminEmail())); mail.setSubject("Registrazione Utente"); mail.sendMail(); } catch (AddressException e) { // TODO Auto-generated catch block e.printStackTrace(); page.error = "Si sono verificati degli errori, contattaci per completare la registrazione"; return page; } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); page.error = "Si sono verificati degli errori, contattaci per completare la registrazione"; return page; } return page; } catch (IllegalStateException e) { page.error = "L'indirizzo email specificato corrisponde ad un account già registrato!"; return page; } } public WOActionResults contactAction() { LOG.debug(request()); System.out.println("lang " + languageCode()); if (!valid_reCAPTCHA()) { return new ERXResponse("Verifica del captcha fallita", 500); } NSMutableDictionary respdict = new NSMutableDictionary(); String subject = request().stringFormValueForKey("object"); String name = request().stringFormValueForKey("name"); String surname = request().stringFormValueForKey("surname"); String email = request().stringFormValueForKey("email"); String nation = request().stringFormValueForKey("nation"); String province = request().stringFormValueForKey("province"); String town = request().stringFormValueForKey("town"); String address = request().stringFormValueForKey("address"); String cap = request().stringFormValueForKey("cap"); String phone = request().stringFormValueForKey("phone"); String fax = request().stringFormValueForKey("fax"); String promocode = request().stringFormValueForKey("promocode"); String site = request().stringFormValueForKey("site"); String company = request().stringFormValueForKey("company"); String note = request().stringFormValueForKey("note"); String attachment = request().stringFormValueForKey("attachment"); String privacy = request().stringFormValueForKey("privacy"); NSTimestamp requestDate = new NSTimestamp(); String s = new SimpleDateFormat("dd/MM/yyyy").format(requestDate); boolean subscribe = privacy != null && (privacy.equalsIgnoreCase("checked") || privacy.equalsIgnoreCase("on") || privacy.equalsIgnoreCase("true")); if ((email != null) && (subscribe)) { try { // @formatter:off String html = null; if (languageCode().equals("ita")) { html = "
" + "

Gentile utente, grazie per la tua richiesta al sito Alutec.

" + "

Di seguito trovi il riepilogo dei dati della tua richiesta:

" + "


" + (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Ragione sociale: " + company + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (subject != null ? "Oggetto: " + subject + "" : "Oggetto non specificato") + "


" + (attachment != null ? "Link per il download
" : "") + (nation != null ? "Nazione: " + nation + "
" : "") + (province != null && !province.equalsIgnoreCase("null") ? "Provincia: " + province + "
" : "") + (town != null ? "Città: " + town + "
" : "") + (address != null ? "Indirizzo: " + address + "
" : "") + (cap != null ? "Cap/Zip: " + cap + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (fax != null ? "Fax: " + fax + "
" : "") + (promocode != null ? "Codice promo: " + promocode + "
" : "") + (site != null ? "Website: " + site + "
" : "") + (note != null ? "Messaggio: " + note + "" : "") + "
"; } else { html = "
" + "

Dear user, thank you for your request to the Alutec website.

" + "

Below you will find the summary of your request:

" + "


" + (name != null ? "Name: " + name + "
" : "") + (surname != null ? "Surname: " + surname + "
" : "") + (company != null ? "Company: " + company + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (subject != null ? "Object: " + subject + "" : "Undefined object") + "


" + (attachment != null ? "Download link
" : "") + (nation != null ? "Country: " + nation + "
" : "") + (province != null && !province.equalsIgnoreCase("null") ? "Province: " + province + "
" : "") + (town != null ? "Town: " + town + "
" : "") + (address != null ? "Address: " + address + "
" : "") + (cap != null ? "Cap/Zip: " + cap + "
" : "") + (phone != null ? "Phone: " + phone + "
" : "") + (fax != null ? "Fax: " + fax + "
" : "") + (promocode != null ? "Promo code: " + promocode + "
" : "") + (site != null ? "Website: " + site + "
" : "") + (note != null ? "Request: " + note + "" : "") + "
"; } // @formatter:on // @formatter:off String html4admin = "
" + "

Richiesta informazioni dal sito internet.

" + "

Di seguito trovi il riepilogo dei dati della richiesta:

" + "


" + (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (subject != null ? "Oggetto: " + subject + "" : "") + "


" + (attachment != null ? "Link per il download
" : "") + (nation != null ? "Nazione: " + nation + "
" : "") + (province != null && !province.equalsIgnoreCase("null") ? "Provincia: " + province + "
" : "") + (town != null ? "Città: " + town + "
" : "") + (address != null ? "Indirizzo: " + address + "
" : "") + (cap != null ? "Cap/Zip: " + cap + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (fax != null ? "Fax: " + fax + "
" : "") + (promocode != null ? "Codice promo: " + promocode + "
" : "") + (site != null ? "Website: " + site + "
" : "") + (company != null ? "Ragione sociale: " + company + "
" : "") + (note != null ? "Messaggio: " + note + "" : "") + "
"; // @formatter:on ERMailDeliveryHTML newmail = new ERMailDeliveryHTML(); newmail.setFromAddress("info@alutecsrl.it"); if (languageCode().equals("ita")) { newmail.setSubject("Richiesta inviata ad Alutec - " + (subject != null ? "Oggetto: " + subject + "" : "Oggetto non specificato")); } else { newmail.setSubject("Request sent to Alutec - " + (subject != null ? "Subject: " + subject + "" : "Undefined Subject")); } newmail.setReplyToAddress("info@alutecsrl.it"); newmail.setToAddress(email); newmail.setHTMLContent(html); newmail.sendMail(); ERMailDeliveryHTML adminmail = new ERMailDeliveryHTML(); adminmail.setFromAddress("info@alutecsrl.it"); adminmail.setReplyToAddress(email); adminmail.setSubject("Richiesta dal sito Alutec - " + (subject != null ? "Oggetto: " + subject + "" : "Oggetto non specificato")); adminmail.setToAddresses(AppSupport.AdminEmails()); adminmail.setHTMLContent(html4admin); adminmail.sendMail(); respdict.setObjectForKey(true, "success"); String msg = null; if (languageCode().equals("ita")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Richiesta inviata con successo"); } else { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Request sent"); } respdict.setObjectForKey(msg, "message"); EOEditingContext ec = ERXEC.newEditingContext(); XTUser user = XTUser.fetchXTUser(ec, email); if (user == null) { user = XTUser.createActiveUser(ec); user.setTheUsername(email); user.setTheEmail(email); } user.setTheName(name); user.setTheSurname(surname); user.setTheCompany(company); user.mainAddress().setTheCompanyName(company); user.mainAddress().setIdCountry(nation); if (province != null && !province.equalsIgnoreCase("null")) { user.mainAddress().setTheState(province); } user.mainAddress().setTheEmail(email); user.mainAddress().setTheStreet(address); user.mainAddress().setThePhone(phone); user.mainAddress().setTheFax(fax); user.mainAddress().setTheTown(town); user.mainAddress().setThePhone(phone); user.mainAddress().setTheWebSite(site); user.mainAddress().setTheZipCode(cap); user.setTheNotes(user.theNotes() + "\n" + s + ": contatto da form richiesta informazioni" + " " + subject); user.setIsConfirmed(true); user.setFlagSubscribeNewsletter(false); ec.saveChanges(); } catch (Exception e) { // TODO: handle exception } } else { String error = null; if (languageCode().equals("ita")) { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Assicurati di aver compilato correttamente tutti i campi"); } else { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Make sure you have filled in all fields correctly"); } respdict.setObjectForKey(false, "success"); respdict.setObjectForKey(error, "message"); } JSONResponse resp = new JSONResponse(respdict); return resp; } public WOActionResults configContactAluflexAction() { LOG.debug(request()); System.out.println("lang " + languageCode()); if (!valid_reCAPTCHA()) { return new ERXResponse("Verifica del captcha fallita", 500); } NSMutableDictionary respdict = new NSMutableDictionary(); String aluflex_lenght = request().stringFormValueForKey("aluflex_lenght"); String aluflex_width = request().stringFormValueForKey("aluflex_width"); String aluflex_engine = request().stringFormValueForKey("aluflex_engine"); String aluflex_material = request().stringFormValueForKey("aluflex_material"); String aluflex_single_weight = request().stringFormValueForKey("aluflex_single_weight"); String aluflex_dimension = request().stringFormValueForKey("aluflex_dimension"); String aluflex_dimension_go_min = request().stringFormValueForKey("aluflex_dimension_go_min"); String aluflex_dimension_go_max = request().stringFormValueForKey("aluflex_dimension_go_max"); String aluflex_weight = request().stringFormValueForKey("aluflex_weight"); String aluflex_temperature = request().stringFormValueForKey("aluflex_temperature"); String aluflex_hi = request().stringFormValueForKey("aluflex_hi"); String aluflex_hu = request().stringFormValueForKey("aluflex_hu"); String aluflex_legs = request().stringFormValueForKey("aluflex_legs"); String aluflex_dimension_height_min = request().stringFormValueForKey("aluflex_dimension_height_min"); String aluflex_dimension_height_max = request().stringFormValueForKey("aluflex_dimension_height_max"); String aluflex_guide = request().stringFormValueForKey("aluflex_guide"); String aluflex_wheel = request().stringFormValueForKey("aluflex_wheel"); String aluflex_foot = request().stringFormValueForKey("aluflex_foot"); String aluflex_gearmotor = request().stringFormValueForKey("aluflex_gearmotor"); String aluflex_gearmotor_altro = request().stringFormValueForKey("aluflex_gearmotor_altro"); String aluflex_speed = request().stringFormValueForKey("aluflex_speed"); String aluflex_speed_da = request().stringFormValueForKey("aluflex_speed_da"); String aluflex_speed_a = request().stringFormValueForKey("aluflex_speed_a"); String note = request().stringFormValueForKey("note"); String name = request().stringFormValueForKey("name"); String surname = request().stringFormValueForKey("surname"); String company = request().stringFormValueForKey("company"); String phone = request().stringFormValueForKey("phone"); String email = request().stringFormValueForKey("email"); String privacy = request().stringFormValueForKey("privacy"); NSTimestamp requestDate = new NSTimestamp(); String s = new SimpleDateFormat("dd/MM/yyyy").format(requestDate); boolean subscribe = privacy != null && (privacy.equalsIgnoreCase("checked") || privacy.equalsIgnoreCase("on") || privacy.equalsIgnoreCase("true")); if ((email != null) && (subscribe)) { try { // @formatter:off String html = null; if (languageCode().equals("ita")) { html = "
" + "

Gentile utente, grazie per la tua richiesta al sito Alutec.

" + "

Di seguito trovi il riepilogo dei dati della tua richiesta:

" + "


" + (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (aluflex_lenght != null ? "Lunghezza tratto rettilineo (mm): " + aluflex_lenght + "" : "") + "


" + (aluflex_width != null ? "Larghezza catena: " + aluflex_width + "
" : "") + (aluflex_engine != null ? "Motorizzazione: " + aluflex_engine + "" : "") + "


" + (aluflex_material != null ? "Materiale trasportato: " + aluflex_material + "
" : "") + (aluflex_single_weight != null ? "Peso per pezzo (kg): " + aluflex_single_weight + "
" : "") + (aluflex_dimension != null ? "Dimensione prodotto trasportato: " + aluflex_dimension + "
" : "") + (aluflex_dimension_go_min != null ? "Dimensione prodotto nel senso di avanzamento (mm) min: " + aluflex_dimension_go_min + "
" : "") + (aluflex_dimension_go_max != null ? "Dimensione prodotto nel senso di avanzamento (mm) max: " + aluflex_dimension_go_max + "
" : "") + (aluflex_weight != null ? "Carico complessivo sul trasporto (kg): " + aluflex_weight + "
" : "") + (aluflex_temperature != null ? "Temperatura materiale (°C): " + aluflex_temperature + "" : "") + "


" + (aluflex_hi != null ? "Altezza ingresso Hi (mm): " + aluflex_hi + "
" : "") + (aluflex_hu != null ? "Altezza ingresso Hu (mm): " + aluflex_hu + "
" : "") + (aluflex_legs != null ? "Numero gambe di sostegno: " + aluflex_legs + "
" : "") + (aluflex_dimension_height_min != null ? "Regolazione in altezza (mm) da: " + aluflex_dimension_height_min + "
" : "") + (aluflex_dimension_height_max != null ? "Regolazione in altezza (mm) a: " + aluflex_dimension_height_min + "
" : "") + (aluflex_guide != null ? "Guida laterale di contenimento: " + aluflex_guide + "
" : "") + (aluflex_wheel != null ? "Ruote: " + aluflex_wheel + "
" : "") + (aluflex_foot != null ? "Piedi di appoggio: " + aluflex_foot + "" : "") + "


" + (aluflex_gearmotor != null ? "Tipo di motore: " + aluflex_gearmotor + "
" : "") + (aluflex_gearmotor_altro != null ? "Tipo di motore: " + aluflex_gearmotor_altro + "
" : "") + (aluflex_speed != null ? "Velocità di trasporto (m/min): " + aluflex_speed + "
" : "") + (aluflex_speed_da != null ? "Velocità regolabile (m/min) da: " + aluflex_speed_da + "
" : "") + (aluflex_speed_a != null ? "Velocità regolabile (m/min) d: " + aluflex_speed_a + "" : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; } else { html = "
" + "

Gentile utente, grazie per la tua richiesta al sito Alutec.

" + "

Di seguito trovi il riepilogo dei dati della tua richiesta:

" + "


" + (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (aluflex_lenght != null ? "Lunghezza tratto rettilineo (mm): " + aluflex_lenght + "" : "") + "


" + (aluflex_width != null ? "Larghezza catena: " + aluflex_width + "
" : "") + (aluflex_engine != null ? "Motorizzazione: " + aluflex_engine + "" : "") + "


" + (aluflex_material != null ? "Materiale trasportato: " + aluflex_material + "
" : "") + (aluflex_single_weight != null ? "Peso per pezzo (kg): " + aluflex_single_weight + "
" : "") + (aluflex_dimension != null ? "Dimensione prodotto trasportato: " + aluflex_dimension + "
" : "") + (aluflex_dimension_go_min != null ? "Dimensione prodotto nel senso di avanzamento (mm) min: " + aluflex_dimension_go_min + "
" : "") + (aluflex_dimension_go_max != null ? "Dimensione prodotto nel senso di avanzamento (mm) max: " + aluflex_dimension_go_max + "
" : "") + (aluflex_weight != null ? "Carico complessivo sul trasporto (kg): " + aluflex_weight + "
" : "") + (aluflex_temperature != null ? "Temperatura materiale (°C): " + aluflex_temperature + "" : "") + "


" + (aluflex_hi != null ? "Altezza ingresso Hi (mm): " + aluflex_hi + "
" : "") + (aluflex_hu != null ? "Altezza ingresso Hu (mm): " + aluflex_hu + "
" : "") + (aluflex_legs != null ? "Numero gambe di sostegno: " + aluflex_legs + "
" : "") + (aluflex_dimension_height_min != null ? "Regolazione in altezza (mm) da: " + aluflex_dimension_height_min + "
" : "") + (aluflex_dimension_height_max != null ? "Regolazione in altezza (mm) a: " + aluflex_dimension_height_min + "
" : "") + (aluflex_guide != null ? "Guida laterale di contenimento: " + aluflex_guide + "
" : "") + (aluflex_wheel != null ? "Ruote: " + aluflex_wheel + "
" : "") + (aluflex_foot != null ? "Piedi di appoggio: " + aluflex_foot + "" : "") + "


" + (aluflex_gearmotor != null ? "Tipo di motore: " + aluflex_gearmotor + "
" : "") + (aluflex_gearmotor_altro != null ? "Tipo di motore: " + aluflex_gearmotor_altro + "
" : "") + (aluflex_speed != null ? "Velocità di trasporto (m/min): " + aluflex_speed + "
" : "") + (aluflex_speed_da != null ? "Velocità regolabile (m/min) da: " + aluflex_speed_da + "
" : "") + (aluflex_speed_a != null ? "Velocità regolabile (m/min) d: " + aluflex_speed_a + "" : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; } // @formatter:on // @formatter:off String html4admin = "
" + "

Richiesta al sito Alutec per configuratore ALUFLEX.

" + "

Di seguito trovi il riepilogo dei dati:

" + "


" + (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (aluflex_lenght != null ? "Lunghezza tratto rettilineo (mm): " + aluflex_lenght + "" : "") + "


" + (aluflex_width != null ? "Larghezza catena: " + aluflex_width + "
" : "") + (aluflex_engine != null ? "Motorizzazione: " + aluflex_engine + "" : "") + "


" + (aluflex_material != null ? "Materiale trasportato: " + aluflex_material + "
" : "") + (aluflex_single_weight != null ? "Peso per pezzo (kg): " + aluflex_single_weight + "
" : "") + (aluflex_dimension != null ? "Dimensione prodotto trasportato: " + aluflex_dimension + "
" : "") + (aluflex_dimension_go_min != null ? "Dimensione prodotto nel senso di avanzamento (mm) min: " + aluflex_dimension_go_min + "
" : "") + (aluflex_dimension_go_max != null ? "Dimensione prodotto nel senso di avanzamento (mm) max: " + aluflex_dimension_go_max + "
" : "") + (aluflex_weight != null ? "Carico complessivo sul trasporto (kg): " + aluflex_weight + "
" : "") + (aluflex_temperature != null ? "Temperatura materiale (°C): " + aluflex_temperature + "" : "") + "


" + (aluflex_hi != null ? "Altezza ingresso Hi (mm): " + aluflex_hi + "
" : "") + (aluflex_hu != null ? "Altezza ingresso Hu (mm): " + aluflex_hu + "
" : "") + (aluflex_legs != null ? "Numero gambe di sostegno: " + aluflex_legs + "
" : "") + (aluflex_dimension_height_min != null ? "Regolazione in altezza (mm) da: " + aluflex_dimension_height_min + "
" : "") + (aluflex_dimension_height_max != null ? "Regolazione in altezza (mm) a: " + aluflex_dimension_height_min + "
" : "") + (aluflex_guide != null ? "Guida laterale di contenimento: " + aluflex_guide + "
" : "") + (aluflex_wheel != null ? "Ruote: " + aluflex_wheel + "
" : "") + (aluflex_foot != null ? "Piedi di appoggio: " + aluflex_foot + "" : "") + "


" + (aluflex_gearmotor != null ? "Tipo di motore: " + aluflex_gearmotor + "
" : "") + (aluflex_gearmotor_altro != null ? "Tipo di motore: " + aluflex_gearmotor_altro + "
" : "") + (aluflex_speed != null ? "Velocità di trasporto (m/min): " + aluflex_speed + "
" : "") + (aluflex_speed_da != null ? "Velocità regolabile (m/min) da: " + aluflex_speed_da + "
" : "") + (aluflex_speed_a != null ? "Velocità regolabile (m/min) d: " + aluflex_speed_a + "" : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; // @formatter:on ERMailDeliveryHTML newmail = new ERMailDeliveryHTML(); newmail.setFromAddress("easycolor@easycolor.it"); if (languageCode().equals("ita")) { newmail.setSubject("Richiesta inviata a Alutec - Configuratore ALUFLEX"); } else { newmail.setSubject("Request sent to Alutec - ALUFLEX configurator"); } newmail.setReplyToAddress("easycolor@easycolor.it"); newmail.setToAddress(email); newmail.setHTMLContent(html); newmail.sendMail(); ERMailDeliveryHTML adminmail = new ERMailDeliveryHTML(); adminmail.setFromAddress(email); adminmail.setReplyToAddress(email); adminmail.setSubject("Richiesta dal sito Alutec - Configuratore ALUFLEX"); adminmail.setToAddresses(AppSupport.AdminEmails()); adminmail.setHTMLContent(html4admin); String filepath = request().stringFormValueForKey(PLUpload.filePathPrefix + "allegato"); String filename = request().stringFormValueForKey(PLUpload.fileNamePrefix + "allegato"); File f = new File(filepath); if (f.exists()) { ERMailFileAttachment attachment = new ERMailFileAttachment(filename, "001", f); adminmail.addAttachment(attachment); } adminmail.sendMail(); respdict.setObjectForKey(true, "success"); String msg = null; if (languageCode().equals("ita")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Richiesta inviata con successo"); } else { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Request sent"); } respdict.setObjectForKey(msg, "message"); // EOEditingContext ec = ERXEC.newEditingContext(); // XTUser user = XTUser.fetchXTUser(ec, email); // if (user == null) { // user = XTUser.createActiveUser(ec); // user.setTheUsername(email); // user.setTheEmail(email); // // } // user.setTheName(name); // user.setTheSurname(surname); // user.setTheCompany(company); // user.mainAddress().setTheCompanyName(company); // user.mainAddress().setIdCountry(nation); // if (province != null && !province.equalsIgnoreCase("null")) { // user.mainAddress().setTheState(province); // } // user.mainAddress().setTheEmail(email); // user.mainAddress().setTheStreet(address); // user.mainAddress().setThePhone(phone); // user.mainAddress().setTheFax(fax); // user.mainAddress().setTheTown(town); // user.mainAddress().setThePhone(phone); // user.mainAddress().setTheWebSite(site); // user.mainAddress().setTheZipCode(cap); // user.setTheNotes(user.theNotes() + "\n" + s + ": contatto da form richiesta informazioni" + " " + subject); // user.setIsConfirmed(true); // user.setFlagSubscribeNewsletter(false); // ec.saveChanges(); } catch (Exception e) { // TODO: handle exception } } else { String error = null; if (languageCode().equals("ita")) { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Assicurati di aver compilato correttamente tutti i campi"); } else { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Make sure you have filled in all fields correctly"); } respdict.setObjectForKey(false, "success"); respdict.setObjectForKey(error, "message"); } JSONResponse resp = new JSONResponse(respdict); return resp; } public WOActionResults configContactBanchiAction() { LOG.debug(request()); System.out.println("lang " + languageCode()); if (!valid_reCAPTCHA()) { return new ERXResponse("Verifica del captcha fallita", 500); } NSMutableDictionary respdict = new NSMutableDictionary(); String banchi_width = request().stringFormValueForKey("banchi_width"); String banchi_height = request().stringFormValueForKey("banchi_height"); String banchi_depth = request().stringFormValueForKey("banchi_depth"); String banchi_portate = request().stringFormValueForKey("banchi_portate"); String banchi_ruote = request().stringFormValueForKey("banchi_ruote"); String banchi_drawers = request().stringFormValueForKey("banchi_drawers"); String banchi_drawers_numero = request().stringFormValueForKey("banchi_drawers_numero"); String banchi_rip = request().stringFormValueForKey("banchi_rip"); String banchi_rip_numero = request().stringFormValueForKey("banchi_rip_numero"); String banchi_rip_portate = request().stringFormValueForKey("banchi_rip_portate"); String banchi_sup = request().stringFormValueForKey("banchi_sup"); String banchi_height_struttura = request().stringFormValueForKey("banchi_height_struttura"); String banchi_led = request().stringFormValueForKey("banchi_led"); String banchi_led_numero = request().stringFormValueForKey("banchi_led_numero"); String banchi_air = request().stringFormValueForKey("banchi_air"); String banchi_air_numero = request().stringFormValueForKey("banchi_air_numero"); String banchi_shelves = request().stringFormValueForKey("banchi_shelves"); String banchi_shelves_numero = request().stringFormValueForKey("banchi_shelves_numero"); String banchi_mosc = request().stringFormValueForKey("banchi_mosc"); String banchi_mosc_numero = request().stringFormValueForKey("banchi_mosc_numero"); String note = request().stringFormValueForKey("note"); String name = request().stringFormValueForKey("name"); String surname = request().stringFormValueForKey("surname"); String company = request().stringFormValueForKey("company"); String phone = request().stringFormValueForKey("phone"); String email = request().stringFormValueForKey("email"); String province = request().stringFormValueForKey("province"); String address = request().stringFormValueForKey("address"); String privacy = request().stringFormValueForKey("privacy"); NSTimestamp requestDate = new NSTimestamp(); String s = new SimpleDateFormat("dd/MM/yyyy").format(requestDate); boolean subscribe = privacy != null && (privacy.equalsIgnoreCase("checked") || privacy.equalsIgnoreCase("on") || privacy.equalsIgnoreCase("true")); if ((email != null) && (subscribe)) { try { // @formatter:off String intro_for_user = null; String intro_for_admin = null; String html = null; String html_for_admin = null; if (languageCode().equals("ita")) { intro_for_user = "
" + "

Gentile utente, grazie per la tua richiesta al sito Alutec.

" + "

Di seguito trovi il riepilogo dei dati della tua richiesta:

" + "


"; html = (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (company != null ? "Indirizzo: " + address + "
" : "") + (company != null ? "Provincia: " + province + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (banchi_width != null ? "Larghezza banco (mm): " + banchi_width + "
" : "") + (banchi_height != null ? "Altezza piano di lavoro (mm): " + banchi_height + "
" : "") + (banchi_depth != null ? "Profondità banco (mm): " + banchi_depth + "
" : "") + (banchi_portate != null ? "Portata del piano di lavoro (kg): " + banchi_portate + "
" : "") + (banchi_ruote != null ? "Appoggio a pavimento: " + banchi_ruote + "
" : "") + (banchi_drawers != null ? (banchi_drawers.equalsIgnoreCase("SI") ? "Cassetti: " + banchi_drawers + " - numero:" + banchi_drawers_numero + "
" : "Cassetti: " + banchi_drawers + "
") : "") + (banchi_rip != null ? (banchi_rip.equalsIgnoreCase("SI") ? "Ripiano d'appoggio inferiore: " + banchi_rip + " - numero:" + banchi_rip_numero + " - portata ogni ripiano: " + banchi_rip_portate + "
" : "Ripiano d'appoggio inferiore: " + banchi_rip + "
") : "") + (banchi_sup != null ? "Struttura superiore portante: " + banchi_sup + "
" : "") + "


" + (banchi_height_struttura != null ? "Altezza struttura portante (mm): " + banchi_height_struttura + "
" : "") + (banchi_led != null ? (banchi_led.equalsIgnoreCase("SI") ? "Plafoniera LED: " + banchi_led + " - numero: " + banchi_led_numero + "
" : "Plafoniera LED: " + banchi_led + "
") : "") + (banchi_air != null ? (banchi_air.equalsIgnoreCase("SI") ? "Distributore aria compressa: " + banchi_air + " - numero:" + banchi_air_numero + "
" : "Distributore aria compressa: " + banchi_air + "
") : "") + (banchi_shelves != null ? (banchi_shelves.equalsIgnoreCase("SI") ? "Mensole porta oggetti: " + banchi_shelves + " - numero: " + banchi_shelves_numero + "
" : "Mensole porta oggetti: " + banchi_shelves + "
") : "") + (banchi_mosc != null ? (banchi_mosc.equalsIgnoreCase("SI") ? "Sistema di scorrimento con moschettone: " + banchi_mosc + " - numero:" + banchi_mosc_numero + "
" : "Sistema di scorrimento con moschettone: " + banchi_mosc + "
") : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; } else if (languageCode().equals("eng")) { intro_for_user = "
" + "

Dear user, thank you for your request to the Alutec site.

" + "

Below you will find a summary of your request data:

" + "


"; html = (name != null ? "Name: " + name + "
" : "") + (surname != null ? "Surname: " + surname + "
" : "") + (company != null ? "Company: " + company + "
" : "") + (company != null ? "Address: " + address + "
" : "") + (company != null ? "Province: " + province + "
" : "") + (phone != null ? "Telephone: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (banchi_width != null ? "Bench width (mm): " + banchi_width + "
" : "") + (banchi_height != null ? "Working table height (mm): " + banchi_height + "
" : "") + (banchi_depth != null ? "Bench depth (mm): " + banchi_depth + "
" : "") + (banchi_portate != null ? "Worktop load capacity (kg): " + banchi_portate + "
" : "") + (banchi_ruote != null ? "Floor support: " + banchi_ruote + "
" : "") + (banchi_drawers != null ? (banchi_drawers.equalsIgnoreCase("SI") ? "Drawers: " + banchi_drawers + " - number:" + banchi_drawers_numero + "
" : "Drawers: " + banchi_drawers + "
") : "") + (banchi_rip != null ? (banchi_rip.equalsIgnoreCase("SI") ? "Lower shelf: " + banchi_rip + " - number:" + banchi_rip_numero + " - load capacity per shelf: " + banchi_rip_portate + "
" : " Lower shelf: " + banchi_rip + "
") : "") + (banchi_sup != null ? "Upper supporting structure: " + banchi_sup + "
" : "") + "


" + (banchi_height_struttura != null ? "Supporting structure height (mm): " + banchi_height_struttura + "
" : "") + (banchi_led != null ? (banchi_led.equalsIgnoreCase("SI") ? "LED ceiling light: " + banchi_led + " - number: " + banchi_led_numero + "
" : "LED ceiling light: " + banchi_led + "
") : "") + (banchi_air != null ? (banchi_air.equalsIgnoreCase("SI") ? "Compressed air distributor: " + banchi_air + " - number:" + banchi_air_numero + "
" : "Compressed air distributor: " + banchi_air + "
") : "") + (banchi_shelves != null ? (banchi_shelves.equalsIgnoreCase("SI") ? "Storage shelves: " + banchi_shelves + " - number: " + banchi_shelves_numero + "
" : "Storage shelves: " + banchi_shelves + "
") : "") + (banchi_mosc != null ? (banchi_mosc.equalsIgnoreCase("SI") ? "Sliding system with snap hook: " + banchi_mosc + " - number:" + banchi_mosc_numero + "
" : "Sliding system with snap hook: " + banchi_mosc + "
") : "") + "


" + (note != null ? "Message: " + note + "" : "") + "
"; } else if (languageCode().equals("deu")) { intro_for_user = "
" + "

Sehr geehrter Benutzer, vielen Dank für Ihre Anfrage an die Alutec-Website..

" + "

Nachfolgend finden Sie eine Zusammenfassung Ihrer Anfragedaten:

" + "


"; html = (name != null ? "Name: " + name + "
" : "") + (surname != null ? "Surname: " + surname + "
" : "") + (company != null ? "Company: " + company + "
" : "") + (company != null ? "Address: " + address + "
" : "") + (company != null ? "Province: " + province + "
" : "") + (phone != null ? "Telephone: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (banchi_width != null ? "Bench width (mm): " + banchi_width + "
" : "") + (banchi_height != null ? "Working table height (mm): " + banchi_height + "
" : "") + (banchi_depth != null ? "Bench depth (mm): " + banchi_depth + "
" : "") + (banchi_portate != null ? "Worktop load capacity (kg): " + banchi_portate + "
" : "") + (banchi_ruote != null ? "Floor support: " + banchi_ruote + "
" : "") + (banchi_drawers != null ? (banchi_drawers.equalsIgnoreCase("SI") ? "Drawers: " + banchi_drawers + " - number:" + banchi_drawers_numero + "
" : "Drawers: " + banchi_drawers + "
") : "") + (banchi_rip != null ? (banchi_rip.equalsIgnoreCase("SI") ? "Lower shelf: " + banchi_rip + " - number:" + banchi_rip_numero + " - load capacity per shelf: " + banchi_rip_portate + "
" : " Lower shelf: " + banchi_rip + "
") : "") + (banchi_sup != null ? "Upper supporting structure: " + banchi_sup + "
" : "") + "


" + (banchi_height_struttura != null ? "Supporting structure height (mm): " + banchi_height_struttura + "
" : "") + (banchi_led != null ? (banchi_led.equalsIgnoreCase("SI") ? "LED ceiling light: " + banchi_led + " - number: " + banchi_led_numero + "
" : "LED ceiling light: " + banchi_led + "
") : "") + (banchi_air != null ? (banchi_air.equalsIgnoreCase("SI") ? "Compressed air distributor: " + banchi_air + " - number:" + banchi_air_numero + "
" : "Compressed air distributor: " + banchi_air + "
") : "") + (banchi_shelves != null ? (banchi_shelves.equalsIgnoreCase("SI") ? "Storage shelves: " + banchi_shelves + " - number: " + banchi_shelves_numero + "
" : "Storage shelves: " + banchi_shelves + "
") : "") + (banchi_mosc != null ? (banchi_mosc.equalsIgnoreCase("SI") ? "Sliding system with snap hook: " + banchi_mosc + " - number:" + banchi_mosc_numero + "
" : "Sliding system with snap hook: " + banchi_mosc + "
") : "") + "


" + (note != null ? "Message: " + note + "" : "") + "
"; } intro_for_admin = "
" + "

Buongiorno Tecnico Alutec,

" + "

hai ricevuto una richiesta dal configuratore del sito per il prodotto \"Banchi di Lavoro\", di seguito il riepilogo dei dati della richiesta:

" + "


"; html_for_admin = (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (company != null ? "Indirizzo: " + address + "
" : "") + (company != null ? "Provincia: " + province + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (banchi_width != null ? "Larghezza banco (mm): " + banchi_width + "
" : "") + (banchi_height != null ? "Altezza piano di lavoro (mm): " + banchi_height + "
" : "") + (banchi_depth != null ? "Profondità banco (mm): " + banchi_depth + "
" : "") + (banchi_portate != null ? "Portata del piano di lavoro (kg): " + banchi_portate + "
" : "") + (banchi_ruote != null ? "Appoggio a pavimento: " + banchi_ruote + "
" : "") + (banchi_drawers != null ? (banchi_drawers.equalsIgnoreCase("SI") ? "Cassetti: " + banchi_drawers + " - numero:" + banchi_drawers_numero + "
" : "Cassetti: " + banchi_drawers + "
") : "") + (banchi_rip != null ? (banchi_rip.equalsIgnoreCase("SI") ? "Ripiano d'appoggio inferiore: " + banchi_rip + " - numero:" + banchi_rip_numero + " - portata ogni ripiano: " + banchi_rip_portate + "
" : "Ripiano d'appoggio inferiore: " + banchi_rip + "
") : "") + (banchi_sup != null ? "Struttura superiore portante: " + banchi_sup + "
" : "") + "


" + (banchi_height_struttura != null ? "Altezza struttura portante (mm): " + banchi_height_struttura + "
" : "") + (banchi_led != null ? (banchi_led.equalsIgnoreCase("SI") ? "Plafoniera LED: " + banchi_led + " - numero: " + banchi_led_numero + "
" : "Plafoniera LED: " + banchi_led + "
") : "") + (banchi_air != null ? (banchi_air.equalsIgnoreCase("SI") ? "Distributore aria compressa: " + banchi_air + " - numero:" + banchi_air_numero + "
" : "Distributore aria compressa: " + banchi_air + "
") : "") + (banchi_shelves != null ? (banchi_shelves.equalsIgnoreCase("SI") ? "Mensole porta oggetti: " + banchi_shelves + " - numero: " + banchi_shelves_numero + "
" : "Mensole porta oggetti: " + banchi_shelves + "
") : "") + (banchi_mosc != null ? (banchi_mosc.equalsIgnoreCase("SI") ? "Sistema di scorrimento con moschettone: " + banchi_mosc + " - numero:" + banchi_mosc_numero + "
" : "Sistema di scorrimento con moschettone: " + banchi_mosc + "
") : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; // @formatter:off String html4admin = intro_for_admin + html_for_admin; String html4user = intro_for_user + html; // @formatter:on ERMailDeliveryHTML newmail = new ERMailDeliveryHTML(); newmail.setFromAddress("tecnico@alutecsrl.it"); if (languageCode().equals("ita")) { newmail.setSubject("Richiesta inviata a Alutec - Configuratore BANCHI"); } else if (languageCode().equals("eng")) { newmail.setSubject("Request sent to Alutec - BENCH Configurator"); } else if (languageCode().equals("deu")) { newmail.setSubject("Anfrage an Alutec - BENCH Configurator gesendet"); } newmail.setReplyToAddress("tecnico@alutecsrl.it"); newmail.setToAddress(email); newmail.setHTMLContent(html4user); newmail.sendMail(); ERMailDeliveryHTML adminmail = new ERMailDeliveryHTML(); adminmail.setFromAddress("tecnico@alutecsrl.it"); adminmail.setReplyToAddress(email); adminmail.setSubject("Richiesta dal sito Alutec - Configuratore BANCHI"); adminmail.setToAddresses(AppSupport.AdminEmails()); adminmail.setHTMLContent(html4admin); String filepath = request().stringFormValueForKey(PLUpload.filePathPrefix + "allegato"); if (filepath != null) { String filename = request().stringFormValueForKey(PLUpload.fileNamePrefix + "allegato"); File f = new File(filepath); if (f.exists()) { ERMailFileAttachment attachment = new ERMailFileAttachment(filename, "001", f); adminmail.addAttachment(attachment); } } adminmail.sendMail(); respdict.setObjectForKey(true, "success"); String msg = null; if (languageCode().equals("ita")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Richiesta inviata con successo"); } else if (languageCode().equals("eng")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Request sent successfully"); } else if (languageCode().equals("deu")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Anfrage erfolgreich gesendet"); } respdict.setObjectForKey(msg, "message"); // EOEditingContext ec = ERXEC.newEditingContext(); // XTUser user = XTUser.fetchXTUser(ec, email); // if (user == null) { // user = XTUser.createActiveUser(ec); // user.setTheUsername(email); // user.setTheEmail(email); // // } // user.setTheName(name); // user.setTheSurname(surname); // user.setTheCompany(company); // user.mainAddress().setTheCompanyName(company); // user.mainAddress().setIdCountry(nation); // if (province != null && !province.equalsIgnoreCase("null")) { // user.mainAddress().setTheState(province); // } // user.mainAddress().setTheEmail(email); // user.mainAddress().setTheStreet(address); // user.mainAddress().setThePhone(phone); // user.mainAddress().setTheFax(fax); // user.mainAddress().setTheTown(town); // user.mainAddress().setThePhone(phone); // user.mainAddress().setTheWebSite(site); // user.mainAddress().setTheZipCode(cap); // user.setTheNotes(user.theNotes() + "\n" + s + ": contatto da form richiesta informazioni" + " " + subject); // user.setIsConfirmed(true); // user.setFlagSubscribeNewsletter(false); // ec.saveChanges(); } catch (Exception e) { e.printStackTrace(); } } else { String error = null; if (languageCode().equals("ita")) { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Assicurati di aver compilato correttamente tutti i campi"); } else { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Make sure you have filled in all fields correctly"); } respdict.setObjectForKey(false, "success"); respdict.setObjectForKey(error, "message"); } JSONResponse resp = new JSONResponse(respdict); return resp; } public WOActionResults configContactNastriAction() { LOG.debug(request()); System.out.println("lang " + languageCode()); if (!valid_reCAPTCHA()) { return new ERXResponse("Verifica del captcha fallita", 500); } NSMutableDictionary respdict = new NSMutableDictionary(); String nastri_type = request().stringFormValueForKey("nastri_type"); String nastri_prod_lenght = request().stringFormValueForKey("nastri_prod_lenght"); String nastri_prod_width = request().stringFormValueForKey("nastri_prod_width"); String nastri_prod_height = request().stringFormValueForKey("nastri_prod_height"); String nastri_prod_direction = request().stringFormValueForKey("nastri_prod_direction"); String nastri_weight_trans = request().stringFormValueForKey("nastri_weight_trans"); String nastri_prod_number = request().stringFormValueForKey("nastri_prod_number"); String nastri_direction = request().stringFormValueForKey("nastri_direction"); String nastri_direction_mono_sub = request().stringFormValueForKey("nastri_direction_mono_sub"); String nastri_lenght = request().stringFormValueForKey("nastri_lenght"); String nastri_width = request().stringFormValueForKey("nastri_width"); String motoriduttore_option = request().stringFormValueForKey("motoriduttore_option"); String nastri_speed = request().stringFormValueForKey("nastri_speed"); String nastri_engine = request().stringFormValueForKey("nastri_engine"); String nastri_rinvio = request().stringFormValueForKey("nastri_rinvio"); String nastri_lamiera = request().stringFormValueForKey("nastri_lamiera"); String nastri_acc_prod = request().stringFormValueForKey("nastri_acc_prod"); String nastri_acc_prod_numero = request().stringFormValueForKey("nastri_acc_prod_numero"); String nastri_uso_alim = request().stringFormValueForKey("nastri_uso_alim"); String nastri_tip_tap = request().stringFormValueForKey("nastri_tip_tap"); String input_altro = request().stringFormValueForKey("input_altro"); String nastri_sost = request().stringFormValueForKey("nastri_sost"); String nastri_hi = request().stringFormValueForKey("nastri_hi"); String nastri_hu = request().stringFormValueForKey("nastri_hu"); String nastri_terminali = request().stringFormValueForKey("nastri_terminali"); String nastri_guida_lat = request().stringFormValueForKey("nastri_guida_lat"); String note = request().stringFormValueForKey("note"); String name = request().stringFormValueForKey("name"); String surname = request().stringFormValueForKey("surname"); String company = request().stringFormValueForKey("company"); String address = request().stringFormValueForKey("address"); String province = request().stringFormValueForKey("province"); String phone = request().stringFormValueForKey("phone"); String email = request().stringFormValueForKey("email"); String privacy = request().stringFormValueForKey("privacy"); NSTimestamp requestDate = new NSTimestamp(); String s = new SimpleDateFormat("dd/MM/yyyy").format(requestDate); boolean subscribe = privacy != null && (privacy.equalsIgnoreCase("checked") || privacy.equalsIgnoreCase("on") || privacy.equalsIgnoreCase("true")); if ((email != null) && (subscribe)) { try { // @formatter:off String intro_for_user = null; String intro_for_admin = null; String html = null; String html_for_admin = null; if (languageCode().equals("ita")) { intro_for_user = "
" + "

Gentile utente, grazie per la tua richiesta al sito Alutec.

" + "

Di seguito trovi il riepilogo dei dati della tua richiesta:

" + "


"; html = (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (company != null ? "Indirizzo: " + address + "
" : "") + (company != null ? "Provincia: " + province + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (nastri_type != null ? "Tipologia di prodotto trasportato: " + nastri_type + "
" : "") + (nastri_prod_lenght != null ? "Lunghezza prodotto trasportato (mm): " + nastri_prod_lenght + "
" : "") + (nastri_prod_width != null ? "Larghezza prodotto trasportato (mm): " + nastri_prod_width + "
" : "") + (nastri_prod_height != null ? "Altezza prodotto trasportato (mm): " + nastri_prod_height + "
" : "") + (nastri_prod_direction != null ? "Direzione prodotto trasportato (mm): " + nastri_prod_direction + "
" : "") + (nastri_weight_trans != null ? "Peso prodotto trasportato (kg): " + nastri_weight_trans + "
" : "") + (nastri_prod_number != null ? "Numero prodotti trasportati: " + nastri_prod_number + "
" : "") + "


" + (nastri_direction != null ? "Direzione di avanzamento: " + nastri_direction + "
" : "") + (nastri_direction_mono_sub != null ? "Tiro/Spinta: " + nastri_direction_mono_sub + "
" : "") + (nastri_lenght != null ? "Lunghezza nastro (mm): " + nastri_lenght + "
" : "") + (nastri_width != null ? "Larghezza nastro (mm): " + nastri_width + "
" : "") + (motoriduttore_option != null ? "Completo di motoriduttore: " + motoriduttore_option + "
" : "") + (nastri_speed != null ? "Velocità di trasporto (m/min): " + nastri_speed + "
" : "") + "


" + (nastri_engine != null ? "Motorizzazione: " + nastri_engine + "
" : "") + (nastri_rinvio != null ? "Rinvio a penna: " + nastri_rinvio + "
" : "") + "


" + (nastri_lamiera != null ? "Lamiera di scorrimento: " + nastri_lamiera + "
" : "") + (nastri_acc_prod != null ? "Accumulo prodotti: " + nastri_acc_prod + "
" : "") + (nastri_acc_prod_numero != null ? "Accumulo prodotti (numero): " + nastri_acc_prod_numero + "
" : "") + (nastri_uso_alim != null ? "Uso alimentare: " + nastri_uso_alim + "
" : "") + (nastri_tip_tap != null ? "Tipologia di tappeto: " + nastri_tip_tap + "
" : "") + (input_altro != null ? "Tipologia di tappeto (ALTRO): " + input_altro + "
" : "") + "


" + (nastri_sost != null ? "Struttura di sostegno: " + nastri_sost + "
" : "") + (nastri_hi != null ? "Altezza in ingresso: " + nastri_hi + "
" : "") + (nastri_hu != null ? "Altezza in uscita: " + nastri_hu + "
" : "") + (nastri_terminali != null ? "Appoggio gambe di sostegno: " + nastri_terminali + "
" : "") + (nastri_guida_lat != null ? "Guida laterale di contenimento: " + nastri_guida_lat + "
" : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; } else if (languageCode().equals("eng")) { intro_for_user = "
" + "

Dear user, thank you for your request to the Alutec site.

" + "

Below you will find a summary of your request data:

" + "


"; html = (name != null ? "Name: " + name + "
" : "") + (surname != null ? "Surname: " + surname + "
" : "") + (company != null ? "Company: " + company + "
" : "") + (company != null ? "Address: " + address + "
" : "") + (company != null ? "Province: " + province + "
" : "") + (phone != null ? "Telephone: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (nastri_type != null ? "Type of product transported: " + nastri_type + "
" : "") + (nastri_prod_lenght != null ? "Length of transported product (mm): " + nastri_prod_lenght + "
" : "") + (nastri_prod_width != null ? "Width of transported product (mm): " + nastri_prod_width + "
" : "") + (nastri_prod_height != null ? "Height of transported product (mm): " + nastri_prod_height + "
" : "") + (nastri_prod_direction != null ? "Direction of transported product (mm): " + nastri_prod_direction + "
" : "") + (nastri_weight_trans != null ? "Product weight transported (kg): " + nastri_weight_trans + "
" : "") + "


" + (nastri_direction != null ? "Direction of advance: " + nastri_direction + "
" : "") + (nastri_direction_mono_sub != null ? "Shot/Push: " + nastri_direction_mono_sub + "
" : "") + (nastri_lenght != null ? "Ribbon length (mm): " + nastri_lenght + "
" : "") + (nastri_width != null ? "Ribbon width (mm): " + nastri_width + "
" : "") + (motoriduttore_option != null ? "Complete with gearmotor: " + motoriduttore_option + "
" : "") + (nastri_speed != null ? "Transport speed (m/min): " + nastri_speed + "
" : "") + "


" + (nastri_engine != null ? "Motorisation: " + nastri_engine + "
" : "") + (nastri_rinvio != null ? "Pen reference: " + nastri_rinvio + "
" : "") + "


" + (nastri_lamiera != null ? "Sliding plate: " + nastri_lamiera + "
" : "") + (nastri_prod_number != null ? "Number of products transported: " + nastri_prod_number + "
" : "") + (nastri_acc_prod != null ? "Product accumulation: " + nastri_acc_prod + "
" : "") + (nastri_acc_prod_numero != null ? "Product accumulation (number): " + nastri_acc_prod_numero + "
" : "") + (nastri_uso_alim != null ? "Food use: " + nastri_uso_alim + "
" : "") + (nastri_tip_tap != null ? "Type of carpet: " + nastri_tip_tap + "
" : "") + (input_altro != null ? "Type of carpet (OTHER): " + input_altro + "
" : "") + "


" + (nastri_sost != null ? "Support structure: " + nastri_sost + "
" : "") + (nastri_hi != null ? "Entrance height: " + nastri_hi + "
" : "") + (nastri_hu != null ? "Output height: " + nastri_hu + "
" : "") + (nastri_terminali != null ? "Support leg rest: " + nastri_terminali + "
" : "") + (nastri_guida_lat != null ? "Side containment guide: " + nastri_guida_lat + "
" : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; } else if (languageCode().equals("deu")) { intro_for_user = "
" + "

Sehr geehrter Benutzer, vielen Dank für Ihre Anfrage an die Alutec-Website..

" + "

Nachfolgend finden Sie eine Zusammenfassung Ihrer Anfragedaten:

" + "


"; html = (name != null ? "Name: " + name + "
" : "") + (surname != null ? "Surname: " + surname + "
" : "") + (company != null ? "Company: " + company + "
" : "") + (company != null ? "Address: " + address + "
" : "") + (company != null ? "Province: " + province + "
" : "") + (phone != null ? "Telephone: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (nastri_type != null ? "Art des transportierten Produkts: " + nastri_type + "
" : "") + (nastri_prod_lenght != null ? "Länge des transportierten Produkts (mm): " + nastri_prod_lenght + "
" : "") + (nastri_prod_width != null ? "Larghezza prodotto trasportato (mm): " + nastri_prod_width + "
" : "") + (nastri_prod_height != null ? "Altezza prodotto trasportato (mm): " + nastri_prod_height + "
" : "") + (nastri_prod_direction != null ? "Richtung des transportierten Produkts (mm): " + nastri_prod_direction + "
" : "") + (nastri_weight_trans != null ? "Gewicht des transportierten Produkts (kg): " + nastri_weight_trans + "
" : "") + "


" + (nastri_direction != null ? "Vorwärtsrichtung: " + nastri_direction + "
" : "") + (nastri_direction_mono_sub != null ? "Schuss/Stoß: " + nastri_direction_mono_sub + "
" : "") + (nastri_lenght != null ? "Bandlänge (mm): " + nastri_lenght + "
" : "") + (nastri_width != null ? "Bandbreite (mm): " + nastri_width + "
" : "") + (motoriduttore_option != null ? "Komplett mit Getriebemotor: " + motoriduttore_option + "
" : "") + (nastri_speed != null ? "Transportgeschwindigkeit (m/min): " + nastri_speed + "
" : "") + "


" + (nastri_engine != null ? "Motorisierung: " + nastri_engine + "
" : "") + (nastri_rinvio != null ? "Stiftreferenz: " + nastri_rinvio + "
" : "") + "


" + (nastri_lamiera != null ? "Gleitplatte: " + nastri_lamiera + "
" : "") + (nastri_prod_number != null ? "Anzahl der transportierten Produkte: " + nastri_prod_number + "
" : "") + (nastri_acc_prod != null ? "Produktakkumulation: " + nastri_acc_prod + "
" : "") + (nastri_acc_prod_numero != null ? "Produktakkumulation (Anzahl): " + nastri_acc_prod_numero + "
" : "") + (nastri_uso_alim != null ? "Lebensmittelverwendung: " + nastri_uso_alim + "
" : "") + (nastri_tip_tap != null ? "Art des Teppichs: " + nastri_tip_tap + "
" : "") + (input_altro != null ? "Teppichart (ANDERE): " + input_altro + "
" : "") + "


" + (nastri_sost != null ? "Stützstruktur: " + nastri_sost + "
" : "") + (nastri_hi != null ? "Eingangshöhe: " + nastri_hi + "
" : "") + (nastri_hu != null ? "Ausgabehöhe: " + nastri_hu + "
" : "") + (nastri_terminali != null ? "Stützbeinstütze: " + nastri_terminali + "
" : "") + (nastri_guida_lat != null ? "Guida laterale di contenimento: " + nastri_guida_lat + "
" : "") + "


" + (note != null ? "Nachricht: " + note + "" : "") + "
"; } intro_for_admin = "
" + "

Buongiorno Tecnico Alutec,

" + "

hai ricevuto una richiesta dal configuratore del sito per il prodotto \"Nastri di trasporto\", di seguito il riepilogo dei dati della richiesta:

" + "


"; html_for_admin = (name != null ? "Nome: " + name + "
" : "") + (surname != null ? "Cognome: " + surname + "
" : "") + (company != null ? "Azienda: " + company + "
" : "") + (company != null ? "Indirizzo: " + address + "
" : "") + (company != null ? "Provincia: " + province + "
" : "") + (phone != null ? "Telefono: " + phone + "
" : "") + (email != null ? "Email: " + email + "" : "") + "


" + (nastri_type != null ? "Tipologia di prodotto trasportato: " + nastri_type + "
" : "") + (nastri_prod_lenght != null ? "Lunghezza prodotto trasportato (mm): " + nastri_prod_lenght + "
" : "") + (nastri_prod_width != null ? "Larghezza prodotto trasportato (mm): " + nastri_prod_width + "
" : "") + (nastri_prod_height != null ? "Altezza prodotto trasportato (mm): " + nastri_prod_height + "
" : "") + (nastri_prod_direction != null ? "Direzione prodotto trasportato (mm): " + nastri_prod_direction + "
" : "") + (nastri_weight_trans != null ? "Peso prodotto trasportato (kg): " + nastri_weight_trans + "
" : "") + "


" + (nastri_direction != null ? "Direzione di avanzamento: " + nastri_direction + "
" : "") + (nastri_direction_mono_sub != null ? "Tiro/Spinta: " + nastri_direction_mono_sub + "
" : "") + (nastri_lenght != null ? "Lunghezza nastro (mm): " + nastri_lenght + "
" : "") + (nastri_width != null ? "Larghezza nastro (mm): " + nastri_width + "
" : "") + (nastri_speed != null ? "Velocità di trasporto (m/min): " + nastri_speed + "
" : "") + "


" + (nastri_engine != null ? "Motorizzazione: " + nastri_engine + "
" : "") + (nastri_rinvio != null ? "Rinvio a penna: " + nastri_rinvio + "
" : "") + "


" + (nastri_lamiera != null ? "Lamiera di scorrimento: " + nastri_lamiera + "
" : "") + (nastri_prod_number != null ? "Numero prodotti trasportati: " + nastri_prod_number + "
" : "") + (nastri_acc_prod != null ? "Accumulo prodotti: " + nastri_acc_prod + "
" : "") + (nastri_acc_prod_numero != null ? "Accumulo prodotti (numero): " + nastri_acc_prod_numero + "
" : "") + (nastri_uso_alim != null ? "Uso alimentare: " + nastri_uso_alim + "
" : "") + (nastri_tip_tap != null ? "Tipologia di tappeto: " + nastri_tip_tap + "
" : "") + (input_altro != null ? "Tipologia di tappeto (ALTRO): " + input_altro + "
" : "") + "


" + (nastri_sost != null ? "Struttura di sostegno: " + nastri_sost + "
" : "") + (nastri_hi != null ? "Altezza in ingresso: " + nastri_hi + "
" : "") + (nastri_hu != null ? "Altezza in uscita: " + nastri_hu + "
" : "") + (nastri_terminali != null ? "Appoggio gambe di sostegno: " + nastri_terminali + "
" : "") + (nastri_guida_lat != null ? "Guida laterale di contenimento: " + nastri_guida_lat + "
" : "") + "


" + (note != null ? "Messaggio: " + note + "" : "") + "
"; // @formatter:off String html4admin = intro_for_admin + html_for_admin; String html4user = intro_for_user + html; // @formatter:on ERMailDeliveryHTML newmail = new ERMailDeliveryHTML(); newmail.setFromAddress("tecnico@alutecsrl.it"); if (languageCode().equals("ita")) { newmail.setSubject("Richiesta inviata a Alutec - Configuratore NASTRI DI TRASPORTO"); } else if (languageCode().equals("eng")) { newmail.setSubject("Request sent to Alutec - CONVEYOR BELTS Configurator"); } else if (languageCode().equals("deu")) { newmail.setSubject("Anfrage an Alutec - TRANSPORTGÜRTEL Configurator gesendet"); } newmail.setReplyToAddress("tecnico@alutecsrl.it"); newmail.setToAddress(email); newmail.setHTMLContent(html4user); newmail.sendMail(); ERMailDeliveryHTML adminmail = new ERMailDeliveryHTML(); adminmail.setFromAddress("tecnico@alutecsrl.it"); adminmail.setReplyToAddress(email); adminmail.setSubject("Richiesta dal sito Alutec - Configuratore NASTRI DI TRASPORTO"); adminmail.setToAddresses(AppSupport.AdminEmails()); adminmail.setHTMLContent(html4admin); String filepath = request().stringFormValueForKey(PLUpload.filePathPrefix + "allegato"); if (filepath != null) { String filename = request().stringFormValueForKey(PLUpload.fileNamePrefix + "allegato"); File f = new File(filepath); if (f.exists()) { ERMailFileAttachment attachment = new ERMailFileAttachment(filename, "001", f); adminmail.addAttachment(attachment); } } adminmail.sendMail(); respdict.setObjectForKey(true, "success"); String msg = null; if (languageCode().equals("ita")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Richiesta inviata con successo"); } else if (languageCode().equals("eng")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Request sent successfully"); } else if (languageCode().equals("deu")) { msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Anfrage erfolgreich gesendet"); } respdict.setObjectForKey(msg, "message"); } catch (Exception e) { e.printStackTrace(); } } else { String error = null; if (languageCode().equals("ita")) { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Assicurati di aver compilato correttamente tutti i campi"); } else { error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Make sure you have filled in all fields correctly"); } respdict.setObjectForKey(false, "success"); respdict.setObjectForKey(error, "message"); } JSONResponse resp = new JSONResponse(respdict); return resp; } }