use of org.olat.core.gui.components.download.DisplayOrDownloadComponent in project OpenOLAT by OpenOLAT.
the class FolderRunController method activatePath.
public void activatePath(UserRequest ureq, String path) {
if (path != null && path.length() > 0) {
VFSItem vfsItem = folderComponent.getRootContainer().resolve(path.endsWith("/") ? path.substring(0, path.length() - 1) : path);
if (vfsItem instanceof VFSLeaf) {
// could be a file - create the mapper - otherwise don't create one if it's a directory
// Create a mapper to deliver the auto-download of the file. We have to
// create a dedicated mapper here
// and can not reuse the standard briefcase way of file delivering, some
// very old fancy code
// Mapper is cleaned up automatically by basic controller
String baseUrl = registerMapper(ureq, new VFSContainerMapper(folderComponent.getRootContainer()));
// Trigger auto-download
DisplayOrDownloadComponent dordc = new DisplayOrDownloadComponent("downloadcomp", baseUrl + path);
folderContainer.put("autoDownloadComp", dordc);
if (path.lastIndexOf("/") > 0) {
String dirPath = path.substring(0, path.lastIndexOf("/"));
if (StringHelper.containsNonWhitespace(dirPath)) {
folderComponent.setCurrentContainerPath(dirPath);
}
}
} else if (vfsItem instanceof VFSContainer) {
if (StringHelper.containsNonWhitespace(path)) {
folderComponent.setCurrentContainerPath(path);
}
}
updatePathResource(ureq);
}
}
use of org.olat.core.gui.components.download.DisplayOrDownloadComponent in project OpenOLAT by OpenOLAT.
the class MSCourseNodeRunController method exposeUserDataToVC.
private void exposeUserDataToVC(UserRequest ureq) {
AssessmentEntry assessmentEntry = courseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
myContent.contextPut("hasPassedValue", Boolean.FALSE);
myContent.contextPut("passed", Boolean.FALSE);
hasPassed = hasScore = hasComment = false;
} else {
String rawComment = assessmentEntry.getComment();
hasPassed = assessmentEntry.getPassed() != null;
hasScore = assessmentEntry.getScore() != null;
hasComment = courseNode.hasCommentConfigured() && StringHelper.containsNonWhitespace(rawComment);
boolean resultsVisible = overrideUserResultsVisiblity || assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
myContent.contextPut("resultsVisible", resultsVisible);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", assessmentEntry.getPassed());
if (resultsVisible) {
if (hasComment) {
StringBuilder comment = Formatter.stripTabsAndReturns(rawComment);
myContent.contextPut("comment", StringHelper.xssScan(comment));
myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
if (courseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
myContent.contextPut("docsMapperUri", mapperUri);
myContent.contextPut("docs", docs);
myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
if (download == null) {
download = new DisplayOrDownloadComponent("", null);
myContent.put("download", download);
}
}
}
}
if (showLog) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
myContent.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
}
}
use of org.olat.core.gui.components.download.DisplayOrDownloadComponent in project OpenOLAT by OpenOLAT.
the class OpenMeetingsRunController method redirectToGuestRoom.
private void redirectToGuestRoom(String firstName, String lastName) {
if (room == null && room.getRoomId() <= 0) {
showError("room.notfound.error");
} else {
try {
String securedHash = openMeetingsManager.setGuestUserToRoom(firstName, lastName, room.getRoomId());
String url = openMeetingsManager.getURL(getIdentity(), room.getRoomId(), securedHash, getLocale());
DisplayOrDownloadComponent cmp = new DisplayOrDownloadComponent("openCommand", url);
mainVC.put("openCmd", cmp);
} catch (OpenMeetingsException e) {
showError(e.i18nKey());
}
}
}
use of org.olat.core.gui.components.download.DisplayOrDownloadComponent in project openolat by klemens.
the class FolderRunController method activatePath.
public void activatePath(UserRequest ureq, String path) {
if (path != null && path.length() > 0) {
VFSItem vfsItem = folderComponent.getRootContainer().resolve(path.endsWith("/") ? path.substring(0, path.length() - 1) : path);
if (vfsItem instanceof VFSLeaf) {
// could be a file - create the mapper - otherwise don't create one if it's a directory
// Create a mapper to deliver the auto-download of the file. We have to
// create a dedicated mapper here
// and can not reuse the standard briefcase way of file delivering, some
// very old fancy code
// Mapper is cleaned up automatically by basic controller
String baseUrl = registerMapper(ureq, new VFSContainerMapper(folderComponent.getRootContainer()));
// Trigger auto-download
DisplayOrDownloadComponent dordc = new DisplayOrDownloadComponent("downloadcomp", baseUrl + path);
folderContainer.put("autoDownloadComp", dordc);
if (path.lastIndexOf("/") > 0) {
String dirPath = path.substring(0, path.lastIndexOf("/"));
if (StringHelper.containsNonWhitespace(dirPath)) {
folderComponent.setCurrentContainerPath(dirPath);
}
}
} else if (vfsItem instanceof VFSContainer) {
if (StringHelper.containsNonWhitespace(path)) {
folderComponent.setCurrentContainerPath(path);
}
}
updatePathResource(ureq);
}
}
use of org.olat.core.gui.components.download.DisplayOrDownloadComponent in project openolat by klemens.
the class OpenMeetingsRunController method redirectToGuestRoom.
private void redirectToGuestRoom(String firstName, String lastName) {
if (room == null && room.getRoomId() <= 0) {
showError("room.notfound.error");
} else {
try {
String securedHash = openMeetingsManager.setGuestUserToRoom(firstName, lastName, room.getRoomId());
String url = openMeetingsManager.getURL(getIdentity(), room.getRoomId(), securedHash, getLocale());
DisplayOrDownloadComponent cmp = new DisplayOrDownloadComponent("openCommand", url);
mainVC.put("openCmd", cmp);
} catch (OpenMeetingsException e) {
showError(e.i18nKey());
}
}
}
Aggregations