Search in sources :

Example 61 with Translator

use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.

the class Card2BrainCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller runCtrl;
    if (userCourseEnv.isCourseReadOnly()) {
        Translator trans = Util.createPackageTranslator(Card2BrainCourseNode.class, ureq.getLocale());
        String title = trans.translate("freezenoaccess.title");
        String message = trans.translate("freezenoaccess.message");
        runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else if (userCourseEnv.getIdentityEnvironment().getRoles().isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(Card2BrainCourseNode.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        runCtrl = new Card2BrainRunController(ureq, wControl, this.getModuleConfiguration());
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runCtrl, this, "o_card2brain_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : Card2BrainRunController(org.olat.course.nodes.card2brain.Card2BrainRunController) Translator(org.olat.core.gui.translator.Translator) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Card2BrainPeekViewController(org.olat.course.nodes.card2brain.Card2BrainPeekViewController) Card2BrainRunController(org.olat.course.nodes.card2brain.Card2BrainRunController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) Card2BrainEditController(org.olat.course.nodes.card2brain.Card2BrainEditController) ConditionEditController(org.olat.course.condition.ConditionEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 62 with Translator

use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.

the class ConditionConfigEasyController method addAssessmentSwitch.

private void addAssessmentSwitch(FormItemContainer formLayout) {
    assessSubContainer = FormLayoutContainer.createDefaultFormLayout("assessSubContainer", getTranslator());
    formLayout.add(assessSubContainer);
    Translator translator = getTranslator();
    final String[] assessmentSwitchKeys = new String[] { NODEPASSED_VAL_PASSED, NODEPASSED_VAL_SCORE };
    final String[] assessmentSwitchValues = new String[] { translator.translate("form.easy.assessmentSwitch.passed"), translator.translate("form.easy.assessmentSwitch.score") };
    String nodePassedInitVal = validatedCondition.getEasyModeNodePassedId();
    String cutInitStrValue = validatedCondition.getEasyModeCutValue();
    int cutInitValue = 0;
    assessmentSwitch = uifactory.addCheckboxesHorizontal("assessmentSwitch", null, formLayout, new String[] { "ison" }, new String[] { translate("form.easy.assessmentSwitch") });
    assessmentSwitch.addActionListener(FormEvent.ONCLICK);
    boolean selectedNodeIsInList = false;
    List<String> keysList = new ArrayList<String>();
    List<String> valuesList = new ArrayList<String>();
    if (nodeIdentList.size() > 0) {
        // there are nodes to be selected
        keysList.add(NO_NODE_SELECTED_IDENTIFYER);
        valuesList.add("- " + translator.translate("form.easy.nodePassed.select") + " -");
        for (int i = 0; i < nodeIdentList.size(); i++) {
            CourseNode courseNode = nodeIdentList.get(i);
            keysList.add(courseNode.getIdent());
            valuesList.add(courseNode.getShortName() + " (Id:" + courseNode.getIdent() + ")");
            if (courseNode.getIdent().equals(nodePassedInitVal))
                selectedNodeIsInList = true;
        }
    } else {
        // no nodes to be selected
        keysList.add(NO_NODE_SELECTED_IDENTIFYER);
        valuesList.add("- " + translator.translate("form.easy.nodePassed.noNodes"));
        // disable switch
        assessmentSwitch.setEnabled(false);
    }
    // add dummy value if needed
    if (nodePassedInitVal != null && !selectedNodeIsInList) {
        keysList.add(DELETED_NODE_IDENTIFYER);
        valuesList.add("- " + translator.translate("form.easy.nodePassed.deletedNode") + " -");
    }
    final String[] nodePassedKeys = new String[keysList.size()];
    keysList.toArray(nodePassedKeys);
    final String[] nodePassedValues = new String[valuesList.size()];
    valuesList.toArray(nodePassedValues);
    nodePassed = uifactory.addDropdownSingleselect("nodePassed", "form.easy.nodePassed", assessSubContainer, nodePassedKeys, nodePassedValues, null);
    if (nodePassedInitVal != null) {
        if (selectedNodeIsInList) {
            nodePassed.select(nodePassedInitVal, true);
        } else {
            nodePassed.select(DELETED_NODE_IDENTIFYER, true);
        }
    } else {
        nodePassed.select(NO_NODE_SELECTED_IDENTIFYER, true);
    }
    assessmentTypeSwitch = uifactory.addRadiosVertical("assessmentTypeSwitch", null, assessSubContainer, assessmentSwitchKeys, assessmentSwitchValues);
    assessmentTypeSwitch.setLabel("form.easy.assessmentSwitch.type", null);
    assessmentTypeSwitch.addActionListener(FormEvent.ONCLICK);
    if (nodePassedInitVal != null) {
        // has a node configured
        if (cutInitStrValue == null) {
            // with cut value
            assessmentTypeSwitch.select(NODEPASSED_VAL_PASSED, true);
        } else {
            cutInitValue = Integer.valueOf(cutInitStrValue);
            assessmentTypeSwitch.select(NODEPASSED_VAL_SCORE, true);
        }
        assessmentSwitch.select("ison", true);
        assessmentTypeSwitch.setVisible(true);
    } else {
        assessmentSwitch.select("ison", false);
        assessmentTypeSwitch.setVisible(false);
        assessmentTypeSwitch.select(NODEPASSED_VAL_PASSED, true);
    }
    cutValue = uifactory.addIntegerElement("cutval", "form.easy.cutValue", cutInitValue, assessSubContainer);
    cutValue.setDisplaySize(3);
}
Also used : Translator(org.olat.core.gui.translator.Translator) ArrayList(java.util.ArrayList) CourseNode(org.olat.course.nodes.CourseNode)

Example 63 with Translator

use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.

the class ConditionEditController method getWrappedDefaultAccessConditionVC.

/**
 * Get the condition editor wrapped as a generic accessability condition editor
 * @param title The title of this access condition, displayed as header in the surrounding fieldset
 * @return The wrapped condition editor component
 */
public VelocityContainer getWrappedDefaultAccessConditionVC(String title) {
    Translator accessTranslator = Util.createPackageTranslator(EditorMainController.class, getLocale());
    VelocityContainer defaultAccessConditionView = new VelocityContainer("defaultAccessConditionView", VELOCITY_ROOT + "/defaultaccessedit.html", accessTranslator, null);
    defaultAccessConditionView.put("defaultAccessConditionView", myContent);
    if (passwordConditionEditController != null) {
        defaultAccessConditionView.put("pwcond", passwordConditionEditController.getInitialComponent());
        defaultAccessConditionView.contextPut("renderPW", true);
    }
    defaultAccessConditionView.contextPut("title", title);
    return defaultAccessConditionView;
}
Also used : Translator(org.olat.core.gui.translator.Translator) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 64 with Translator

use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.

the class DialogCourseNodeConfiguration method getLinkText.

@Override
public String getLinkText(Locale locale) {
    Translator fallback = Util.createPackageTranslator(CourseNodeConfiguration.class, locale);
    Translator translator = Util.createPackageTranslator(this.getClass(), locale, fallback);
    return translator.translate("title_" + DialogCourseNode.TYPE);
}
Also used : Translator(org.olat.core.gui.translator.Translator)

Example 65 with Translator

use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.

the class FileUploadNotificationHandler method createTitleInfo.

@Override
public String createTitleInfo(Subscriber subscriber, Locale locale) {
    try {
        Translator translator = Util.createPackageTranslator(DialogCourseNodeRunController.class, locale);
        String displayname = repositoryManager.lookupDisplayNameByOLATResourceableId(subscriber.getPublisher().getResId());
        if (displayname == null) {
            checkPublisher(subscriber.getPublisher());
        }
        return translator.translate("notifications.header", new String[] { displayname });
    } catch (Exception e) {
        log.error("Error while creating assessment notifications for subscriber: " + subscriber.getKey(), e);
        checkPublisher(subscriber.getPublisher());
        return "-";
    }
}
Also used : Translator(org.olat.core.gui.translator.Translator)

Aggregations

Translator (org.olat.core.gui.translator.Translator)586 Identity (org.olat.core.id.Identity)62 Date (java.util.Date)54 Controller (org.olat.core.gui.control.Controller)54 RepositoryEntry (org.olat.repository.RepositoryEntry)54 Locale (java.util.Locale)52 PackageTranslator (org.olat.core.gui.translator.PackageTranslator)46 ArrayList (java.util.ArrayList)40 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)40 NodeEditController (org.olat.course.editor.NodeEditController)40 TitleItem (org.olat.core.commons.services.notifications.model.TitleItem)36 Roles (org.olat.core.id.Roles)36 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)36 SubscriptionListItem (org.olat.core.commons.services.notifications.model.SubscriptionListItem)32 Publisher (org.olat.core.commons.services.notifications.Publisher)30 SubscriptionInfo (org.olat.core.commons.services.notifications.SubscriptionInfo)30 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)30 MailBundle (org.olat.core.util.mail.MailBundle)28 ICourse (org.olat.course.ICourse)26 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)26