Package org.olat.core.commons.modules.bc

Examples of org.olat.core.commons.modules.bc.FolderEvent


   */
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == fileUploadCtr) {
      // catch upload event
      if (event instanceof FolderEvent && event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {
        FolderEvent folderEvent = (FolderEvent) event;
        // Get file from temp folder location
        uploadedFileName = folderEvent.getFilename();
        VFSItem file = uploadContainer.resolve(uploadedFileName);
        if (file != null) {
          // remove old files first from a previous upload
          if (uploadedFile != null && uploadedFile.exists()) uploadedFile.delete();
          // We knot it is a local file, cast is necessary to get file reference
View Full Code Here


   */
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == uploadCtr) {
      // catch upload event
      if (event instanceof FolderEvent && event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {
        FolderEvent folderEvent = (FolderEvent) event;
        // Get file from temp folder location
        String uploadFileName = folderEvent.getFilename();
        File uploadDir = new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome());
        newFile = new File(uploadDir, uploadFileName);
        if (!newFile.exists()) {
          showError("Failed");
        } else {
View Full Code Here

   * @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
            }
View Full Code Here

TOP

Related Classes of org.olat.core.commons.modules.bc.FolderEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.