Search in sources :

Example 36 with PackageTranslator

use of org.olat.core.gui.translator.PackageTranslator in project openolat by klemens.

the class ProjectBrokerCourseNode method informOnDelete.

/**
 * @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
 *      org.olat.course.ICourse)
 */
@Override
public String informOnDelete(Locale locale, ICourse course) {
    Translator trans = new PackageTranslator(PACKAGE_PROJECTBROKER, locale);
    CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
    List<Property> list = cpm.listCourseNodeProperties(this, null, null, null);
    // properties exist
    if (list.size() != 0)
        return trans.translate(NLS_WARN_NODEDELETE);
    File fDropboxFolder = new File(FolderConfig.getCanonicalRoot() + DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), this));
    // Dropbox folder contains files
    if (fDropboxFolder.exists() && fDropboxFolder.list().length > 0)
        return trans.translate(NLS_WARN_NODEDELETE);
    File fReturnboxFolder = new File(FolderConfig.getCanonicalRoot() + ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), this));
    // Returnbox folder contains files
    if (fReturnboxFolder.exists() && fReturnboxFolder.list().length > 0)
        return trans.translate(NLS_WARN_NODEDELETE);
    // no data yet.
    return null;
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Property(org.olat.properties.Property) File(java.io.File) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 37 with PackageTranslator

use of org.olat.core.gui.translator.PackageTranslator in project openolat by klemens.

the class ProjectBrokerCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to access tasks
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
        String title = trans.translate(NLS_GUESTNOACCESS_TITLE);
        String message = trans.translate(NLS_GUESTNOACCESS_MESSAGE);
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        // Add message id to business path if nodemcd is available
        if (nodecmd != null) {
            try {
                Long projectId = Long.valueOf(nodecmd);
                BusinessControlFactory bcf = BusinessControlFactory.getInstance();
                BusinessControl businessControl = bcf.createFromString("[Project:" + projectId + "]");
                wControl = bcf.createBusinessWindowControl(businessControl, wControl);
            } catch (NumberFormatException e) {
                // ups, nodecmd is not a message, what the heck is it then?
                log.warn("Could not create message ID from given nodemcd::" + nodecmd, e);
            }
        }
        controller = ProjectBrokerControllerFactory.createRunController(ureq, wControl, userCourseEnv, this);
    }
    Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_projectbroker_icon");
    return new NodeRunConstructionResult(wrapperCtrl);
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) BusinessControl(org.olat.core.id.context.BusinessControl) Roles(org.olat.core.id.Roles) BusinessControlFactory(org.olat.core.id.context.BusinessControlFactory) MSEditFormController(org.olat.course.nodes.ms.MSEditFormController) TaskController(org.olat.course.nodes.ta.TaskController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) DropboxController(org.olat.course.nodes.ta.DropboxController) ProjectBrokerIdentityListCourseNodeController(org.olat.course.nodes.projectbroker.ProjectBrokerIdentityListCourseNodeController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) ProjectBrokerCourseEditorController(org.olat.course.nodes.projectbroker.ProjectBrokerCourseEditorController) ProjectListController(org.olat.course.nodes.projectbroker.ProjectListController) ReturnboxController(org.olat.course.nodes.ta.ReturnboxController) Controller(org.olat.core.gui.control.Controller) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 38 with PackageTranslator

use of org.olat.core.gui.translator.PackageTranslator in project openolat by klemens.

the class IQSURVCourseNode method informOnDelete.

/**
 * @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
 *      org.olat.course.ICourse)
 */
@Override
public String informOnDelete(Locale locale, ICourse course) {
    // Check if there are qtiresults for this questionnaire
    String repositorySoftKey = (String) getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    Long repKey = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, true).getKey();
    if (QTIResultManager.getInstance().hasResultSets(course.getResourceableId(), this.getIdent(), repKey)) {
        return new PackageTranslator(PACKAGE_IQ, locale).translate("info.nodedelete");
    }
    return null;
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator)

Example 39 with PackageTranslator

use of org.olat.core.gui.translator.PackageTranslator in project openolat by klemens.

the class MSCourseNode method informOnDelete.

/**
 * @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
 *      org.olat.course.ICourse)
 */
@Override
public String informOnDelete(Locale locale, ICourse course) {
    CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
    List<Property> list = cpm.listCourseNodeProperties(this, null, null, null);
    // no properties created yet
    if (list.size() == 0)
        return null;
    Translator trans = new PackageTranslator(PACKAGE_MS, locale);
    return trans.translate("warn.nodedelete");
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 40 with PackageTranslator

use of org.olat.core.gui.translator.PackageTranslator in project openolat by klemens.

the class TACourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to access tasks
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
        String title = trans.translate(NLS_GUESTNOACCESS_TITLE);
        String message = trans.translate(NLS_GUESTNOACCESS_MESSAGE);
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        controller = new TACourseNodeRunController(ureq, wControl, userCourseEnv, this, ne, false);
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_ta_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) TACourseNodeRunController(org.olat.course.nodes.ta.TACourseNodeRunController) Roles(org.olat.core.id.Roles) MSEditFormController(org.olat.course.nodes.ms.MSEditFormController) TACourseNodeRunController(org.olat.course.nodes.ta.TACourseNodeRunController) TAIdentityListCourseNodeController(org.olat.course.nodes.ta.TAIdentityListCourseNodeController) TACourseNodeEditController(org.olat.course.nodes.ta.TACourseNodeEditController) TaskController(org.olat.course.nodes.ta.TaskController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) DropboxController(org.olat.course.nodes.ta.DropboxController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) DropboxScoringViewController(org.olat.course.nodes.ta.DropboxScoringViewController) ReturnboxController(org.olat.course.nodes.ta.ReturnboxController) Controller(org.olat.core.gui.control.Controller) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Aggregations

PackageTranslator (org.olat.core.gui.translator.PackageTranslator)40 Translator (org.olat.core.gui.translator.Translator)34 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)8 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)8 Property (org.olat.properties.Property)8 Controller (org.olat.core.gui.control.Controller)6 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)6 Roles (org.olat.core.id.Roles)6 NodeEditController (org.olat.course.editor.NodeEditController)6 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)6 File (java.io.File)4 FormMultipartItem (org.olat.core.gui.components.form.flexible.FormMultipartItem)4 AssessmentCourseNodeController (org.olat.course.assessment.ui.tool.AssessmentCourseNodeController)4 MSEditFormController (org.olat.course.nodes.ms.MSEditFormController)4 DropboxController (org.olat.course.nodes.ta.DropboxController)4 ReturnboxController (org.olat.course.nodes.ta.ReturnboxController)4 TaskController (org.olat.course.nodes.ta.TaskController)4 Locale (java.util.Locale)2 ValidationError (org.olat.core.gui.components.form.ValidationError)2 BusinessControl (org.olat.core.id.context.BusinessControl)2