use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyLanguageVM method calculateRemovedLanguages.
private List<String> calculateRemovedLanguages() {
final SessionStatus sessionStatus = getSessionStatus();
CollectSurvey survey = sessionStatus.getSurvey();
List<String> oldLanguageCodes = survey.getLanguages();
List<String> newLanguageCodes = getSelectedLanguageCodes();
List<String> removedLanguages = new ArrayList<String>();
for (String oldLangCode : oldLanguageCodes) {
if (!newLanguageCodes.contains(oldLangCode)) {
removedLanguages.add(Labels.getLabel(oldLangCode));
}
}
return removedLanguages;
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyBaseVM method isCurrentEditedSurvey.
public boolean isCurrentEditedSurvey(SurveySummary surveySummary) {
SessionStatus sessionStatus = getSessionStatus();
Integer editedPublishedSurveyId = sessionStatus.getPublishedSurveyId();
Integer editedSurveyId = getSurveyId();
if (editedSurveyId == null) {
if (editedPublishedSurveyId != null && surveySummary.isPublished() && editedPublishedSurveyId.equals(surveySummary.getId())) {
return true;
} else {
return false;
}
} else if (surveySummary.getId().equals(editedSurveyId)) {
return true;
} else {
return false;
}
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class TabsGroupVM method removeTab.
@Command
@NotifyChange({ "tabs" })
public void removeTab(@BindingParam("tab") UITab tab) {
if (tab.getTabs().isEmpty()) {
SessionStatus sessionStatus = getSessionStatus();
CollectSurvey survey = sessionStatus.getSurvey();
UIOptions uiOpts = survey.getUIOptions();
List<NodeDefinition> nodesPerTab = uiOpts.getNodesPerTab(tab, false);
if (nodesPerTab.isEmpty()) {
UITabSet parent = tab.getParent();
parent.removeTab(tab);
postTabChangedCommand(parent);
} else {
MessageUtil.showWarning("survey.layout.tab.remove.error.associated_nodes_present");
}
} else {
MessageUtil.showWarning("survey.layout.tab.remove.error.nested_tabs_present");
}
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyBaseVM method createBasicModuleParameters.
protected Map<String, String> createBasicModuleParameters() {
Integer surveyId = getSurveyId();
SessionStatus sessionStatus = getSessionStatus();
Integer publishedSurveyId = sessionStatus.getPublishedSurveyId();
boolean work = surveyId != null;
Integer usedSurveyId = surveyId != null ? surveyId : publishedSurveyId;
String surveyIdStr = usedSurveyId == null ? "" : usedSurveyId.toString();
String localeStr = sessionStatus.getCurrentLanguageCode();
Map<String, String> result = new HashMap<String, String>();
result.put("locale", localeStr);
result.put("work", Boolean.toString(work));
result.put("surveyId", surveyIdStr);
return result;
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyBaseVM method initCurrentLanguageCode.
private void initCurrentLanguageCode() {
SessionStatus sessionStatus = getSessionStatus();
currentLanguageCode = sessionStatus.getCurrentLanguageCode();
notifyChange("currentLanguageCode");
}
Aggregations