use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class BinderRuntimeController method initRuntimeTools.
@Override
protected void initRuntimeTools(Dropdown toolsDropdown) {
if (reSecurity.isEntryAdmin()) {
membersLink = LinkFactory.createToolLink("members", translate("details.members"), this, "o_sel_repo_members");
membersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_membersmanagement");
toolsDropdown.addComponent(membersLink);
}
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
assessmentLink = LinkFactory.createToolLink("assessment", translate("command.openassessment"), this, "o_icon_assessment_tool");
assessmentLink.setElementCssClass("o_sel_course_assessment_tool");
toolsDropdown.addComponent(assessmentLink);
}
if (reSecurity.isEntryAdmin()) {
RepositoryEntry re = getRepositoryEntry();
ordersLink = LinkFactory.createToolLink("bookings", translate("details.orders"), this, "o_sel_repo_booking");
ordersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_booking");
boolean booking = acService.isResourceAccessControled(re.getOlatResource(), null);
ordersLink.setEnabled(booking);
toolsDropdown.addComponent(ordersLink);
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class CourseTemplateSearchController method loadCourseModel.
private void loadCourseModel(CourseNode courseNode, UserCourseEnvironment uce, List<CourseTemplateRow> rows, Set<CurrentBinder> currentSet) {
if (courseNode instanceof PortfolioCourseNode) {
PortfolioCourseNode pNode = (PortfolioCourseNode) courseNode;
NodeEvaluation ne = pNode.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
if (NavigationHandler.mayAccessWholeTreeUp(ne)) {
RepositoryEntry refEntry = pNode.getReferencedRepositoryEntry();
if ("BinderTemplate".equals(refEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = uce.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
CurrentBinder binderKey = new CurrentBinder(courseEntry.getKey(), pNode.getIdent());
if (!currentSet.contains(binderKey)) {
rows.add(new CourseTemplateRow(courseEntry, pNode, refEntry));
}
}
}
}
for (int i = courseNode.getChildCount(); i-- > 0; ) {
loadCourseModel((CourseNode) courseNode.getChildAt(i), uce, rows, currentSet);
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class BinderDAO method syncAssignment.
private AssignmentImpl syncAssignment(Assignment refAssignment, AssignmentImpl currentAssignment) {
if (StringHelper.isSame(currentAssignment.getTitle(), refAssignment.getTitle()) && StringHelper.isSame(currentAssignment.getSummary(), refAssignment.getSummary()) && StringHelper.isSame(currentAssignment.getContent(), refAssignment.getContent()) && StringHelper.isSame(currentAssignment.getStorage(), refAssignment.getStorage()) && StringHelper.isSame(currentAssignment.getType(), refAssignment.getAssignmentType().name()) && StringHelper.isSame(currentAssignment.isOnlyAutoEvaluation(), refAssignment.isOnlyAutoEvaluation()) && StringHelper.isSame(currentAssignment.isReviewerSeeAutoEvaluation(), refAssignment.isReviewerSeeAutoEvaluation()) && StringHelper.isSame(currentAssignment.isAnonymousExternalEvaluation(), refAssignment.isAnonymousExternalEvaluation()) && StringHelper.isSame(currentAssignment.getFormEntry(), refAssignment.getFormEntry())) {
return currentAssignment;
}
currentAssignment.setTitle(refAssignment.getTitle());
currentAssignment.setSummary(refAssignment.getSummary());
currentAssignment.setContent(refAssignment.getContent());
currentAssignment.setStorage(refAssignment.getStorage());
currentAssignment.setType(refAssignment.getAssignmentType().name());
currentAssignment.setOnlyAutoEvaluation(refAssignment.isOnlyAutoEvaluation());
currentAssignment.setReviewerSeeAutoEvaluation(refAssignment.isReviewerSeeAutoEvaluation());
currentAssignment.setAnonymousExternalEvaluation(refAssignment.isAnonymousExternalEvaluation());
RepositoryEntry formEntry = refAssignment.getFormEntry();
if (formEntry != null) {
RepositoryEntry refFormEntry = dbInstance.getCurrentEntityManager().getReference(RepositoryEntry.class, formEntry.getKey());
currentAssignment.setFormEntry(refFormEntry);
}
return dbInstance.getCurrentEntityManager().merge(currentAssignment);
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class BinderTemplateHandler method importResource.
@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
try {
// create resource
OLATResource resource = portfolioService.createBinderTemplateResource();
OlatRootFolderImpl fResourceRootContainer = FileResourceManager.getInstance().getFileResourceRootImpl(resource);
File fResourceFileroot = fResourceRootContainer.getBasefile();
File zipRoot = new File(fResourceFileroot, FileResourceManager.ZIPDIR);
FileResource.copyResource(file, filename, zipRoot);
// create repository entry
RepositoryEntry re = repositoryService.create(initialAuthor, initialAuthorAlt, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
// import binder
File binderFile = new File(zipRoot, BinderTemplateResource.BINDER_XML);
Binder transientBinder = BinderXStream.fromPath(binderFile.toPath());
File posterImage = null;
if (StringHelper.containsNonWhitespace(transientBinder.getImagePath())) {
posterImage = new File(zipRoot, transientBinder.getImagePath());
}
portfolioService.importBinder(transientBinder, re, posterImage);
RepositoryEntryImportExport rei = new RepositoryEntryImportExport(re, zipRoot);
if (rei.anyExportedPropertiesAvailable()) {
re = rei.importContent(re, fResourceRootContainer.createChildContainer("media"));
}
// delete the imported files
FileUtils.deleteDirsAndFiles(zipRoot, true, true);
return re;
} catch (IOException e) {
log.error("", e);
return null;
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class SearchUserToolExtension method createUserTool.
@Override
public UserTool createUserTool(UserRequest ureq, WindowControl wControl, Locale locale) {
boolean canSearch = isEnabled();
if (canSearch && isSearchOnlyHasInternalSiteMember()) {
String softKey = getInternalSiteSoftKey();
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(softKey, false);
if (repoEntry != null) {
RepositoryService contextManager = CoreSpringFactory.getImpl(RepositoryService.class);
canSearch = contextManager.isMember(ureq.getUserSession().getIdentity(), repoEntry);
}
}
return canSearch ? new SearchUserTool(wControl) : null;
}
Aggregations