/**
  * Actually submits the selected translation
  *
  * @param userName The content of the User Name Field
  * @param userEmail The content of the User E-Mail address Field
  */
 public void submitTranslation(String userName, String userEmail, boolean contribute) {
   if (this.isValidEmailAddress(userEmail)) {
     this.ui.alert(InternationalisationUtils.getI18NString(I18N_COMMON_INVALID_EMAIL));
   } else {
     String subject = "FrontlineSMS translation: " + this.languageBundle.getLanguageName();
     String textContent =
         "Sent translation: "
             + this.languageBundle.getLanguageName()
             + " ("
             + this.languageBundle.getLanguageCode()
             + ").\n"
             + userName
             + (contribute ? " would" : " wouldn't")
             + " like to appear as a contributor for this translation.";
     try {
       FrontlineUtils.sendToFrontlineSupport(
           userName,
           userEmail,
           subject,
           textContent,
           InternationalisationUtils.getLanguageDirectory()
               + File.separator
               + languageBundle.getFilename());
       this.removeDialog();
       this.ui.infoMessage(InternationalisationUtils.getI18NString(I18N_TRANSLATION_SENT));
     } catch (EmailException e) {
       this.ui.alert(InternationalisationUtils.getI18NString(I18N_UNABLE_SEND_TRANSLATION));
     }
   }
 }
Ejemplo n.º 2
0
 public IncomingFormMatcher(ApplicationContext appCon) {
   vanillaFormDao = (FormDao) appCon.getBean("formDao");
   formDao = (MedicFormDao) appCon.getBean("MedicFormDao");
   formResponseDao = (MedicFormResponseDao) appCon.getBean("MedicFormResponseDao");
   formFieldResponseDao = (MedicFormFieldResponseDao) appCon.getBean("MedicFormFieldResponseDao");
   patientDao = (PatientDao) appCon.getBean("PatientDao");
   chwDao = (CommunityHealthWorkerDao) appCon.getBean("CHWDao");
   ((EventBus) appCon.getBean("eventBus")).registerObserver(this);
   // create the test harness
   ExtendedThinlet thinlet = new ExtendedThinlet();
   Object panel = thinlet.createPanel("mainPanel");
   thinlet.setWeight(panel, 1, 1);
   Object button = thinlet.createButton("Click me to test form handling");
   thinlet.setAction(button, "testHandler", null, this);
   thinlet.add(panel, button);
   thinlet.add(panel);
   // set up the date formatter
   String dateString =
       InternationalisationUtils.getI18NString(FrontlineSMSConstants.DATEFORMAT_YMD);
   dateString = dateString.toLowerCase();
   dateString = dateString.replace("mm", "MM");
   dateString = dateString.replace("yyyy", "yy");
   shortFormatter = new SimpleDateFormat(dateString);
   longFormatter = InternationalisationUtils.getDateFormat();
   //	FrameLauncher f = new FrameLauncher("Test form handling",thinlet,200,100,null)
   // { public void windowClosing(WindowEvent e){  dispose(); }};
 }