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

OO-4484: reduce list of dispense to the profiled identity in profile

parent 90657497
No related branches found
No related tags found
No related merge requests found
...@@ -110,6 +110,7 @@ public class AbsenceNoticesListController extends FormBasicController { ...@@ -110,6 +110,7 @@ public class AbsenceNoticesListController extends FormBasicController {
* Show per default the start / end date as whole date * Show per default the start / end date as whole date
*/ */
private final boolean wholeDateDefault; private final boolean wholeDateDefault;
private final boolean withUserProperties;
private final boolean isAdministrativeUser; private final boolean isAdministrativeUser;
private final List<UserPropertyHandler> userPropertyHandlers; private final List<UserPropertyHandler> userPropertyHandlers;
private final LecturesSecurityCallback secCallback; private final LecturesSecurityCallback secCallback;
...@@ -134,7 +135,8 @@ public class AbsenceNoticesListController extends FormBasicController { ...@@ -134,7 +135,8 @@ public class AbsenceNoticesListController extends FormBasicController {
private BaseSecurityModule securityModule; private BaseSecurityModule securityModule;
public AbsenceNoticesListController(UserRequest ureq, WindowControl wControl, Date currentDate, public AbsenceNoticesListController(UserRequest ureq, WindowControl wControl, Date currentDate,
boolean authorizedEnabled, LecturesSecurityCallback secCallback, String tableId) { boolean authorizedEnabled, LecturesSecurityCallback secCallback, boolean withUserProperties,
String tableId) {
super(ureq, wControl, "absences_list", Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale())); super(ureq, wControl, "absences_list", Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale()));
setTranslator(userManager.getPropertyHandlerTranslator(getTranslator())); setTranslator(userManager.getPropertyHandlerTranslator(getTranslator()));
this.tableId = tableId; this.tableId = tableId;
...@@ -142,6 +144,7 @@ public class AbsenceNoticesListController extends FormBasicController { ...@@ -142,6 +144,7 @@ public class AbsenceNoticesListController extends FormBasicController {
this.currentDate = currentDate; this.currentDate = currentDate;
wholeDateDefault = (currentDate == null); wholeDateDefault = (currentDate == null);
this.authorizedEnabled = authorizedEnabled; this.authorizedEnabled = authorizedEnabled;
this.withUserProperties = withUserProperties;
isAdministrativeUser = securityModule.isUserAllowedAdminProps(ureq.getUserSession().getRoles()); isAdministrativeUser = securityModule.isUserAllowedAdminProps(ureq.getUserSession().getRoles());
userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_USAGE_IDENTIFIER, isAdministrativeUser); userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_USAGE_IDENTIFIER, isAdministrativeUser);
...@@ -167,7 +170,9 @@ public class AbsenceNoticesListController extends FormBasicController { ...@@ -167,7 +170,9 @@ public class AbsenceNoticesListController extends FormBasicController {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, NoticeCols.id)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, NoticeCols.id));
initUserColumns(columnsModel); if(withUserProperties) {
initUserColumns(columnsModel);
}
initColumns(columnsModel); initColumns(columnsModel);
tableModel = new AbsenceNoticesListTableModel(columnsModel, userManager, userPropertyHandlers, getLocale()); tableModel = new AbsenceNoticesListTableModel(columnsModel, userManager, userPropertyHandlers, getLocale());
......
...@@ -85,7 +85,7 @@ public class AbsencesController extends BasicController { ...@@ -85,7 +85,7 @@ public class AbsencesController extends BasicController {
searchCtrl = new AbsenceNoticeSearchController(ureq, getWindowControl(), currentDate); searchCtrl = new AbsenceNoticeSearchController(ureq, getWindowControl(), currentDate);
listenTo(searchCtrl); listenTo(searchCtrl);
noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(), noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(),
null, true, secCallback, "absences"); null, true, secCallback, true, "absences");
listenTo(noticesListCtlr); listenTo(noticesListCtlr);
mainVC = createVelocityContainer("absences"); mainVC = createVelocityContainer("absences");
......
...@@ -67,7 +67,7 @@ public class DailyAbsencesController extends BasicController { ...@@ -67,7 +67,7 @@ public class DailyAbsencesController extends BasicController {
searchParams.setParticipant(profiledIdentity); searchParams.setParticipant(profiledIdentity);
} }
noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(), noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(),
currentDate, true, secCallback, "daily"); currentDate, true, secCallback, true, "daily");
listenTo(noticesListCtlr); listenTo(noticesListCtlr);
mainVC = createVelocityContainer("daily_absences"); mainVC = createVelocityContainer("daily_absences");
......
...@@ -33,6 +33,7 @@ import org.olat.core.gui.control.WindowControl; ...@@ -33,6 +33,7 @@ import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.generic.wizard.StepRunnerCallback; import org.olat.core.gui.control.generic.wizard.StepRunnerCallback;
import org.olat.core.gui.control.generic.wizard.StepsMainRunController; import org.olat.core.gui.control.generic.wizard.StepsMainRunController;
import org.olat.core.id.Identity;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.modules.lecture.AbsenceNoticeSearchParameters; import org.olat.modules.lecture.AbsenceNoticeSearchParameters;
import org.olat.modules.lecture.AbsenceNoticeType; import org.olat.modules.lecture.AbsenceNoticeType;
...@@ -64,8 +65,34 @@ public class DispensationsController extends BasicController { ...@@ -64,8 +65,34 @@ public class DispensationsController extends BasicController {
private AbsenceNoticeSearchController searchCtrl; private AbsenceNoticeSearchController searchCtrl;
private AbsenceNoticesListController noticesListCtlr; private AbsenceNoticesListController noticesListCtlr;
/**
* Show a list of dispense (type notified or dispensation).
*
* @param ureq The user request
* @param wControl The window control
* @param currentDate The date to restrict the list
* @param secCallback The security callback
* @param withSearch With search
* @param withAddAbsence With button the add absence (if allowed by security callback)
*/
public DispensationsController(UserRequest ureq, WindowControl wControl, Date currentDate, public DispensationsController(UserRequest ureq, WindowControl wControl, Date currentDate,
LecturesSecurityCallback secCallback, boolean withSearch, boolean withAddAbsence) { LecturesSecurityCallback secCallback, boolean withSearch, boolean withAddAbsence) {
this(ureq, wControl, currentDate, secCallback, null, withSearch, withAddAbsence);
}
/**
* Show a list of dispense (type notified or dispensation).
*
* @param ureq The user request
* @param wControl The window control
* @param currentDate The date to restrict the list
* @param secCallback The security callback
* @param profiledIdentity Limit to a single identity (can be null)
* @param withSearch With search
* @param withAddAbsence With button the add absence (if allowed by security callback)
*/
public DispensationsController(UserRequest ureq, WindowControl wControl, Date currentDate,
LecturesSecurityCallback secCallback, Identity profiledIdentity, boolean withSearch, boolean withAddAbsence) {
super(ureq, wControl, Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale())); super(ureq, wControl, Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale()));
this.secCallback = secCallback; this.secCallback = secCallback;
...@@ -76,11 +103,13 @@ public class DispensationsController extends BasicController { ...@@ -76,11 +103,13 @@ public class DispensationsController extends BasicController {
searchParams.setLinkedToRollCall(false); searchParams.setLinkedToRollCall(false);
searchParams.setStartDate(CalendarUtils.startOfDay(currentDate)); searchParams.setStartDate(CalendarUtils.startOfDay(currentDate));
searchParams.setEndDate(CalendarUtils.endOfDay(currentDate)); searchParams.setEndDate(CalendarUtils.endOfDay(currentDate));
searchParams.setParticipant(profiledIdentity);
searchCtrl = new AbsenceNoticeSearchController(ureq, getWindowControl(), currentDate); searchCtrl = new AbsenceNoticeSearchController(ureq, getWindowControl(), currentDate);
listenTo(searchCtrl); listenTo(searchCtrl);
boolean showUserProperties = profiledIdentity == null;
noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(), noticesListCtlr = new AbsenceNoticesListController(ureq, getWindowControl(),
null, false, secCallback, "notices"); null, false, secCallback, showUserProperties, "notices");
listenTo(noticesListCtlr); listenTo(noticesListCtlr);
mainVC = createVelocityContainer("dispensations"); mainVC = createVelocityContainer("dispensations");
......
...@@ -159,7 +159,7 @@ public class IdentityProfileController extends BasicController implements Activa ...@@ -159,7 +159,7 @@ public class IdentityProfileController extends BasicController implements Activa
// dispensation // dispensation
if(lectureModule.isAbsenceNoticeEnabled()) { if(lectureModule.isAbsenceNoticeEnabled()) {
dispensationsTab = tabPane.addTab(translate("user.overview.dispensation"), uureq -> { dispensationsTab = tabPane.addTab(translate("user.overview.dispensation"), uureq -> {
dispensationsCtrl = new DispensationsController(uureq, getWindowControl(), null, secCallback, false, false); dispensationsCtrl = new DispensationsController(uureq, getWindowControl(), null, secCallback, profiledIdentity, false, false);
listenTo(dispensationsCtrl); listenTo(dispensationsCtrl);
return dispensationsCtrl.getInitialComponent(); return dispensationsCtrl.getInitialComponent();
}); });
......
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