summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Schwaer2015-09-04 16:59:50 +0200
committerStephan Schwaer2015-09-04 16:59:50 +0200
commit07dfb05c38d3cdc068a96ae029f07ef2c570cc74 (patch)
tree0b0a28bc0f8af5449474ba4163acc1e930418d7b
parent[server] mailtest RPC methods, bugfixes to nanohttpd (diff)
downloadtutor-module-07dfb05c38d3cdc068a96ae029f07ef2c570cc74.tar.gz
tutor-module-07dfb05c38d3cdc068a96ae029f07ef2c570cc74.tar.xz
tutor-module-07dfb05c38d3cdc068a96ae029f07ef2c570cc74.zip
[client] Added confirmation for changing owner of lecture, switched positions of buttons in custom permission windows.
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java17
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java52
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageCustomPermissionWindowLayout.java4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureCustomPermissionWindowLayout.java5
4 files changed, 40 insertions, 38 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
index ff752307..dede015f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
@@ -146,7 +146,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
window.dispose();
if(Gui.showMessageBox(me, "Sind Sie sicher, dass sie die Besitzerrechte an "
+ "einen anderen Account übertragen wollen?", MessageType.QUESTION_YESNO , LOGGER, null))
- setImageOwner(user);
+ setImageOwner(user);
}
}, "Besitzer festlegen", image.ownerId);
@@ -469,15 +469,14 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
* @param editable true to make fields editable, false otherwise.
*/
private void makeEditable(boolean editable) {
- editable = editable && ImagePerms.canEdit(image);
- boolean adminEdit = editable && ImagePerms.canAdmin(image);
+ editable = editable && (ImagePerms.canEdit(image) || ImagePerms.canAdmin(image));
txtTitle.setEditable(editable);
txtDescription.setEditable(editable);
txtTags.setEditable(editable);
cboOperatingSystem.setEnabled(editable);
-// cboShareMode.setEnabled(editable);
- btnPermissions.setEnabled(adminEdit);
- btnChangeOwner.setEnabled(adminEdit);
+ // cboShareMode.setEnabled(editable);
+ btnPermissions.setEnabled(editable && ImagePerms.canAdmin(image));
+ btnChangeOwner.setEnabled(editable && ImagePerms.canAdmin(image));
btnUpdateImage.setEnabled(editable);
}
@@ -549,7 +548,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
public void escapePressed() {
safeClose();
}
-
+
/*
* Safe close helper: checks if we have unsaved work and prompt the user for
* confirmation if so
@@ -558,7 +557,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
if (reactToChange() &&
!Gui.showMessageBox(me,
"Änderungen werden verworfen, wollen Sie wirklich abbrechen?", MessageType.QUESTION_YESNO, LOGGER, null))
- return;
- dispose();
+ return;
+ dispose();
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
index 991c934d..2c7e3fb2 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
@@ -181,7 +181,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
@Override
public void userAdded(UserInfo user, UserListWindow window) {
window.dispose();
- setLectureOwner(user);
+ if(Gui.showMessageBox(me, "Sind Sie sicher, dass sie die Besitzerrechte an "
+ + "einen anderen Account übertragen wollen?", MessageType.QUESTION_YESNO , LOGGER, null))
+ setLectureOwner(user);
}
}, "Besitzer festlegen", lecture.ownerId);
}
@@ -230,18 +232,18 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
public void setLecture(final String lectureId) {
ThriftActions.getLectureAndImageDetails(JOptionPane.getFrameForComponent(me), lectureId,
new LectureMetaCallback() {
- @Override
- public void fetchedLectureAndImageDetails(LectureRead lectureDetails,
- ImageDetailsRead imageDetails) {
- synchronized (me) {
- lecture = lectureDetails;
- image = imageDetails;
- permissionMap = ThriftActions.getLecturePermissions(
- JOptionPane.getFrameForComponent(me), lecture.lectureId);
- }
- fill();
- }
- });
+ @Override
+ public void fetchedLectureAndImageDetails(LectureRead lectureDetails,
+ ImageDetailsRead imageDetails) {
+ synchronized (me) {
+ lecture = lectureDetails;
+ image = imageDetails;
+ permissionMap = ThriftActions.getLecturePermissions(
+ JOptionPane.getFrameForComponent(me), lecture.lectureId);
+ }
+ fill();
+ }
+ });
}
/**
@@ -376,18 +378,18 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), lecture.imageVersionId,
image.imageName, image.virtId, image.osId, versionSize, new DownloadCallback() {
- @Override
- public void downloadInitialized(boolean success) {
- if (!success) {
- Gui.asyncExec(new Runnable() {
- @Override
- public void run() {
- btnDownloadImage.setEnabled(true);
- }
- });
+ @Override
+ public void downloadInitialized(boolean success) {
+ if (!success) {
+ Gui.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ btnDownloadImage.setEnabled(true);
}
- }
- });
+ });
+ }
+ }
+ });
}
/**
@@ -576,7 +578,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* @param editable true to make fields editable, false otherwise.
*/
private void makeEditable(boolean editable) {
- editable = editable && LecturePerms.canEdit(lecture);
+ editable = editable && (LecturePerms.canEdit(lecture) || LecturePerms.canAdmin(lecture));
txtTitle.setEditable(editable);
txtDescription.setEditable(editable);
btnLinkImage.setEnabled(editable);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageCustomPermissionWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageCustomPermissionWindowLayout.java
index 3ab9bfdb..3448cfa9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageCustomPermissionWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageCustomPermissionWindowLayout.java
@@ -52,11 +52,11 @@ public class ImageCustomPermissionWindowLayout extends JDialog {
// Panel for the buttons at the bottom
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
- btnOk = new JButton("Übernehmen");
buttonPane.add(Box.createGlue());
- buttonPane.add(btnOk);
btnClose = new JButton("Abbrechen");
buttonPane.add(btnClose);
+ btnOk = new JButton("Übernehmen");
+ buttonPane.add(btnOk);
// Panel with the permissions for other users
JPanel defaultPermissionPane = new JPanel();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureCustomPermissionWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureCustomPermissionWindowLayout.java
index 8e53e1a7..53f37d59 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureCustomPermissionWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureCustomPermissionWindowLayout.java
@@ -69,11 +69,12 @@ public class LectureCustomPermissionWindowLayout extends JDialog {
// Panel for the buttons at the bottom
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
- btnOk = new JButton("Übernehmen");
buttonPane.add(Box.createGlue());
- buttonPane.add(btnOk);
btnClose = new JButton("Abbrechen");
buttonPane.add(btnClose);
+ btnOk = new JButton("Übernehmen");
+ buttonPane.add(btnOk);
+
// Put everything into the grid
grid.add(lecturePermissionManager).fill(true, true).expand(true, true);