Skip to content
Snippets Groups Projects
Commit 8317c449 authored by srosse's avatar srosse
Browse files

OO-4497: generic disabled course node module for unknown elements

parent aa805077
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ import java.util.Collections; ...@@ -31,6 +31,7 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -118,7 +119,7 @@ public class CourseNodeFactory implements PreWarm { ...@@ -118,7 +119,7 @@ public class CourseNodeFactory implements PreWarm {
*/ */
public CourseNodeConfiguration getCourseNodeConfiguration(String alias) { public CourseNodeConfiguration getCourseNodeConfiguration(String alias) {
CourseNodeConfiguration config = getAllCourseNodeConfigurations().get(alias); CourseNodeConfiguration config = getAllCourseNodeConfigurations().get(alias);
if(config.isEnabled()) { if(config != null && config.isEnabled()) {
return config; return config;
} }
return null; return null;
...@@ -129,7 +130,11 @@ public class CourseNodeFactory implements PreWarm { ...@@ -129,7 +130,11 @@ public class CourseNodeFactory implements PreWarm {
* @return The instance of the desired type of node if enabled or not * @return The instance of the desired type of node if enabled or not
*/ */
public CourseNodeConfiguration getCourseNodeConfigurationEvenForDisabledBB(String alias) { public CourseNodeConfiguration getCourseNodeConfigurationEvenForDisabledBB(String alias) {
return getAllCourseNodeConfigurations().get(alias); CourseNodeConfiguration config = getAllCourseNodeConfigurations().get(alias);
if(config == null) {
config = new DisabledCourseNodeConfiguration(alias);
}
return config;
} }
/** /**
...@@ -148,7 +153,7 @@ public class CourseNodeFactory implements PreWarm { ...@@ -148,7 +153,7 @@ public class CourseNodeFactory implements PreWarm {
RepositoryHandler typeToEdit = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry); RepositoryHandler typeToEdit = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
if (typeToEdit.supportsEdit(repositoryEntry.getOlatResource(), ureq.getIdentity(), ureq.getUserSession().getRoles()) == EditionSupport.no){ if (typeToEdit.supportsEdit(repositoryEntry.getOlatResource(), ureq.getIdentity(), ureq.getUserSession().getRoles()) == EditionSupport.no){
log.error("Trying to edit repository entry which has no associated editor: "+ typeToEdit); log.error("Trying to edit repository entry which has no associated editor: {}", typeToEdit);
return false; return false;
} }
...@@ -181,4 +186,48 @@ public class CourseNodeFactory implements PreWarm { ...@@ -181,4 +186,48 @@ public class CourseNodeFactory implements PreWarm {
return diff; return diff;
} }
} }
private static class DisabledCourseNodeConfiguration extends AbstractCourseNodeConfiguration {
private final String alias;
public DisabledCourseNodeConfiguration(String alias) {
this.alias = alias;
}
@Override
public String getAlias() {
return alias;
}
@Override
public boolean isDeprecated() {
return true;
}
@Override
public boolean isEnabled() {
return false;
}
@Override
public String getGroup() {
return null;
}
@Override
public CourseNode getInstance() {
return null;
}
@Override
public String getLinkText(Locale locale) {
return null;
}
@Override
public String getIconCSSClass() {
return "o_unkown_icon";
}
}
} }
\ No newline at end of file
...@@ -428,6 +428,7 @@ $fa-css-prefix: "o_icon" !default; ...@@ -428,6 +428,7 @@ $fa-css-prefix: "o_icon" !default;
.o_card2brain_icon:before, %o_icon_card2brain { content:"\E800"; font-family: openolat; font-size: 120%; } .o_card2brain_icon:before, %o_icon_card2brain { content:"\E800"; font-family: openolat; font-size: 120%; }
.o_edubase_icon:before, %o_icon_edubase { content:"\E885"; font-family: openolat; } .o_edubase_icon:before, %o_icon_edubase { content:"\E885"; font-family: openolat; }
.o_livestream_icon:before, { content: $fa-var-video-camera;} .o_livestream_icon:before, { content: $fa-var-video-camera;}
.o_unkown_icon:before, { content: $fa-var-user-secret;}
/* portal icons */ /* portal icons */
.o_portlet_infomsg_icon:before {content: $fa-var-info-circle; } .o_portlet_infomsg_icon:before {content: $fa-var-info-circle; }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment