Skip to content
Snippets Groups Projects
Commit d84aec31 authored by fkiefer's avatar fkiefer
Browse files

OO-2621 edit rights

parent cea98c3f
No related branches found
No related tags found
No related merge requests found
...@@ -124,7 +124,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -124,7 +124,7 @@ public class InfoDisplayController extends FormBasicController {
initForm(ureq); initForm(ureq);
// now load with configuration // now load with configuration
loadMessages(); loadMessages(ureq);
} }
public InfoDisplayController(UserRequest ureq, WindowControl wControl, ModuleConfiguration config, public InfoDisplayController(UserRequest ureq, WindowControl wControl, ModuleConfiguration config,
...@@ -166,7 +166,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -166,7 +166,7 @@ public class InfoDisplayController extends FormBasicController {
} }
// now load with configuration // now load with configuration
loadMessages(); loadMessages(ureq);
} }
private int getConfigValue(ModuleConfiguration config, String key, int def) { private int getConfigValue(ModuleConfiguration config, String key, int def) {
...@@ -201,7 +201,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -201,7 +201,7 @@ public class InfoDisplayController extends FormBasicController {
* This is the main method which push the messages in the layout container, * This is the main method which push the messages in the layout container,
* and clean-up old links. * and clean-up old links.
*/ */
protected void loadMessages() { protected void loadMessages(UserRequest ureq) {
//first clear the current message if any //first clear the current message if any
for(Long key:previousDisplayKeys) { for(Long key:previousDisplayKeys) {
flc.contextRemove("info.date." + key); flc.contextRemove("info.date." + key);
...@@ -225,7 +225,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -225,7 +225,7 @@ public class InfoDisplayController extends FormBasicController {
DateElement dateEl = DateComponentFactory.createDateElementWithYear(dateCmpName, info.getCreationDate()); DateElement dateEl = DateComponentFactory.createDateElementWithYear(dateCmpName, info.getCreationDate());
flc.add(dateCmpName, dateEl); flc.add(dateCmpName, dateEl);
if(secCallback.canEdit()) { if(secCallback.canEdit() && (ureq.getIdentity().equals(info.getAuthor()) || secCallback.canDelete())) {
String editName = "info.edit." + info.getKey(); String editName = "info.edit." + info.getKey();
FormLink link = uifactory.addFormLink(editName, "edit", "edit", flc, Link.BUTTON_SMALL); FormLink link = uifactory.addFormLink(editName, "edit", "edit", flc, Link.BUTTON_SMALL);
link.setElementCssClass("o_sel_info_edit_msg"); link.setElementCssClass("o_sel_info_edit_msg");
...@@ -313,7 +313,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -313,7 +313,7 @@ public class InfoDisplayController extends FormBasicController {
getWindowControl().pop(); getWindowControl().pop();
} else if (event == Event.CHANGED_EVENT) { } else if (event == Event.CHANGED_EVENT) {
getWindowControl().pop(); getWindowControl().pop();
loadMessages(); loadMessages(ureq);
flc.setDirty(true);//update the view flc.setDirty(true);//update the view
} else if (event == Event.DONE_EVENT){ } else if (event == Event.DONE_EVENT){
showError("failed"); showError("failed");
...@@ -326,7 +326,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -326,7 +326,7 @@ public class InfoDisplayController extends FormBasicController {
LoggingResourceable.wrap(msgToDelete.getOLATResourceable(), OlatResourceableType.infoMessage)); LoggingResourceable.wrap(msgToDelete.getOLATResourceable(), OlatResourceableType.infoMessage));
infoMessageManager.deleteInfoMessage(msgToDelete); infoMessageManager.deleteInfoMessage(msgToDelete);
loadMessages(); loadMessages(ureq);
} }
confirmDelete.setUserObject(null); confirmDelete.setUserObject(null);
...@@ -335,7 +335,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -335,7 +335,7 @@ public class InfoDisplayController extends FormBasicController {
lockEntry = null; lockEntry = null;
} else if (source == editController) { } else if (source == editController) {
if(event == Event.DONE_EVENT) { if(event == Event.DONE_EVENT) {
loadMessages(); loadMessages(ureq);
} }
editDialogBox.deactivate(); editDialogBox.deactivate();
removeAsListenerAndDispose(editController); removeAsListenerAndDispose(editController);
...@@ -371,11 +371,11 @@ public class InfoDisplayController extends FormBasicController { ...@@ -371,11 +371,11 @@ public class InfoDisplayController extends FormBasicController {
} else if(source == oldMsgsLink) { } else if(source == oldMsgsLink) {
maxResults = -1; maxResults = -1;
after = null; after = null;
loadMessages(); loadMessages(ureq);
} else if(source == newMsgsLink) { } else if(source == newMsgsLink) {
maxResults = maxResultsConfig; maxResults = maxResultsConfig;
after = afterConfig; after = afterConfig;
loadMessages(); loadMessages(ureq);
} else { } else {
super.formInnerEvent(ureq, source, event); super.formInnerEvent(ureq, source, event);
} }
...@@ -391,7 +391,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -391,7 +391,7 @@ public class InfoDisplayController extends FormBasicController {
showWarning("already.deleted"); showWarning("already.deleted");
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(lockEntry); CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(lockEntry);
lockEntry = null; lockEntry = null;
loadMessages(); loadMessages(ureq);
} else { } else {
String title = StringHelper.escapeHtml(msg.getTitle()); String title = StringHelper.escapeHtml(msg.getTitle());
String confirmDeleteText = translate("edit.confirm_delete", new String[]{ title }); String confirmDeleteText = translate("edit.confirm_delete", new String[]{ title });
...@@ -414,7 +414,7 @@ public class InfoDisplayController extends FormBasicController { ...@@ -414,7 +414,7 @@ public class InfoDisplayController extends FormBasicController {
showWarning("already.deleted"); showWarning("already.deleted");
CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(lockEntry); CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(lockEntry);
lockEntry = null; lockEntry = null;
loadMessages(); loadMessages(ureq);
} else { } else {
removeAsListenerAndDispose(editController); removeAsListenerAndDispose(editController);
removeAsListenerAndDispose(editDialogBox); removeAsListenerAndDispose(editDialogBox);
......
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