Search in sources :

Example 1 with Versions

use of org.olat.core.util.vfs.version.Versions in project OpenOLAT by OpenOLAT.

the class ListRenderer method appendRenderedFile.

// getRenderedDirectoryContent
/**
 * Render a single file or folder.
 *
 * @param	f			The file or folder to render
 * @param	sb		StringOutput to append generated html code
 */
private void appendRenderedFile(FolderComponent fc, VFSItem child, String currentContainerPath, StringOutput sb, URLBuilder ubu, Translator translator, boolean iframePostEnabled, boolean canContainerVersion, int pos) {
    // assume full access unless security callback tells us something different.
    boolean canWrite = child.getParentContainer().canWrite() == VFSConstants.YES;
    // special case: virtual folders are always read only. parent of child =! the current container
    canWrite = canWrite && !(fc.getCurrentContainer() instanceof VirtualContainer);
    boolean isAbstract = (child instanceof AbstractVirtualContainer);
    Versions versions = null;
    if (canContainerVersion && child instanceof Versionable) {
        Versionable versionable = (Versionable) child;
        if (versionable.getVersions().isVersioned()) {
            versions = versionable.getVersions();
        }
    }
    boolean canVersion = versions != null && !versions.getRevisions().isEmpty();
    boolean canAddToEPortfolio = FolderConfig.isEPortfolioAddEnabled();
    VFSLeaf leaf = null;
    if (child instanceof VFSLeaf) {
        leaf = (VFSLeaf) child;
    }
    // if not a leaf, it must be a container...
    boolean isContainer = (leaf == null);
    MetaInfo metaInfo = null;
    if (child instanceof MetaTagged) {
        metaInfo = ((MetaTagged) child).getMetaInfo();
    }
    boolean lockedForUser = lockManager.isLockedForMe(child, fc.getIdentityEnvironnement().getIdentity(), fc.getIdentityEnvironnement().getRoles());
    String name = child.getName();
    boolean xssErrors = StringHelper.xssScanForErrors(name);
    String pathAndName;
    if (xssErrors) {
        pathAndName = null;
    } else {
        pathAndName = currentContainerPath;
        if (pathAndName.length() > 0 && !pathAndName.endsWith("/")) {
            pathAndName += "/";
        }
        pathAndName += name;
    }
    // tr begin
    sb.append("<tr><td>").append("<input type=\"checkbox\" name=\"").append(FileSelection.FORM_ID).append("\" value=\"");
    if (xssErrors) {
        sb.append(StringHelper.escapeHtml(name)).append("\" disabled=\"disabled\"");
    } else {
        sb.append(name).append("\" ");
    }
    sb.append("/> ");
    // browse link pre
    if (xssErrors) {
        sb.append("<i class='o_icon o_icon-fw o_icon_banned'> </i> ");
        sb.append(StringHelper.escapeHtml(name));
        log.error("XSS Scan found something suspicious in: " + child);
    } else {
        sb.append("<a id='o_sel_doc_").append(pos).append("'");
        if (isContainer) {
            // for directories... normal module URIs
            // needs encoding, not done in buildHrefAndOnclick!
            // FIXME: SR: refactor encode: move to ubu.buildHrefAndOnclick
            String pathAndNameEncoded = ubu.encodeUrl(pathAndName);
            ubu.buildHrefAndOnclick(sb, pathAndNameEncoded, iframePostEnabled, false, true);
        } else {
            // for files, add PARAM_SERV command
            sb.append(" href=\"");
            ubu.buildURI(sb, new String[] { PARAM_SERV }, new String[] { "x" }, pathAndName, AJAXFlags.MODE_NORMAL);
            sb.append("\"");
            boolean download = FolderManager.isDownloadForcedFileType(name);
            if (download) {
                sb.append(" download=\"").append(StringHelper.escapeHtml(name)).append("\"");
            } else {
                sb.append(" target=\"_blank\"");
            }
        }
        sb.append(">");
        // icon css
        sb.append("<i class=\"o_icon o_icon-fw ");
        if (isContainer)
            sb.append(CSSHelper.CSS_CLASS_FILETYPE_FOLDER);
        else
            sb.append(CSSHelper.createFiletypeIconCssClassFor(name));
        sb.append("\"></i> ");
        // name
        if (isAbstract)
            sb.append("<i>");
        sb.append(StringHelper.escapeHtml(name));
        if (isAbstract)
            sb.append("</i>");
        sb.append("</a>");
    }
    // file metadata as tooltip
    if (metaInfo != null) {
        boolean hasMeta = false;
        sb.append("<div id='o_sel_doc_tooltip_").append(pos).append("' class='o_bc_meta' style='display:none;'>");
        if (StringHelper.containsNonWhitespace(metaInfo.getTitle())) {
            String title = StringHelper.escapeHtml(metaInfo.getTitle());
            sb.append("<h5>").append(Formatter.escapeDoubleQuotes(title)).append("</h5>");
            hasMeta = true;
        }
        if (StringHelper.containsNonWhitespace(metaInfo.getComment())) {
            sb.append("<div class=\"o_comment\">");
            String comment = StringHelper.escapeHtml(metaInfo.getComment());
            sb.append(Formatter.escapeDoubleQuotes(comment));
            sb.append("</div>");
            hasMeta = true;
        }
        // boolean hasThumbnail = false;
        if (metaInfo.isThumbnailAvailable() && !xssErrors) {
            sb.append("<div class='o_thumbnail' style='background-image:url(");
            ubu.buildURI(sb, new String[] { PARAM_SERV_THUMBNAIL }, new String[] { "x" }, pathAndName, AJAXFlags.MODE_NORMAL);
            sb.append("); background-repeat:no-repeat; background-position:50% 50%;'></div>");
            hasMeta = true;
        // hasThumbnail = true;
        }
        // first try author info from metadata (creator)
        // boolean hasMetaAuthor = false;
        String author = metaInfo.getCreator();
        // fallback use file author (uploader)
        if (StringHelper.containsNonWhitespace(author)) {
        // hasMetaAuthor = true;
        } else {
            author = metaInfo.getAuthor();
            if (!"-".equals(author)) {
                author = UserManager.getInstance().getUserDisplayName(author);
            } else {
                author = null;
            }
        }
        author = StringHelper.escapeHtml(author);
        if (StringHelper.containsNonWhitespace(author)) {
            sb.append("<p class=\"o_author\">").append(Formatter.escapeDoubleQuotes(translator.translate("mf.author")));
            sb.append(": ").append(Formatter.escapeDoubleQuotes(author)).append("</p>");
            hasMeta = true;
        }
        sb.append("</div>");
        if (hasMeta) {
            // render tooltip only when it contains something
            sb.append("<script type='text/javascript'>").append("/* <![CDATA[ */").append("jQuery(function() {\n").append("  jQuery('#o_sel_doc_").append(pos).append("').tooltip({\n").append("	   html: true,\n").append("	   container: 'body',\n").append("    title: function(){ return jQuery('#o_sel_doc_tooltip_").append(pos).append("').html(); }\n").append("  });\n").append("  jQuery('#o_sel_doc_").append(pos).append("').on('click', function(){\n").append("	   jQuery('#o_sel_doc_").append(pos).append("').tooltip('hide');\n").append("  });\n").append("});").append("/* ]]> */").append("</script>");
        }
    }
    sb.append("</td><td>");
    // filesize
    if (!isContainer) {
        // append filesize
        sb.append("<span class='text-muted small'>");
        sb.append(Formatter.formatBytes(leaf.getSize()));
        sb.append("</span>");
    }
    sb.append("</td><td>");
    // last modified
    long lastModified = child.getLastModified();
    sb.append("<span class='text-muted small'>");
    if (lastModified != VFSConstants.UNDEFINED)
        sb.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, translator.getLocale()).format(new Date(lastModified)));
    else
        sb.append("-");
    sb.append("</span></td><td>");
    // license
    if (licensesEnabled) {
        MetaInfoFactory metaInfoFactory = CoreSpringFactory.getImpl(MetaInfoFactory.class);
        License license = metaInfoFactory.getLicense(metaInfo);
        LicenseRenderer licenseRenderer = new LicenseRenderer(translator.getLocale());
        licenseRenderer.render(sb, license, true);
        sb.append("</td><td>");
    }
    if (canContainerVersion) {
        if (canVersion)
            if (versions != null) {
                sb.append("<span class='text-muted small'>");
                sb.append(versions.getRevisionNr());
                sb.append("</span>");
            }
        sb.append("</td><td>");
    }
    // locked
    boolean locked = lockManager.isLocked(child);
    if (locked) {
        LockInfo lock = lockManager.getLock(child);
        sb.append("<i class=\"o_icon o_icon_locked\" title=\"");
        if (lock != null && lock.getLockedBy() != null) {
            String fullname = userManager.getUserDisplayName(lock.getLockedBy());
            String date = "";
            if (lock.getCreationDate() != null) {
                date = fc.getDateTimeFormat().format(lock.getCreationDate());
            }
            String msg = translator.translate("Locked", new String[] { fullname, date });
            if (lock.isWebDAVLock()) {
                msg += " (WebDAV)";
            }
            sb.append(msg);
        }
        sb.append("\">&#160;</i>");
    }
    sb.append("</td><td>");
    // Info link
    if (canWrite) {
        int actionCount = 0;
        if (canVersion) {
            actionCount++;
        }
        String nameLowerCase = name.toLowerCase();
        // OO-57 only display edit link if it's not a folder
        boolean isLeaf = (child instanceof VFSLeaf);
        boolean isEditable = (isLeaf && !lockedForUser && !xssErrors && (nameLowerCase.endsWith(".html") || nameLowerCase.endsWith(".htm") || nameLowerCase.endsWith(".txt") || nameLowerCase.endsWith(".css") || nameLowerCase.endsWith(".csv	")));
        if (isEditable)
            actionCount++;
        boolean canEP = canAddToEPortfolio && !isContainer;
        if (canEP)
            actionCount++;
        boolean canMetaData = canMetaInfo(child);
        if (canMetaData)
            actionCount++;
        if (actionCount == 1 && canMetaData) {
            // when only one action is available, don't render menu
            sb.append("<a ");
            ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_EDTID, pos)).append(" title=\"").append(StringHelper.escapeHtml(translator.translate("mf.edit"))).append("\"><i class=\"o_icon o_icon-fw o_icon_edit_metadata\"></i></a>");
        } else if (actionCount > 1) {
            // add actions to menu if multiple actions available
            sb.append("<a id='o_sel_actions_").append(pos).append("' href='javascript:;'><i class='o_icon o_icon-lg o_icon_actions'></i></a>").append("<div id='o_sel_actions_pop_").append(pos).append("' style='display:none;'><ul class='list-unstyled'>");
            // meta edit action (rename etc)
            if (canMetaData) {
                // Metadata edit link... also handles rename for non-OlatRelPathImpls
                sb.append("<li><a ");
                ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_EDTID, pos)).append("><i class=\"o_icon o_icon-fw o_icon_edit_metadata\"></i> ").append(StringHelper.escapeHtml(translator.translate("mf.edit"))).append("</a></li>");
            }
            // content edit action
            if (isEditable) {
                sb.append("<li><a ");
                ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_CONTENTEDITID, pos)).append("><i class=\"o_icon o_icon-fw o_icon_edit_file\"></i> ").append(StringHelper.escapeHtml(translator.translate("editor"))).append("</a></li>");
            }
            // versions action
            if (canVersion) {
                // Versions link
                sb.append("<li><a ");
                ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_VERID, pos)).append("><i class=\"o_icon o_icon-fw o_icon_version\"></i> ").append(StringHelper.escapeHtml(translator.translate("versions"))).append("</a></li>");
            }
            // get a link for adding a file to ePortfolio, if file-owner is the current user
            if (canEP) {
                if (metaInfo != null) {
                    Identity author = metaInfo.getAuthorIdentity();
                    if (author != null && fc.getIdentityEnvironnement().getIdentity().getKey().equals(author.getKey())) {
                        sb.append("<li><a ");
                        ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_EPORT, pos)).append("><i class=\"o_icon o_icon-fw o_icon_eportfolio_add\"></i> ").append(StringHelper.escapeHtml(translator.translate("eportfolio"))).append("</a></li>");
                    }
                }
            }
            sb.append("</ul></div>").append("<script type='text/javascript'>").append("/* <![CDATA[ */").append("jQuery(function() {\n").append("  o_popover('o_sel_actions_").append(pos).append("','o_sel_actions_pop_").append(pos).append("','left');\n").append("});").append("/* ]]> */").append("</script>");
        }
    }
    sb.append("</td></tr>");
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) AbstractVirtualContainer(org.olat.core.util.vfs.AbstractVirtualContainer) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) License(org.olat.core.commons.services.license.License) MetaInfoFactory(org.olat.core.commons.modules.bc.meta.MetaInfoFactory) Date(java.util.Date) Versionable(org.olat.core.util.vfs.version.Versionable) Versions(org.olat.core.util.vfs.version.Versions) LockInfo(org.olat.core.util.vfs.lock.LockInfo) Identity(org.olat.core.id.Identity) AbstractVirtualContainer(org.olat.core.util.vfs.AbstractVirtualContainer) VirtualContainer(org.olat.core.util.vfs.VirtualContainer) LicenseRenderer(org.olat.core.commons.services.license.ui.LicenseRenderer)

Example 2 with Versions

use of org.olat.core.util.vfs.version.Versions in project OpenOLAT by OpenOLAT.

the class RevisionListController method loadModel.

private void loadModel(VFSLeaf versionedLeaf) {
    Versions versions = versionedFile.getVersions();
    List<VFSRevision> revisions = new ArrayList<VFSRevision>(versions.getRevisions());
    revisions.add(new CurrentRevision(versionedLeaf, versions));
    Collection<String> names = new HashSet<String>();
    for (VFSRevision revision : revisions) {
        if (revision.getAuthor() != null) {
            names.add(revision.getAuthor());
        }
    }
    Map<String, IdentityShort> mappedIdentities = new HashMap<String, IdentityShort>();
    for (IdentityShort identity : BaseSecurityManager.getInstance().findShortIdentitiesByName(names)) {
        mappedIdentities.put(identity.getName(), identity);
    }
    revisionListTableCtr.setTableDataModel(new RevisionListDataModel(revisions, mappedIdentities, getLocale()));
}
Also used : Versions(org.olat.core.util.vfs.version.Versions) HashMap(java.util.HashMap) VFSRevision(org.olat.core.util.vfs.version.VFSRevision) IdentityShort(org.olat.basesecurity.IdentityShort) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 3 with Versions

use of org.olat.core.util.vfs.version.Versions in project OpenOLAT by OpenOLAT.

