* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Controller source, Event event) {
if (source == dropboxFolderRunController) {
if (event instanceof FolderEvent) {
FolderEvent folderEvent = (FolderEvent) event;
if (folderEvent.getCommand().equals(FolderEvent.DELETE_EVENT)) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
// log entry for this file
Identity coach = ureq.getIdentity();
Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
am.appendToUserNodeLog(node, coach, student, "FILE DELETED: " + folderEvent.getFilename());
}
}
} else if (source == returnboxFolderRunController) {
if (event instanceof FolderEvent) {
FolderEvent folderEvent = (FolderEvent) event;
if ( folderEvent.getCommand().equals(FolderEvent.UPLOAD_EVENT)
|| folderEvent.getCommand().equals(FolderEvent.NEW_FILE_EVENT) ) {
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
// log entry for this file
Identity coach = ureq.getIdentity();
Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
am.appendToUserNodeLog(node, coach, student, "FILE UPLOADED: " + folderEvent.getFilename());
String toMail = student.getUser().getProperty(UserConstants.EMAIL, ureq.getLocale());
Locale locale = I18nManager.getInstance().getLocaleOrDefault(student.getUser().getPreferences().getLanguage());
Translator userTrsl = new PackageTranslator(PACKAGE, locale);
String nodeUrl = new URLEncoder().encode("[" + OresHelper.calculateTypeName(CourseNode.class) + ":" + node.getIdent() + "]");
String link = JumpInManager.getJumpInUri(this.getWindowControl().getBusinessControl()) + nodeUrl;
log.debug("DEBUG : Returnbox notification email with link=" + link);
MailTemplate mailTempl = new MailTemplate(userTrsl.translate("returnbox.email.subject"), userTrsl.translate(
"returnbox.email.body", new String[] { userCourseEnv.getCourseEnvironment().getCourseTitle(), node.getShortTitle(),
folderEvent.getFilename(), link }), null) {
@Override
public void putVariablesInMailContext(VelocityContext context, Identity recipient) {
// nothing to do
}