Skip to content
Snippets Groups Projects
Commit 904fa04e authored by srosse's avatar srosse
Browse files

OO-4878: show a message if the lock cannot be take over

parent 0e0f3f7c
No related branches found
No related tags found
No related merge requests found
......@@ -218,18 +218,12 @@ public class HTMLEditorController extends FormBasicController implements Activat
lock = CoordinatorManager.getInstance().getCoordinator().getLocker()
.acquireLock(lockResourceable, getIdentity(), lockToken, getWindow());
VelocityContainer vc = (VelocityContainer) flc.getComponent();
if (!lock.isSuccess()) {
vc.contextPut("locked", Boolean.TRUE);
String fullname = userManager.getUserDisplayName(lock.getOwner());
vc.contextPut("lockOwner", fullname);
vc.contextPut("lockOwnerSameUser", Boolean.valueOf(lock.isDifferentWindows()));
if (lock.isSuccess()) {
unsetLockError();
} else {
setLockedError(lock);
editable = false;
return;
} else {
vc.contextPut("locked", Boolean.FALSE);
vc.contextRemove("lockOwner");
vc.contextRemove("lockOwnerSameUser");
}
}
// Parse the content of the page
......@@ -240,6 +234,20 @@ public class HTMLEditorController extends FormBasicController implements Activat
}
}
private void unsetLockError() {
flc.contextPut("locked", Boolean.FALSE);
flc.contextRemove("lockOwner");
flc.contextRemove("lockOwnerSameUser");
flc.setDirty(true);
}
private void setLockedError(LockResult lockResult) {
flc.contextPut("locked", Boolean.TRUE);
String fullname = userManager.getUserDisplayName(lockResult.getOwner());
flc.contextPut("lockOwner", fullname);
flc.contextPut("lockOwnerSameUser", Boolean.valueOf(lockResult.isDifferentWindows()));
}
public Object getUserObject() {
return userObject;
}
......@@ -269,6 +277,10 @@ public class HTMLEditorController extends FormBasicController implements Activat
.acquireLock(lockResourceable, getIdentity(), lockToken, getWindow());
if(reacquiredLock.isSuccess()) {
lock = reacquiredLock;
unsetLockError();
} else {
setLockedError(reacquiredLock);
editable = false;
}
}
}
......
#Fri Jun 19 17:34:51 CEST 2009
acquireownbuttontext=Ubernehmen und editieren
error.lock.lost=Sie haben den Lock verloren.
error.pageeditedby=Die Seite wird zurzeit von Benutzer {0} bearbeitet. Versuchen Sie es sp\u00E4ter noch einmal.
lastModified=Zuletzt ge\u00E4ndert
......
#Fri Jan 22 19:30:49 CET 2010
acquireownbuttontext=Take over and edit
error.lock.lost=You have lost the lock.
error.pageeditedby=This page is currently edited by user {0}. Please try again later.
lastModified=Last modified
......
......@@ -83,25 +83,6 @@ public interface Locker {
* @return
*/
public LockEntry getLockEntry(OLATResourceable ores, String locksubkey);
/**
*
* acquires a persistent lock.
*
* @param ores
* @param ident
* @param locksubkey may not be longer than 30 chars
* @return the LockResult of this lock trial.
*/
//public LockResult aquirePersistentLock(OLATResourceable ores, Identity ident, String locksubkey);
/**
* releases a persistent lock.
*
* @param le the LockResult which stems from the lock acquired previously
*/
//public void releasePersistentLock(LockResult le);
/**
* for admin purposes only.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment