cleanUpCommentDialog();
cleanUpRevisionDialog();
//ok, new version of the file
Versionable existingVersionableItem = (Versionable)existingVFSItem;
boolean ok = existingVersionableItem.getVersions().addVersion(ureq.getIdentity(), comment, newFile.getInputStream());
if(ok) {
newFile.delete();
VersionsManager.getInstance().delete(newFile, true);
//what can i do if existingVFSItem is a container
if(existingVFSItem instanceof VFSLeaf) {
newFile = (VFSLeaf)existingVFSItem;
}
}
finishUpload(ureq);
} else if (source == unlockCtr) {
// Overwrite...
String fileName = existingVFSItem.getName();
if(!unlockCtr.keepLocked()) {
MetaInfo info = ((MetaTagged)existingVFSItem).getMetaInfo();
info.setLocked(false);
info.setLockedBy(null);
info.write();
}
cleanUpUnlockDialog();
existingVFSItem.delete();
newFile.rename(fileName);
// ... and notify listeners.
finishUpload(ureq);
} else if (source == revisionListCtr) {
if(FolderCommandStatus.STATUS_CANCELED == revisionListCtr.getStatus()) {
//don't want to delete revisions, clean the temporary file
cleanUpRevisionDialog();
newFile.delete();
VersionsManager.getInstance().delete(newFile, true);
fireEvent(ureq, Event.CANCELLED_EVENT);
} else {
if (existingVFSItem instanceof Versionable && ((Versionable)existingVFSItem).getVersions().isVersioned()) {
cleanUpRevisionDialog();
Versionable versionable = (Versionable)existingVFSItem;
Versions versions = versionable.getVersions();
int maxNumOfRevisions = FolderConfig.versionsAllowed(null);
if(maxNumOfRevisions < 0 || maxNumOfRevisions > versions.getRevisions().size()) {
commentVersionCtr = new VersionCommentController(ureq,getWindowControl(), askForLock(existingVFSItem, ureq), true);
listenTo(commentVersionCtr);
commentVersionDialogBox = new CloseableModalController(getWindowControl(), translate("save"), commentVersionCtr.getInitialComponent());