the class FileUploadController method doFinishRevisionList.

private void doFinishRevisionList(UserRequest ureq) {
    if (existingVFSItem.getParentContainer() != null) {
        existingVFSItem = existingVFSItem.getParentContainer().resolve(existingVFSItem.getName());
    }
    Versionable versionable = (Versionable) existingVFSItem;
    Versions versions = versionable.getVersions();
    int maxNumOfRevisions = getMaxNumOfRevisionsOfExistingVFSItem();
    if (maxNumOfRevisions < 0 || maxNumOfRevisions > versions.getRevisions().size()) {
        askForComment(ureq);
    } else {
        askToReduceRevisionList(ureq, versionable);
    }
}
Also used : Versionable(org.olat.core.util.vfs.version.Versionable) Versions(org.olat.core.util.vfs.version.Versions)

Example 4 with Versions

use of org.olat.core.util.vfs.version.Versions in project OpenOLAT by OpenOLAT.

the class FileUploadController method askToReduceRevisionList.

private void askToReduceRevisionList(UserRequest ureq, Versionable versionable) {
    removeAsListenerAndDispose(revisionListCtr);
    removeAsListenerAndDispose(revisionListDialogBox);
    Versions versions = versionable.getVersions();
    int maxNumOfRevisions = getMaxNumOfRevisionsOfExistingVFSItem();
    String[] params = new String[] { Integer.toString(maxNumOfRevisions), Integer.toString(versions.getRevisions().size()) };
    String title = translate("ul.tooManyRevisions.title", params);
    String description = translate("ul.tooManyRevisions.description", params);
    revisionListCtr = new RevisionListController(ureq, getWindowControl(), versionable, null, description, false);
    listenTo(revisionListCtr);
    revisionListDialogBox = new CloseableModalController(getWindowControl(), translate("delete"), revisionListCtr.getInitialComponent(), true, title);
    listenTo(revisionListDialogBox);
    revisionListDialogBox.activate();
}
Also used : Versions(org.olat.core.util.vfs.version.Versions) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RevisionListController(org.olat.core.commons.modules.bc.version.RevisionListController)

