Search in sources :

Example 1 with SiteDefinition

use of org.olat.core.gui.control.navigation.SiteDefinition in project OpenOLAT by OpenOLAT.

the class SitesConfigurationController method reload.

protected void reload() {
    List<SiteDefRow> configs = new ArrayList<SiteDefRow>();
    for (Map.Entry<String, SiteDefinition> entryDef : siteDefs.entrySet()) {
        String id = entryDef.getKey();
        SiteDefinition siteDef = entryDef.getValue();
        String title = translate(siteDef.getClass().getSimpleName());
        SiteConfiguration config = sitesModule.getConfigurationSite(id);
        SiteDefRow row = new SiteDefRow(siteDef, config, title, formLayout);
        configs.add(row);
    }
    Collections.sort(configs, new RowOrderComparator());
    model.setObjects(configs);
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) ArrayList(java.util.ArrayList) SiteConfiguration(org.olat.core.gui.control.navigation.SiteConfiguration) Map(java.util.Map)

Example 2 with SiteDefinition

use of org.olat.core.gui.control.navigation.SiteDefinition in project OpenOLAT by OpenOLAT.

the class CourseSiteContextEntryControllerCreator method getCourseSite.

private CourseSiteDef getCourseSite(UserRequest ureq, RepositoryEntry re) {
    if (re == null)
        return null;
    List<SiteDefinition> siteDefList = getSitesDefinitions().getSiteDefList();
    for (SiteDefinition siteDef : siteDefList) {
        if (siteDef instanceof CourseSiteDef) {
            CourseSiteDef courseSiteDef = (CourseSiteDef) siteDef;
            CourseSiteConfiguration config = courseSiteDef.getCourseSiteconfiguration();
            LanguageConfiguration langConfig = courseSiteDef.getLanguageConfiguration(ureq, config);
            if (langConfig == null)
                continue;
            String softKey = langConfig.getRepoSoftKey();
            if (re.getSoftkey() != null && re.getSoftkey().equals(softKey)) {
                return courseSiteDef;
            }
        }
    }
    return null;
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) CourseSiteConfiguration(org.olat.course.site.model.CourseSiteConfiguration) LanguageConfiguration(org.olat.course.site.model.LanguageConfiguration)

Example 3 with SiteDefinition

use of org.olat.core.gui.control.navigation.SiteDefinition in project OpenOLAT by OpenOLAT.

the class AuthBFWCParts method getSiteInstances.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#getSiteInstances(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public List<SiteInstance> getSiteInstances(UserRequest ureq, WindowControl wControl) {
    SiteDefinitions sitedefs = CoreSpringFactory.getImpl(SiteDefinitions.class);
    List<SiteInstance> sites = new ArrayList<SiteInstance>();
    for (SiteDefinition sitedef : sitedefs.getSiteDefList()) {
        SiteInstance site = sitedef.createSite(ureq, wControl);
        if (site != null) {
            // site == null means that site is not visible to the current user
            sites.add(site);
        }
    }
    return sites;
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) SiteInstance(org.olat.core.gui.control.navigation.SiteInstance) ArrayList(java.util.ArrayList) SiteDefinitions(org.olat.core.gui.control.navigation.SiteDefinitions)

Example 4 with SiteDefinition

use of org.olat.core.gui.control.navigation.SiteDefinition in project openolat by klemens.

the class CourseSiteContextEntryControllerCreator method getRepositoryEntry.

private RepositoryEntry getRepositoryEntry(UserRequest ureq, ContextEntry ce) {
    if (repoEntry == null) {
        if (ce.getOLATResourceable() instanceof RepositoryEntry) {
            repoEntry = (RepositoryEntry) ce.getOLATResourceable();
        } else {
            OLATResourceable ores = ce.getOLATResourceable();
            if ("CourseSite".equals(ores.getResourceableTypeName())) {
                int id = ores.getResourceableId().intValue();
                CourseSiteDef courseSiteDef = null;
                List<SiteDefinition> siteDefList = getSitesDefinitions().getSiteDefList();
                if (id == 2) {
                    for (SiteDefinition siteDef : siteDefList) {
                        if (siteDef instanceof CourseSiteDef2) {
                            courseSiteDef = (CourseSiteDef) siteDef;
                        }
                    }
                } else if (id == 1) {
                    for (SiteDefinition siteDef : siteDefList) {
                        if (siteDef instanceof CourseSiteDef) {
                            courseSiteDef = (CourseSiteDef) siteDef;
                        }
                    }
                }
                if (courseSiteDef != null) {
                    CourseSiteConfiguration config = courseSiteDef.getCourseSiteconfiguration();
                    LanguageConfiguration langConfig = courseSiteDef.getLanguageConfiguration(ureq, config);
                    if (langConfig != null) {
                        String softKey = langConfig.getRepoSoftKey();
                        RepositoryManager rm = RepositoryManager.getInstance();
                        repoEntry = rm.lookupRepositoryEntryBySoftkey(softKey, false);
                    }
                }
            } else {
                RepositoryManager rm = RepositoryManager.getInstance();
                repoEntry = rm.lookupRepositoryEntry(ores.getResourceableId());
            }
        }
    }
    return repoEntry;
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) OLATResourceable(org.olat.core.id.OLATResourceable) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseSiteConfiguration(org.olat.course.site.model.CourseSiteConfiguration) LanguageConfiguration(org.olat.course.site.model.LanguageConfiguration)

Example 5 with SiteDefinition

use of org.olat.core.gui.control.navigation.SiteDefinition in project openolat by klemens.

the class GuestBFWCParts method getSiteInstances.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#getSiteInstances(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public List<SiteInstance> getSiteInstances(UserRequest ureq, WindowControl wControl) {
    SiteDefinitions sitedefs = CoreSpringFactory.getImpl(SiteDefinitions.class);
    List<SiteInstance> sites = new ArrayList<SiteInstance>();
    for (SiteDefinition sitedef : sitedefs.getSiteDefList()) {
        SiteInstance site = sitedef.createSite(ureq, wControl);
        if (site != null) {
            // site == null means that site is not visible to the current user
            sites.add(site);
        }
    }
    return sites;
}
Also used : SiteDefinition(org.olat.core.gui.control.navigation.SiteDefinition) SiteInstance(org.olat.core.gui.control.navigation.SiteInstance) ArrayList(java.util.ArrayList) SiteDefinitions(org.olat.core.gui.control.navigation.SiteDefinitions)

Aggregations

SiteDefinition (org.olat.core.gui.control.navigation.SiteDefinition)10 ArrayList (java.util.ArrayList)6 SiteDefinitions (org.olat.core.gui.control.navigation.SiteDefinitions)4 SiteInstance (org.olat.core.gui.control.navigation.SiteInstance)4 CourseSiteConfiguration (org.olat.course.site.model.CourseSiteConfiguration)4 LanguageConfiguration (org.olat.course.site.model.LanguageConfiguration)4 Map (java.util.Map)2 SiteConfiguration (org.olat.core.gui.control.navigation.SiteConfiguration)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryManager (org.olat.repository.RepositoryManager)2