use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.
the class CourseNodeDocument method createDocument.
public static Document createDocument(SearchResourceContext searchResourceContext, CourseNode courseNode) {
CourseNodeDocument courseNodeDocument = new CourseNodeDocument();
// Set all know attributes
courseNodeDocument.setResourceUrl(searchResourceContext.getResourceUrl());
if (StringHelper.containsNonWhitespace(searchResourceContext.getDocumentType())) {
courseNodeDocument.setDocumentType(searchResourceContext.getDocumentType());
} else {
courseNodeDocument.setDocumentType(TYPE);
}
CourseNodeConfiguration nodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType());
if (nodeConfig != null && StringHelper.containsNonWhitespace(nodeConfig.getIconCSSClass())) {
courseNodeDocument.setCssIcon(nodeConfig.getIconCSSClass());
} else {
courseNodeDocument.setCssIcon("o_course_icon");
}
if (StringHelper.containsNonWhitespace(courseNode.getShortTitle())) {
courseNodeDocument.setTitle(courseNode.getShortTitle());
} else if (StringHelper.containsNonWhitespace(courseNode.getLongTitle())) {
courseNodeDocument.setTitle(courseNode.getLongTitle());
courseNodeDocument.setDescription(courseNode.getLongTitle());
}
if (StringHelper.containsNonWhitespace(courseNode.getLongTitle())) {
courseNodeDocument.setDescription(courseNode.getLongTitle());
}
if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
String objectives = courseNode.getLearningObjectives();
objectives = FilterFactory.getHtmlTagsFilter().filter(objectives);
courseNodeDocument.setContent(objectives);
}
// Get dates from parent object via context because course node has no dates
courseNodeDocument.setCreatedDate(searchResourceContext.getCreatedDate());
courseNodeDocument.setLastChange(searchResourceContext.getLastModified());
courseNodeDocument.setParentContextType(searchResourceContext.getParentContextType());
courseNodeDocument.setParentContextName(searchResourceContext.getParentContextName());
return courseNodeDocument.getLuceneDocument();
}
use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.
the class AbstractCourseNodeWebService method createCourseNode.
private CourseNodeVO createCourseNode(String type, String shortTitle, String longTitle, String learningObjectives, String visibilityExpertRules, String accessExpertRules, CustomConfigDelegate delegateConfig, CourseEditSession editSession, CourseNode parentNode, Integer position) {
CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type);
CourseNode insertedNode = newNodeConfig.getInstance();
insertedNode.setShortTitle(shortTitle);
insertedNode.setLongTitle(longTitle);
insertedNode.setLearningObjectives(learningObjectives);
insertedNode.setNoAccessExplanation("You don't have access");
if (StringHelper.containsNonWhitespace(visibilityExpertRules)) {
Condition cond = this.createExpertCondition(CONDITION_ID_VISIBILITY, visibilityExpertRules);
insertedNode.setPreConditionVisibility(cond);
}
if (StringHelper.containsNonWhitespace(accessExpertRules) && insertedNode instanceof AbstractAccessableCourseNode) {
Condition cond = createExpertCondition(CONDITION_ID_ACCESS, accessExpertRules);
((AbstractAccessableCourseNode) insertedNode).setPreConditionAccess(cond);
}
ICourse course = editSession.getCourse();
if (delegateConfig != null) {
ModuleConfiguration moduleConfig = insertedNode.getModuleConfiguration();
delegateConfig.configure(course, insertedNode, moduleConfig);
}
if (position == null || position.intValue() < 0) {
course.getEditorTreeModel().addCourseNode(insertedNode, parentNode);
} else {
course.getEditorTreeModel().insertCourseNodeAt(insertedNode, parentNode, position);
}
CourseEditorTreeNode editorNode = course.getEditorTreeModel().getCourseEditorNodeContaining(insertedNode);
CourseNodeVO vo = get(insertedNode);
vo.setParentId(editorNode.getParent() == null ? null : editorNode.getParent().getIdent());
return vo;
}
use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.
the class AssessmentHelper method addAssessableNodesToList.
private static List<GenericTreeNode> addAssessableNodesToList(CourseNode parentCourseNode) {
List<GenericTreeNode> result = new ArrayList<>();
for (int i = 0; i < parentCourseNode.getChildCount(); i++) {
CourseNode courseNode = (CourseNode) parentCourseNode.getChildAt(i);
List<GenericTreeNode> assessableChildren = addAssessableNodesToList(courseNode);
if (assessableChildren.size() > 0 || isAssessable(courseNode)) {
GenericTreeNode node = new GenericTreeNode();
node.setTitle(courseNode.getShortTitle());
node.setUserObject(courseNode);
CourseNodeConfiguration nodeconfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType());
node.setIconCssClass(nodeconfig.getIconCSSClass());
result.add(node);
assessableChildren.forEach((child) -> node.addChild(child));
}
}
return result;
}
use of org.olat.course.nodes.CourseNodeConfiguration in project openolat by klemens.
the class PublishProcess method assemblePublishConfirmation.
String assemblePublishConfirmation() {
List<String> nodeIdsToPublish = originalNodeIdsToPublish;
StringBuilder msg = new StringBuilder();
OLATResourceable courseRunOres = OresHelper.createOLATResourceableInstance(RunMainController.ORES_TYPE_COURSE_RUN, repositoryEntry.getOlatResource().getResourceableId());
// -1: Remove myself from list
int cnt = CoordinatorManager.getInstance().getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres) - 1;
if (cnt > 0) {
msg.append(translate("pbl.confirm.users", String.valueOf(cnt)));
} else {
msg.append(translator.translate("pbl.confirm"));
}
if (nodeIdsToPublish != null && nodeIdsToPublish.size() > 0) {
msg.append("<ul class='list-unstyled'>");
CourseEditorTreeModel cetm = course.getEditorTreeModel();
for (int i = 0; i < nodeIdsToPublish.size(); i++) {
msg.append("<li>");
String nodeId = nodeIdsToPublish.get(i);
CourseEditorTreeNode cetn = (CourseEditorTreeNode) cetm.getNodeById(nodeId);
CourseNode cn = cetm.getCourseNode(nodeId);
if (cetn.isDeleted() && !cetn.isNewnode()) {
msg.append("<i class='o_icon o_icon_delete_item'> </i> ");
} else {
CourseNodeConfiguration nodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(cn.getType());
if (nodeConfig != null) {
msg.append("<i class='o_icon ").append(nodeConfig.getIconCSSClass()).append("'> </i> ");
}
}
msg.append(cn.getShortTitle()).append("</li>");
}
msg.append("</ul>");
}
return msg.toString();
}
use of org.olat.course.nodes.CourseNodeConfiguration in project OpenOLAT by OpenOLAT.
the class CheckListStepRunnerCallback method createCourseNode.
private CourseNode createCourseNode(String shortTitle, String title, String objectives, String type) {
CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type);
CourseNode newNode = newNodeConfig.getInstance();
newNode.setShortTitle(shortTitle);
newNode.setLongTitle(title);
newNode.setLearningObjectives(objectives);
newNode.setNoAccessExplanation("You don't have access");
return newNode;
}
Aggregations