Esempio n. 1
0
 public static String getEmailMoveQuestion(FAQSetting faqSetting) {
   PortletRequestContext pcontext =
       (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
   PortletPreferences portletPref = pcontext.getRequest().getPreferences();
   String str = portletPref.getValue("emailMoveQuestion", "");
   if (isFieldEmpty(str)) {
     WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
     ResourceBundle res = context.getApplicationResourceBundle();
     str = res.getString("SendEmail.MoveQuetstion.Default");
   }
   faqSetting.setEmailMoveQuestion(str);
   return str;
 }
Esempio n. 2
0
 public static void getEmailSetting(FAQSetting faqSetting, boolean isNew, boolean isSettingForm) {
   PortletRequestContext pcontext =
       (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
   PortletPreferences portletPref = pcontext.getRequest().getPreferences();
   String emailContent = "";
   if (isNew) {
     emailContent = portletPref.getValue("SendMailAddNewQuestion", "");
   } else {
     if (isSettingForm) emailContent = portletPref.getValue("SendMailEditResponseQuestion", "");
   }
   WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
   ResourceBundle res = context.getApplicationResourceBundle();
   if (emailContent == null || emailContent.trim().length() < 1) {
     if (isNew) {
       emailContent = res.getString("SendEmail.AddNewQuestion.Default");
     } else {
       if (isSettingForm) emailContent = res.getString("SendEmail.EditQuestion.Default");
       else emailContent = res.getString("SendEmail.ResponseQuestion.Default");
     }
   }
   faqSetting.setEmailSettingSubject(res.getString("SendEmail.Default.Subject"));
   faqSetting.setEmailSettingContent(emailContent);
 }
Esempio n. 3
0
 public static void savePortletPreference(
     FAQSetting setting, String emailAddNewQuestion, String emailEditResponseQuestion) {
   try {
     PortletRequestContext pcontext =
         (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
     PortletPreferences portletPref = pcontext.getRequest().getPreferences();
     portletPref.setValue("display", setting.getDisplayMode());
     portletPref.setValue("orderBy", setting.getOrderBy());
     portletPref.setValue("orderType", setting.getOrderType());
     portletPref.setValue("isDiscussForum", String.valueOf(setting.getIsDiscussForum()));
     portletPref.setValue("idNameCategoryForum", setting.getIdNameCategoryForum());
     portletPref.setValue("enableAutomaticRSS", setting.isEnableAutomaticRSS() + "");
     portletPref.setValue("enableViewAvatar", setting.isEnableViewAvatar() + "");
     portletPref.setValue("enanbleVotesAndComments", setting.isEnanbleVotesAndComments() + "");
     portletPref.setValue(
         "enableAnonymousSubmitQuestion", setting.isEnableAnonymousSubmitQuestion() + "");
     portletPref.setValue("SendMailAddNewQuestion", emailAddNewQuestion);
     portletPref.setValue("SendMailEditResponseQuestion", emailEditResponseQuestion);
     portletPref.setValue("emailMoveQuestion", setting.getEmailMoveQuestion());
     portletPref.setValue(
         "isPostQuestionInRootCategory", setting.isPostQuestionInRootCategory() + "");
     portletPref.store();
   } catch (Exception e) {
     log.error("Fail to save portlet preferences: ", e);
   }
 }
Esempio n. 4
0
 public static void getPorletPreference(FAQSetting faqSetting) {
   PortletRequestContext pcontext =
       (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
   PortletPreferences portletPref = pcontext.getRequest().getPreferences();
   faqSetting.setEnableViewAvatar(
       Boolean.parseBoolean(portletPref.getValue("enableViewAvatar", "")));
   faqSetting.setEnableAutomaticRSS(
       Boolean.parseBoolean(portletPref.getValue("enableAutomaticRSS", "")));
   faqSetting.setEnanbleVotesAndComments(
       Boolean.parseBoolean(portletPref.getValue("enanbleVotesAndComments", "")));
   faqSetting.setEnableAnonymousSubmitQuestion(
       Boolean.parseBoolean(portletPref.getValue("enableAnonymousSubmitQuestion", "")));
   faqSetting.setDisplayMode(portletPref.getValue("display", ""));
   faqSetting.setOrderBy(portletPref.getValue("orderBy", ""));
   faqSetting.setOrderType(portletPref.getValue("orderType", ""));
   faqSetting.setIsDiscussForum(Boolean.parseBoolean(portletPref.getValue("isDiscussForum", "")));
   faqSetting.setIdNameCategoryForum(portletPref.getValue("idNameCategoryForum", ""));
   faqSetting.setEmailMoveQuestion(portletPref.getValue("emailMoveQuestion", ""));
   faqSetting.setPostQuestionInRootCategory(
       Boolean.parseBoolean(portletPref.getValue("isPostQuestionInRootCategory", "true")));
 }