use of org.xwiki.skin.Skin in project xwiki-platform by xwiki.
the class InternalTemplateManager method getTemplate.
public Template getTemplate(String templateName) {
Template template = null;
// Try from skin
Skin skin = this.skins.getCurrentSkin(false);
if (skin != null) {
template = getTemplate(templateName, skin);
}
// Try from base skin if no skin is set
if (skin == null) {
Skin baseSkin = this.skins.getCurrentParentSkin(false);
if (baseSkin != null) {
template = getTemplate(templateName, baseSkin);
}
}
// Try from /templates/ environment resources
if (template == null) {
template = getFileSystemTemplate("/templates/", templateName);
}
// Try from current Thread classloader
if (template == null) {
template = getClassloaderTemplate("templates/", templateName);
}
return template;
}
use of org.xwiki.skin.Skin in project xwiki-platform by xwiki.
the class InternalSkinManager method getCurrentParentSkinId.
public String getCurrentParentSkinId(boolean testRights) {
// From the context
String baseSkin = getContextParentId();
// From the skin
if (baseSkin == null) {
Skin skin = getCurrentSkin(testRights);
if (skin != null) {
ResourceRepository parent = skin.getParent();
if (parent != null) {
baseSkin = parent.getId();
}
}
}
// From the configuration
if (baseSkin == null) {
baseSkin = getDefaultParentSkinId();
}
XWikiContext xcontext = this.xcontextProvider.get();
if (xcontext != null) {
// TODO: shouldn't we make sure anyone see the skin whatever right he have ?
if (testRights) {
XWikiDocument document = this.wikiSkinUtils.getSkinDocument(baseSkin);
if (document != null) {
if (!this.authorization.hasAccess(Right.VIEW, document.getDocumentReference())) {
this.logger.debug("Cannot access configured wiki skin [{}] due to access rights, using the default skin.", baseSkin);
baseSkin = getDefaultParentSkinId();
}
}
}
// Set found skin in the context
xcontext.put(CKEY_PARENTSKIN, baseSkin);
}
return baseSkin;
}
Aggregations