Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@
import org.exoplatform.poll.service.PollService;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIPopupComponent;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.input.UICheckBoxInput;
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.webui.form.validator.PositiveNumberFormatValidator;

/**
Expand Down Expand Up @@ -96,7 +98,7 @@ public UIPollForm() throws Exception {
timeOut.addValidator(PositiveNumberFormatValidator.class);
UICheckBoxInput VoteAgain = new UICheckBoxInput(FIELD_AGAINVOTE_CHECKBOX, FIELD_AGAINVOTE_CHECKBOX, false);
UICheckBoxInput MultiVote = new UICheckBoxInput(FIELD_MULTIVOTE_CHECKBOX, FIELD_MULTIVOTE_CHECKBOX, false);
addUIFormInput(question);
addUIFormInput(question.addValidator(MandatoryValidator.class));
addUIFormInput(timeOut);
addUIFormInput(VoteAgain);
addUIFormInput(MultiVote);
Expand All @@ -107,6 +109,7 @@ private void initMultiValuesField(List<String> list) throws Exception {
if (uiFormMultiValue != null)
removeChildById(FIELD_OPTIONS);
uiFormMultiValue = createUIComponent(UIFormMultiValueInputSet.class, null, null);
uiFormMultiValue.addValidator(MandatoryValidator.class);
uiFormMultiValue.setId(FIELD_OPTIONS);
uiFormMultiValue.setName(FIELD_OPTIONS);
uiFormMultiValue.setType(UIFormStringInput.class);
Expand Down Expand Up @@ -188,8 +191,13 @@ public void execute(Event<UIPollForm> event) throws Exception {
boolean isAgainVote = uiForm.getUICheckBoxInput(FIELD_AGAINVOTE_CHECKBOX).isChecked();
boolean isMultiVote = uiForm.getUICheckBoxInput(FIELD_MULTIVOTE_CHECKBOX).isChecked();
String sms = ForumUtils.EMPTY_STR;
List<UIComponent> childs = uiForm.uiFormMultiValue.getChildren();
List<String> values = (List<String>) uiForm.uiFormMultiValue.getValue();
List<String> values_ = new ArrayList<String>();
if (childs.size() != values.size()) {
uiForm.warning("UIPollForm.msg.FillAllOptions",false);
return;
}
int i = 1;
for (String value : values) {
if (!ForumUtils.isEmpty(value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ UIPollForm.label.MultiVote=Allow Multiple Choices
UIPollForm.msg.NotQuestion=Please enter the question.
UIPollForm.msg.Minimum=Please add at least 2 options.
UIPollForm.msg.Maximum=Too many options.
UIPollForm.msg.longTimeOut=Value for "{0}" is too big.
UIPollForm.msg.longTimeOut=Value for "{0}" is too big.
UIPollForm.msg.FillAllOptions=Please fill all options.
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ UIPollForm.msg.NotQuestion=Please enter the question.
UIPollForm.msg.Minimum=Please add at least 2 options.
UIPollForm.msg.Maximum=Too many options.
UIPollForm.msg.longTimeOut=Value for "{0}" is too big.
UIPollForm.msg.FillAllOptions=Please fill all options.
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ UIPollForm.msg.NotQuestion=Please enter the question.
UIPollForm.msg.Minimum=Please add more options.
UIPollForm.msg.Maximum=Too many options. Please remove some.
UIPollForm.msg.longTimeOut=Value for "{0}" is too big.
UIPollForm.msg.FillAllOptions=Please fill all options.
#############################################################################
# UIForumIconState #
#############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ UIPollForm.msg.NotQuestion=Saisissez la question
UIPollForm.msg.Minimum=Ajoutez plus d'options.
UIPollForm.msg.Maximum=Trop d'options, supprimez-en.
UIPollForm.msg.longTimeOut=La valeur pour "{0}" est trop grande.
UIPollForm.msg.FillAllOptions=S'il vous pla�t remplir toutes les options.
#############################################################################
# UIForumIconState #
#############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ UIPollForm.msg.NotQuestion=Prego inserisci la domanda.
UIPollForm.msg.Minimum=Prego aggiungi pi\u00f9 opzioni.
UIPollForm.msg.Maximum=Troppe opzioni. Prego cancellare alcune.
UIPollForm.msg.longTimeOut=Valore per "{0}" \u00e8 troppo grande.
UIPollForm.msg.FillAllOptions=Please fill all options.
#############################################################################
# UIForumIconState #
#############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ UIPollForm.msg.NotQuestion=Vraag is leeg
UIPollForm.msg.Minimum=Optie is leeg of u hebt minder dan 2 opties
UIPollForm.msg.Maximum=Te veel opties
UIPollForm.msg.longTimeOut=Ingegeven waarde voor "{0}" heeft de maximum waarde overschreden
UIPollForm.msg.FillAllOptions=Please fill all options.
#############################################################################
# UIForumIconState #
#############################################################################
Expand Down