Search in sources :

Example 6 with SessionStatus

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;
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus) ArrayList(java.util.ArrayList) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 7 with SessionStatus

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;
    }
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus)

Example 8 with SessionStatus

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");
    }
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 9 with SessionStatus

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;
}
Also used : HashMap(java.util.HashMap) SessionStatus(org.openforis.collect.designer.session.SessionStatus)

Example 10 with SessionStatus

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");
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus)

Aggregations

SessionStatus (org.openforis.collect.designer.session.SessionStatus)21 CollectSurvey (org.openforis.collect.model.CollectSurvey)9 Command (org.zkoss.bind.annotation.Command)3 CodeList (org.openforis.idm.metamodel.CodeList)2 ModelVersion (org.openforis.idm.metamodel.ModelVersion)2 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)2 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)2 NotifyChange (org.zkoss.bind.annotation.NotifyChange)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 MessageUtil (org.openforis.collect.designer.util.MessageUtil)1 ConfirmParams (org.openforis.collect.designer.util.MessageUtil.ConfirmParams)1 CodeListImportProcess (org.openforis.collect.manager.codelistimport.CodeListImportProcess)1 CodeListImportStatus (org.openforis.collect.manager.codelistimport.CodeListImportStatus)1 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)1 UITabSet (org.openforis.collect.metamodel.ui.UITabSet)1 Schema (org.openforis.idm.metamodel.Schema)1 Secured (org.springframework.security.access.annotation.Secured)1 Init (org.zkoss.bind.annotation.Init)1