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

OO-1021: use the same order for the names of the columns, the data model, and the export

parent 43733933
No related branches found
No related tags found
No related merge requests found
......@@ -249,7 +249,9 @@ public class ChecklistManageCheckpointsController extends BasicController {
}
int j = 500;
for( Checkpoint checkpoint : checklist.getCheckpoints() ) {
List<Checkpoint> checkpointList = checklist.getCheckpointsSorted(ChecklistUIFactory.comparatorTitleAsc);
for( Checkpoint checkpoint : checkpointList ) {
String pointTitle = checkpoint.getTitle() == null ? "" : checkpoint.getTitle();
manageChecklistTable.addColumnDescriptor(new ChecklistMultiSelectColumnDescriptor(pointTitle, j++));
cols++;
......@@ -258,14 +260,15 @@ public class ChecklistManageCheckpointsController extends BasicController {
cols++;
manageChecklistTable.setMultiSelect(false);
manageTableData = new ChecklistManageTableDataModel(checklist, lstIdents, userPropertyHandlers, cols);
manageTableData = new ChecklistManageTableDataModel(checkpointList, lstIdents, userPropertyHandlers, cols);
manageChecklistTable.setTableDataModel(manageTableData);
panel.setContent(manageChecklistTable.getInitialComponent());
}
private void initEditTable(UserRequest ureq, Identity identity) {
editTableData = new ChecklistRunTableDataModel(this.checklist.getCheckpoints(), getTranslator());
List<Checkpoint> checkpoints = checklist.getCheckpoints();
editTableData = new ChecklistRunTableDataModel(checkpoints, getTranslator());
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("cl.table.empty"));
......@@ -285,8 +288,8 @@ public class ChecklistManageCheckpointsController extends BasicController {
editChecklistTable.addMultiSelectAction("cl.save.close", "save");
editChecklistTable.setTableDataModel(editTableData);
for(int i = 0; i < this.checklist.getCheckpoints().size(); i++) {
Checkpoint checkpoint = (Checkpoint) editTableData.getObject(i);
for(int i = 0; i<checkpoints.size(); i++) {
Checkpoint checkpoint = editTableData.getObject(i);
boolean selected = checkpoint.getSelectionFor(identity).booleanValue();
editChecklistTable.setMultiSelectSelectedAt(i, selected);
}
......@@ -300,7 +303,7 @@ public class ChecklistManageCheckpointsController extends BasicController {
ChecklistManager manager = ChecklistManager.getInstance();
int size = checklist.getCheckpoints().size();
for(int i = 0; i < size; i++) {
Checkpoint checkpoint = this.checklist.getCheckpoints().get(i);
Checkpoint checkpoint = checklist.getCheckpoints().get(i);
Boolean selected = checkpoint.getSelectionFor(identity);
if(selected.booleanValue() != selection.get(i)) {
checkpoint.setSelectionFor(identity, selection.get(i));
......@@ -313,8 +316,10 @@ public class ChecklistManageCheckpointsController extends BasicController {
int cdcnt = manageTableData.getColumnCount();
int rcnt = manageTableData.getRowCount();
StringBuilder sb = new StringBuilder();
boolean isAdministrativeUser = securityModule.isUserAllowedAdminProps(ureq.getUserSession().getRoles());
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, isAdministrativeUser);
// additional informations
sb.append(translate("cl.course.title")).append('\t').append(this.course.getCourseTitle());
sb.append(translate("cl.course.title")).append('\t').append(course.getCourseTitle());
sb.append('\n');
String listTitle = checklist.getTitle() == null ? "" : checklist.getTitle();
sb.append(translate("cl.title")).append('\t').append(listTitle);
......@@ -328,7 +333,14 @@ public class ChecklistManageCheckpointsController extends BasicController {
}
sb.append('\n');
// checkpoint description
sb.append('\t');
if(isAdministrativeUser) {
sb.append('\t');
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null) continue;
sb.append('\t');
}
for (Checkpoint checkpoint : checklist.getCheckpoints()) {
sb.append('\t').append(checkpoint.getDescription());
}
......
......@@ -35,7 +35,7 @@ public class ChecklistManageTableDataModel extends DefaultTableDataModel<Row> {
private int colCount;
private int rowCount;
public ChecklistManageTableDataModel(Checklist checklist, List<Identity> participants,
public ChecklistManageTableDataModel(List<Checkpoint> checkpointList, List<Identity> participants,
List<UserPropertyHandler> userPropertyHandlers, int cols) {
super(Collections.<Row>emptyList());
......@@ -44,7 +44,7 @@ public class ChecklistManageTableDataModel extends DefaultTableDataModel<Row> {
List<Row> entries = new ArrayList<>(rowCount);
for( Identity identity : participants ) {
entries.add(new Row(identity, userPropertyHandlers, checklist, Locale.ENGLISH));
entries.add(new Row(identity, userPropertyHandlers, checkpointList, Locale.ENGLISH));
}
setObjects(entries);
}
......@@ -86,7 +86,7 @@ public class ChecklistManageTableDataModel extends DefaultTableDataModel<Row> {
private final String[] identityProps;
private final Boolean[] checkpoints;
public Row(Identity identity, List<UserPropertyHandler> userPropertyHandlers, Checklist checklist, Locale locale) {
public Row(Identity identity, List<UserPropertyHandler> userPropertyHandlers, List<Checkpoint> checkpointList, Locale locale) {
this.identityKey = identity.getKey();
this.identityName = identity.getName();
......@@ -95,7 +95,6 @@ public class ChecklistManageTableDataModel extends DefaultTableDataModel<Row> {
identityProps[i] = userPropertyHandlers.get(i).getUserProperty(identity.getUser(), locale);
}
List<Checkpoint> checkpointList = checklist.getCheckpointsSorted(ChecklistUIFactory.comparatorTitleAsc);
checkpoints = new Boolean[checkpointList.size()];
for( int i=checkpointList.size(); i-->0; ) {
checkpoints[i] = checkpointList.get(i).getSelectionFor(identity);
......
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