Search in sources :

Example 1 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class GTACoachedGroupGradingController method doOpenAssessmentForm.

private void doOpenAssessmentForm(UserRequest ureq) {
    removeAsListenerAndDispose(assessmentCtrl);
    RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
    assessmentCtrl = new GroupAssessmentController(ureq, getWindowControl(), courseEntry, gtaNode, assessedGroup);
    listenTo(assessmentCtrl);
    String title = translate("grading");
    cmc = new CloseableModalController(getWindowControl(), "close", assessmentCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 2 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class GTACoachedParticipantListController method collectIdentities.

private void collectIdentities(Consumer<Identity> participantCollector) {
    Set<Identity> duplicateKiller = new HashSet<>();
    CourseGroupManager cgm = coachCourseEnv.getCourseEnvironment().getCourseGroupManager();
    boolean admin = coachCourseEnv.isAdmin();
    List<BusinessGroup> coachedGroups = admin ? cgm.getAllBusinessGroups() : coachCourseEnv.getCoachedGroups();
    List<Identity> participants = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name());
    for (Identity participant : participants) {
        if (!duplicateKiller.contains(participant)) {
            participantCollector.accept(participant);
            duplicateKiller.add(participant);
        }
    }
    RepositoryEntry re = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    boolean repoTutor = admin || (coachedGroups.isEmpty() && repositoryService.hasRole(getIdentity(), re, GroupRoles.coach.name()));
    if (repoTutor) {
        List<Identity> courseParticipants = repositoryService.getMembers(re, GroupRoles.participant.name());
        for (Identity participant : courseParticipants) {
            if (!duplicateKiller.contains(participant)) {
                participantCollector.accept(participant);
                duplicateKiller.add(participant);
            }
        }
    }
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) BusinessGroup(org.olat.group.BusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) HashSet(java.util.HashSet)

Example 3 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class GTACoachedParticipantListController method doToogleMark.

private boolean doToogleMark(UserRequest ureq, Long particiantKey) {
    RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
    Identity participant = securityManager.loadIdentityByKey(particiantKey);
    return gtaManager.toggleMark(entry, gtaNode, ureq.getIdentity(), participant);
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity)

Example 4 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class CourseGlossaryFactory method createCourseGlossaryMainRunController.

/**
 * The glossarymaincontroller allows browsing in the glossary. A flag enables
 * the edit mode.
 *
 * @param windowControl
 * @param ureq
 * @param courseConfig use the glossary configuration from the given course
 *          configuration
 * @param hasGlossaryEditRights
 * @return
 */
public static GlossaryMainController createCourseGlossaryMainRunController(WindowControl lwControl, UserRequest lureq, CourseConfig cc, boolean hasGlossaryRights) {
    if (cc.hasGlossary()) {
        RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
        if (repoEntry == null) {
            // seems to be removed
            return null;
        }
        RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
        boolean owner = repositoryService.hasRole(lureq.getIdentity(), repoEntry, GroupRoles.owner.name());
        VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(repoEntry.getOlatResource());
        Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
        boolean editUsersEnabled = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
        GlossarySecurityCallback secCallback;
        if (lureq.getUserSession().getRoles().isGuestOnly()) {
            secCallback = new GlossarySecurityCallbackImpl();
        } else {
            secCallback = new GlossarySecurityCallbackImpl(hasGlossaryRights, owner, editUsersEnabled, lureq.getIdentity().getKey());
        }
        return new GlossaryMainController(lwControl, lureq, glossaryFolder, repoEntry.getOlatResource(), secCallback, true);
    }
    return null;
}
Also used : GlossarySecurityCallback(org.olat.core.commons.modules.glossary.GlossarySecurityCallback) GlossaryMainController(org.olat.core.commons.modules.glossary.GlossaryMainController) GlossarySecurityCallbackImpl(org.olat.core.commons.modules.glossary.GlossarySecurityCallbackImpl) VFSContainer(org.olat.core.util.vfs.VFSContainer) RepositoryEntry(org.olat.repository.RepositoryEntry) Properties(java.util.Properties) RepositoryService(org.olat.repository.RepositoryService)

Example 5 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class CourseSiteAdminController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("admin.menu.title");
    enableToolbar = uifactory.addCheckboxesHorizontal("site.enable.toolbar", "site.enable.toolbar", formLayout, new String[] { "x" }, new String[] { "" });
    enableToolbar.addActionListener(FormEvent.ONCHANGE);
    if (siteConfiguration.isToolbar()) {
        enableToolbar.select("x", true);
    }
    String cssClass = siteConfiguration.getNavIconCssClass();
    iconCssClassEl = uifactory.addTextElement("site.iconCssClass", "site.icon", 32, cssClass, formLayout);
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.defLanguage.i18nKey(), CSCols.defLanguage.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.language.i18nKey(), CSCols.language.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.title.i18nKey(), CSCols.title.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, CSCols.courseId.i18nKey(), CSCols.courseId.ordinal(), false, null));
    FlexiCellRenderer renderer = new StaticFlexiCellRenderer("openre", new TextFlexiCellRenderer());
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.courseTitle.i18nKey(), CSCols.courseTitle.ordinal(), "openre", renderer));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("remove", translate("remove"), "remove"));
    String page = velocity_root + "/lang_options.html";
    tableLayout = FormLayoutContainer.createCustomFormLayout("site.options.lang", getTranslator(), page);
    tableLayout.setRootForm(mainForm);
    tableLayout.setLabel("site.courses", null);
    formLayout.add(tableLayout);
    model = new CourseSiteDataModel(columnsModel);
    List<LanguageConfigurationRow> configs = new ArrayList<LanguageConfigurationRow>();
    Map<String, LanguageConfiguration> langToConfigMap = new HashMap<String, LanguageConfiguration>();
    if (siteConfiguration.getConfigurations() != null) {
        for (LanguageConfiguration langConfig : siteConfiguration.getConfigurations()) {
            langToConfigMap.put(langConfig.getLanguage(), langConfig);
        }
    }
    for (String langKey : i18nModule.getEnabledLanguageKeys()) {
        if (langToConfigMap.containsKey(langKey)) {
            LanguageConfiguration langConfig = langToConfigMap.get(langKey);
            RepositoryEntry re = repositoryManager.lookupRepositoryEntryBySoftkey(langConfig.getRepoSoftKey(), false);
            configs.add(new LanguageConfigurationRow(langConfig, re, tableLayout));
        } else {
            configs.add(new LanguageConfigurationRow(new LanguageConfiguration(langKey), null, tableLayout));
        }
    }
    model.setObjects(configs);
    tableEl = uifactory.addTableElement(getWindowControl(), "languageTable", model, getTranslator(), tableLayout);
    tableEl.setRendererType(FlexiTableRendererType.classic);
    tableEl.setCustomizeColumns(true);
    tableEl.setAndLoadPersistedPreferences(ureq, "course-site-admin");
    FormLayoutContainer buttonsLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsLayout);
    okButton = uifactory.addFormLink("save", "save", null, buttonsLayout, Link.BUTTON);
    okButton.setCustomEnabledLinkCSS("btn btn-primary");
// uifactory.addFormSubmitButton("save", "save", formLayout);
}
Also used : StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) RepositoryEntry(org.olat.repository.RepositoryEntry) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) LanguageConfiguration(org.olat.course.site.model.LanguageConfiguration) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

RepositoryEntry (org.olat.repository.RepositoryEntry)2108 Test (org.junit.Test)922 Identity (org.olat.core.id.Identity)888 BusinessGroup (org.olat.group.BusinessGroup)344 ArrayList (java.util.ArrayList)258 File (java.io.File)246 ICourse (org.olat.course.ICourse)246 Date (java.util.Date)234 OLATResource (org.olat.resource.OLATResource)200 URI (java.net.URI)176 HttpResponse (org.apache.http.HttpResponse)172 OLATResourceable (org.olat.core.id.OLATResourceable)132 RepositoryManager (org.olat.repository.RepositoryManager)122 Roles (org.olat.core.id.Roles)104 RepositoryService (org.olat.repository.RepositoryService)104 LectureBlock (org.olat.modules.lecture.LectureBlock)94 Path (javax.ws.rs.Path)90 URL (java.net.URL)84 VFSContainer (org.olat.core.util.vfs.VFSContainer)76 WindowControl (org.olat.core.gui.control.WindowControl)74