Search in sources :

Example 76 with Translator

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

the class BlogHandler method readyToDelete.

@Override
public boolean readyToDelete(RepositoryEntry entry, Identity identity, Roles roles, Locale locale, ErrorList errors) {
    ReferenceManager refM = CoreSpringFactory.getImpl(ReferenceManager.class);
    String referencesSummary = refM.getReferencesToSummary(entry.getOlatResource(), locale);
    if (referencesSummary != null) {
        Translator translator = Util.createPackageTranslator(RepositoryManager.class, locale);
        errors.setError(translator.translate("details.delete.error.references", new String[] { referencesSummary, entry.getDisplayname() }));
        return false;
    }
    return true;
}
Also used : Translator(org.olat.core.gui.translator.Translator) ReferenceManager(org.olat.resource.references.ReferenceManager)

Example 77 with Translator

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

the class WikiHandler method readyToDelete.

@Override
public boolean readyToDelete(RepositoryEntry entry, Identity identity, Roles roles, Locale locale, ErrorList errors) {
    ReferenceManager refM = CoreSpringFactory.getImpl(ReferenceManager.class);
    String referencesSummary = refM.getReferencesToSummary(entry.getOlatResource(), locale);
    if (referencesSummary != null) {
        Translator translator = Util.createPackageTranslator(RepositoryManager.class, locale);
        errors.setError(translator.translate("details.delete.error.references", new String[] { referencesSummary, entry.getDisplayname() }));
        return false;
    }
    return true;
}
Also used : Translator(org.olat.core.gui.translator.Translator) ReferenceManager(org.olat.resource.references.ReferenceManager)

Example 78 with Translator

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

the class CourseHandler method createWizardController.

@Override
public StepsMainRunController createWizardController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    // load the course structure
    final RepositoryEntry repoEntry = (RepositoryEntry) res;
    ICourse course = CourseFactory.loadCourse(repoEntry);
    Translator cceTranslator = Util.createPackageTranslator(CourseCreationHelper.class, ureq.getLocale());
    final CourseCreationConfiguration courseConfig = new CourseCreationConfiguration(course.getCourseTitle(), Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + repoEntry.getKey());
    // wizard finish callback called after "finish" is called
    final CourseCreationHelper ccHelper = new CourseCreationHelper(ureq.getLocale(), repoEntry, courseConfig, course);
    StepRunnerCallback finishCallback = new StepRunnerCallback() {

        public Step execute(UserRequest uureq, WindowControl control, StepsRunContext runContext) {
            // retrieve access and properties
            CourseAccessAndProperties accessAndProps = (CourseAccessAndProperties) runContext.get("accessAndProperties");
            courseConfig.setAccessAndProperties(accessAndProps);
            // here goes the code which reads out the wizards data from the runContext and then does some wizardry
            ccHelper.finalizeWorkflow(uureq);
            control.setInfo(CourseCreationMailHelper.getSuccessMessageString(uureq));
            // send notification mail
            final MailerResult mr = CourseCreationMailHelper.sentNotificationMail(uureq, ccHelper.getConfiguration());
            MailHelper.printErrorsAndWarnings(mr, control, uureq.getUserSession().getRoles().isOLATAdmin(), uureq.getLocale());
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    Step start = new CcStep00(ureq, courseConfig, repoEntry);
    StepsMainRunController ccSMRC = new StepsMainRunController(ureq, wControl, start, finishCallback, null, cceTranslator.translate("coursecreation.title"), "o_sel_course_create_wizard");
    return ccSMRC;
}
Also used : CcStep00(de.tuchemnitz.wizard.workflows.coursecreation.steps.CcStep00) MailerResult(org.olat.core.util.mail.MailerResult) CourseCreationHelper(de.tuchemnitz.wizard.workflows.coursecreation.CourseCreationHelper) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) Step(org.olat.core.gui.control.generic.wizard.Step) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) CourseAccessAndProperties(org.olat.course.editor.CourseAccessAndProperties) Translator(org.olat.core.gui.translator.Translator) CourseCreationConfiguration(de.tuchemnitz.wizard.workflows.coursecreation.model.CourseCreationConfiguration) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 79 with Translator

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

the class ImsCPHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    OLATResource resource = OLATResourceManager.getInstance().createOLATResourceInstance("FileResource.IMSCP");
    RepositoryEntry re = CoreSpringFactory.getImpl(RepositoryService.class).create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    Translator translator = Util.createPackageTranslator(CPContentController.class, locale);
    String initialPageTitle = translator.translate("cptreecontroller.newpage.title");
    CPManager.getInstance().createNewCP(resource, initialPageTitle);
    return re;
}
Also used : Translator(org.olat.core.gui.translator.Translator) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryService(org.olat.repository.RepositoryService)

Example 80 with Translator

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

the class PortfolioHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
    RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    PortfolioStructureMap mapTemp = eSTMgr.createAndPersistPortfolioMapTemplateFromEntry(initialAuthor, re);
    // add a page, as each map should have at least one per default!
    Translator pt = Util.createPackageTranslator(EPCreateMapController.class, locale);
    String pageTitle = pt.translate("new.page.title");
    String pageDescription = pt.translate("new.page.desc");
    ePFMgr.createAndPersistPortfolioPage(mapTemp, pageTitle, pageDescription);
    DBFactory.getInstance().commit();
    return re;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Translator(org.olat.core.gui.translator.Translator) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) EPStructureManager(org.olat.portfolio.manager.EPStructureManager) RepositoryService(org.olat.repository.RepositoryService)

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