Example 5 with Versions

use of org.olat.core.util.vfs.version.Versions in project OpenOLAT by OpenOLAT.

the class FileCopyController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source instanceof FileLinkChooserController) {
        if (event == Event.DONE_EVENT || event == Event.CANCELLED_EVENT) {
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
        } else if (event instanceof URLChoosenEvent) {
            URLChoosenEvent choosenEvent = (URLChoosenEvent) event;
            String url = choosenEvent.getURL();
            if (url.indexOf("://") < 0) {
                VFSContainer cContainer = folderComponent.getExternContainerForCopy();
                VFSItem item = cContainer.resolve(url);
                if (item instanceof VFSLeaf) {
                    sourceLeaf = (VFSLeaf) item;
                    String filename = sourceLeaf.getName();
                    VFSContainer tContainer = folderComponent.getCurrentContainer();
                    newFile = tContainer.createChildLeaf(filename);
                    if (newFile == null) {
                        existingVFSItem = (VFSLeaf) tContainer.resolve(filename);
                        fileAlreadyExists(ureq);
                    } else {
                        finishUpload(ureq);
                    }
                } else {
                    fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
                }
            } else {
                fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
            }
        }
    } else if (source == overwriteDialog) {
        if (event instanceof ButtonClickedEvent) {
            ButtonClickedEvent buttonClickedEvent = (ButtonClickedEvent) event;
            if (buttonClickedEvent.getPosition() == 0) {
                // ok
                if (existingVFSItem instanceof Versionable && ((Versionable) existingVFSItem).getVersions().isVersioned()) {
                    // new version
                    String relPath = null;
                    if (existingVFSItem instanceof OlatRootFileImpl) {
                        relPath = ((OlatRootFileImpl) existingVFSItem).getRelPath();
                    }
                    int maxNumOfRevisions = FolderConfig.versionsAllowed(relPath);
                    if (maxNumOfRevisions == 0) {
                        // someone play with the configuration
                        // Overwrite...
                        String fileName = existingVFSItem.getName();
                        existingVFSItem.delete();
                        newFile = folderComponent.getCurrentContainer().createChildLeaf(fileName);
                        // ... and notify listeners.
                        finishUpload(ureq);
                    } else {
                        removeAsListenerAndDispose(commentVersionCtr);
                        boolean locked = vfsLockManager.isLocked(existingVFSItem);
                        commentVersionCtr = new VersionCommentController(ureq, getWindowControl(), locked, true);
                        listenTo(commentVersionCtr);
                        removeAsListenerAndDispose(commentVersionDialogBox);
                        commentVersionDialogBox = new CloseableModalController(getWindowControl(), translate("save"), commentVersionCtr.getInitialComponent());
                        listenTo(commentVersionDialogBox);
                        commentVersionDialogBox.activate();
                    }
                } else {
                    // if the file is locked, ask for unlocking it
                    if (vfsLockManager.isLocked(existingVFSItem)) {
                        removeAsListenerAndDispose(unlockCtr);
                        unlockCtr = new VersionCommentController(ureq, getWindowControl(), true, false);
                        listenTo(unlockCtr);
                        removeAsListenerAndDispose(unlockDialogBox);
                        unlockDialogBox = new CloseableModalController(getWindowControl(), translate("ok"), unlockCtr.getInitialComponent());
                        listenTo(unlockDialogBox);
                        unlockDialogBox.activate();
                    } else {
                        // Overwrite...
                        String fileName = existingVFSItem.getName();
                        existingVFSItem.delete();
                        newFile = folderComponent.getCurrentContainer().createChildLeaf(fileName);
                        // ... and notify listeners.
                        finishUpload(ureq);
                    }
                }
            } else if (buttonClickedEvent.getPosition() == 1) {
                // not ok
                // make newFile with the proposition of filename
                newFile = folderComponent.getCurrentContainer().createChildLeaf(renamedFilename);
                // ... and notify listeners.
                finishUpload(ureq);
            } else if (buttonClickedEvent.getPosition() == 2) {
            // cancel
            // cancel -> do nothing
            } else {
                throw new RuntimeException("Unknown button number " + buttonClickedEvent.getPosition());
            }
        }
    } else if (source == lockedFileDialog) {
        if (event instanceof ButtonClickedEvent) {
            ButtonClickedEvent buttonClickedEvent = (ButtonClickedEvent) event;
            switch(buttonClickedEvent.getPosition()) {
                case 0:
                    {
                        // ... and notify listeners.
                        newFile = existingVFSItem;
                        finishUpload(ureq);
                        break;
                    }
                case 1:
                    {
                        // cancel
                        fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
                        break;
                    }
                default:
                    throw new RuntimeException("Unknown button number " + buttonClickedEvent.getPosition());
            }
        }
    } else if (source == commentVersionCtr) {
        String comment = commentVersionCtr.getComment();
        Roles roles = ureq.getUserSession().getRoles();
        boolean locked = vfsLockManager.isLocked(existingVFSItem);
        if (locked && !commentVersionCtr.keepLocked()) {
            vfsLockManager.unlock(existingVFSItem, getIdentity(), roles);
        }
        commentVersionDialogBox.deactivate();
        if (revisionListDialogBox != null) {
            revisionListDialogBox.deactivate();
        }
        // ok, new version of the file
        Versionable existingVersionableItem = (Versionable) existingVFSItem;
        boolean ok = existingVersionableItem.getVersions().addVersion(ureq.getIdentity(), comment, sourceLeaf.getInputStream());
        if (ok) {
            newFile = existingVFSItem;
        }
        finishSuccessfullUpload(existingVFSItem.getName(), ureq);
    } else if (source == unlockCtr) {
        // Overwrite...
        if (!unlockCtr.keepLocked()) {
            vfsLockManager.unlock(existingVFSItem, getIdentity(), ureq.getUserSession().getRoles());
        }
        unlockDialogBox.deactivate();
        newFile = existingVFSItem;
        // ... and notify listeners.
        finishSuccessfullUpload(existingVFSItem.getName(), ureq);
    } else if (source == revisionListCtr) {
        if (FolderCommandStatus.STATUS_CANCELED == revisionListCtr.getStatus()) {
            revisionListDialogBox.deactivate();
            // don't want to delete revisions
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
        } else {
            if (existingVFSItem instanceof Versionable && ((Versionable) existingVFSItem).getVersions().isVersioned()) {
                revisionListDialogBox.deactivate();
                Versionable versionable = (Versionable) existingVFSItem;
                Versions versions = versionable.getVersions();
                int maxNumOfRevisions = FolderConfig.versionsAllowed(null);
                if (maxNumOfRevisions < 0 || maxNumOfRevisions > versions.getRevisions().size()) {
                    removeAsListenerAndDispose(commentVersionCtr);
                    boolean locked = vfsLockManager.isLocked(existingVFSItem);
                    commentVersionCtr = new VersionCommentController(ureq, getWindowControl(), locked, true);
                    listenTo(commentVersionCtr);
                    removeAsListenerAndDispose(commentVersionDialogBox);
                    commentVersionDialogBox = new CloseableModalController(getWindowControl(), translate("save"), commentVersionCtr.getInitialComponent());
                    listenTo(commentVersionDialogBox);
                    commentVersionDialogBox.activate();
                } else {
                    removeAsListenerAndDispose(revisionListCtr);
                    revisionListCtr = new RevisionListController(ureq, getWindowControl(), versionable, false);
                    listenTo(revisionListCtr);
                    removeAsListenerAndDispose(revisionListDialogBox);
                    revisionListDialogBox = new CloseableModalController(getWindowControl(), translate("delete"), revisionListCtr.getInitialComponent());
                    listenTo(revisionListDialogBox);
                    revisionListDialogBox.activate();
                }
            }
        }
    }
}
Also used : ButtonClickedEvent(org.olat.core.gui.control.generic.modal.ButtonClickedEvent) FileLinkChooserController(org.olat.core.commons.controllers.linkchooser.FileLinkChooserController) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) Roles(org.olat.core.id.Roles) OlatRootFileImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFileImpl) RevisionListController(org.olat.core.commons.modules.bc.version.RevisionListController) Versionable(org.olat.core.util.vfs.version.Versionable) VersionCommentController(org.olat.core.commons.modules.bc.version.VersionCommentController) Versions(org.olat.core.util.vfs.version.Versions) URLChoosenEvent(org.olat.core.commons.controllers.linkchooser.URLChoosenEvent)

Aggregations

Versions (org.olat.core.util.vfs.version.Versions)20 Versionable (org.olat.core.util.vfs.version.Versionable)10 VFSRevision (org.olat.core.util.vfs.version.VFSRevision)8 RevisionListController (org.olat.core.commons.modules.bc.version.RevisionListController)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 OlatRootFileImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFileImpl)4 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)4 Date (java.util.Date)2 HashMap (java.util.HashMap)2 List (java.util.List)2 IdentityShort (org.olat.basesecurity.IdentityShort)2 FileLinkChooserController (org.olat.core.commons.controllers.linkchooser.FileLinkChooserController)2 URLChoosenEvent (org.olat.core.commons.controllers.linkchooser.URLChoosenEvent)2 MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)2 MetaInfoFactory (org.olat.core.commons.modules.bc.meta.MetaInfoFactory)2 MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)2 VersionCommentController (org.olat.core.commons.modules.bc.version.VersionCommentController)2 License (org.olat.core.commons.services.license.License)2