Index: lams_common/src/java/org/lamsfoundation/lams/util/ExcelCell.java =================================================================== diff -u -r75d371089c49a0ebc7dd90f64cb4746079c0b951 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_common/src/java/org/lamsfoundation/lams/util/ExcelCell.java (.../ExcelCell.java) (revision 75d371089c49a0ebc7dd90f64cb4746079c0b951) +++ lams_common/src/java/org/lamsfoundation/lams/util/ExcelCell.java (.../ExcelCell.java) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -31,13 +31,20 @@ public class ExcelCell { public final static int BORDER_STYLE_LEFT_THIN = 1; + public final static int BORDER_STYLE_LEFT_THICK = 4; public final static int BORDER_STYLE_RIGHT_THICK = 2; public final static int BORDER_STYLE_BOTTOM_THIN = 3; + public final static int ALIGN_GENERAL = 1; + public final static int ALIGN_LEFT = 2; + public final static int ALIGN_CENTER = 3; + public final static int ALIGN_RIGHT = 4; + private Object cellValue; private Boolean isBold; private IndexedColors color; private int borderStyle = 0; + private int alignment = 0; public ExcelCell() { } @@ -96,4 +103,14 @@ public void setBorderStyle(int borderStyle) { this.borderStyle = borderStyle; } + + public int getAlignment() { + return alignment; + } + + // return the current cell to allow chaining. + public ExcelCell setAlignment(int alignment) { + this.alignment = alignment; + return this; + } } Index: lams_common/src/java/org/lamsfoundation/lams/util/ExcelUtil.java =================================================================== diff -u -r75d371089c49a0ebc7dd90f64cb4746079c0b951 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_common/src/java/org/lamsfoundation/lams/util/ExcelUtil.java (.../ExcelUtil.java) (revision 75d371089c49a0ebc7dd90f64cb4746079c0b951) +++ lams_common/src/java/org/lamsfoundation/lams/util/ExcelUtil.java (.../ExcelUtil.java) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -37,6 +37,7 @@ import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellUtil; import org.apache.poi.ss.util.WorkbookUtil; import org.apache.poi.xssf.streaming.SXSSFWorkbook; @@ -54,8 +55,10 @@ private static CellStyle yellowColor; private static CellStyle borderStyleLeftThin; + private static CellStyle borderStyleLeftThick; private static CellStyle borderStyleRightThick; private static CellStyle borderStyleLeftThinBoldFont; + private static CellStyle borderStyleLeftThickBoldFont; private static CellStyle borderStyleRightThickBoldFont; private static CellStyle borderStyleBottomThin; private static CellStyle borderStyleBottomThinBoldFont; @@ -120,12 +123,18 @@ borderStyleLeftThin = workbook.createCellStyle(); borderStyleLeftThin.setBorderLeft(CellStyle.BORDER_THIN); borderStyleLeftThin.setFont(defaultFont); + borderStyleLeftThick = workbook.createCellStyle(); + borderStyleLeftThick.setBorderLeft(CellStyle.BORDER_THICK); + borderStyleLeftThick.setFont(defaultFont); borderStyleRightThick = workbook.createCellStyle(); borderStyleRightThick.setBorderRight(CellStyle.BORDER_THICK); borderStyleRightThick.setFont(defaultFont); borderStyleLeftThinBoldFont = workbook.createCellStyle(); borderStyleLeftThinBoldFont.setBorderLeft(CellStyle.BORDER_THIN); borderStyleLeftThinBoldFont.setFont(boldFont); + borderStyleLeftThickBoldFont = workbook.createCellStyle(); + borderStyleLeftThickBoldFont.setBorderLeft(CellStyle.BORDER_THICK); + borderStyleLeftThickBoldFont.setFont(boldFont); borderStyleRightThickBoldFont = workbook.createCellStyle(); borderStyleRightThickBoldFont.setBorderRight(CellStyle.BORDER_THICK); borderStyleRightThickBoldFont.setFont(boldFont); @@ -164,16 +173,16 @@ // Print title in bold, if needed if (!StringUtils.isBlank(sheetTitle)) { Row row = sheet.createRow(0); - ExcelUtil.createCell(new ExcelCell(sheetTitle, true), 0, row); + ExcelUtil.createCell(new ExcelCell(sheetTitle, true), 0, row, workbook); } // Print current date, if needed if (!StringUtils.isBlank(dateHeader)) { Row row = sheet.createRow(1); - ExcelUtil.createCell(new ExcelCell(dateHeader, false), 0, row); + ExcelUtil.createCell(new ExcelCell(dateHeader, false), 0, row, workbook); SimpleDateFormat titleDateFormat = new SimpleDateFormat(FileUtil.EXPORT_TO_SPREADSHEET_TITLE_DATE_FORMAT); - ExcelUtil.createCell(new ExcelCell(titleDateFormat.format(new Date()), false), 1, row); + ExcelUtil.createCell(new ExcelCell(titleDateFormat.format(new Date()), false), 1, row, workbook); } if (data != null) { @@ -190,7 +199,7 @@ int columnSize = data[rowIndex].length; for (int columnIndex = 0; columnIndex < columnSize; columnIndex++) { ExcelCell excelCell = data[rowIndex][columnIndex]; - ExcelUtil.createCell(excelCell, columnIndex, row); + ExcelUtil.createCell(excelCell, columnIndex, row, workbook); } //calculate max column size @@ -208,7 +217,7 @@ } - public static void createCell(ExcelCell excelCell, int cellnum, Row row) { + public static void createCell(ExcelCell excelCell, int cellnum, Row row, Workbook workbook) { if (excelCell != null) { Cell cell = row.createCell(cellnum); @@ -261,6 +270,13 @@ cell.setCellStyle(borderStyleLeftThin); } break; + case ExcelCell.BORDER_STYLE_LEFT_THICK: + if (excelCell.isBold()) { + cell.setCellStyle(borderStyleLeftThickBoldFont); + } else { + cell.setCellStyle(borderStyleLeftThick); + } + break; case ExcelCell.BORDER_STYLE_RIGHT_THICK: if (excelCell.isBold()) { cell.setCellStyle(borderStyleRightThickBoldFont); @@ -280,7 +296,26 @@ } } + + if (excelCell.getAlignment() != 0) { + switch (excelCell.getAlignment()) { + case ExcelCell.ALIGN_GENERAL: + CellUtil.setCellStyleProperty(cell, workbook, CellUtil.ALIGNMENT, CellStyle.ALIGN_GENERAL); + break; + case ExcelCell.ALIGN_LEFT: + CellUtil.setCellStyleProperty(cell, workbook, CellUtil.ALIGNMENT, CellStyle.ALIGN_LEFT); + break; + case ExcelCell.ALIGN_CENTER: + CellUtil.setCellStyleProperty(cell, workbook, CellUtil.ALIGNMENT, CellStyle.ALIGN_CENTER); + break; + case ExcelCell.ALIGN_RIGHT: + CellUtil.setCellStyleProperty(cell, workbook, CellUtil.ALIGNMENT, CellStyle.ALIGN_RIGHT); + break; + default: + break; + } + } } } Index: lams_gradebook/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rea304652563d0cf20a36c2a4b5904b22d1c95b66 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision ea304652563d0cf20a36c2a4b5904b22d1c95b66) +++ lams_gradebook/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -90,8 +90,8 @@ label.max.possible =Max possible label.total.actuals =Total actuals label.max.mark =Max mark -label.actuals =Actuals -label.max =Max +label.actuals =TOTAL +label.max =Max Mark Available label.overall.totals =Overall totals audit.lesson.change.mark =Changed mark for user {0}. LessonId: {1}. Old mark: {2}, new mark: {3} audit.activity.change.mark =Changed mark for user {0}. LessonId: {1}. ActivityId:{2}. Old mark: {3}, new mark: {4} @@ -104,6 +104,5 @@ gradebook.monitor.hide.dates =Hide dates gradebook.export.excel =Export grades label.select.lessons.to.export =Select lessons to export - - +label.simplified.export=Simplified Export (only scores) #======= End labels: Exported 98 labels for en AU ===== Index: lams_gradebook/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rea304652563d0cf20a36c2a4b5904b22d1c95b66 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision ea304652563d0cf20a36c2a4b5904b22d1c95b66) +++ lams_gradebook/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -90,8 +90,8 @@ label.max.possible =Max possible label.total.actuals =Total actuals label.max.mark =Max mark -label.actuals =Actuals -label.max =Max +label.actuals =TOTAL +label.max =Max Mark Available label.overall.totals =Overall totals audit.lesson.change.mark =Changed mark for user {0}. LessonId: {1}. Old mark: {2}, new mark: {3} audit.activity.change.mark =Changed mark for user {0}. LessonId: {1}. ActivityId:{2}. Old mark: {3}, new mark: {4} Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/GradebookService.java =================================================================== diff -u -r0aad94a28574176ae783da37b50e4108c0882e90 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/GradebookService.java (.../GradebookService.java) (revision 0aad94a28574176ae783da37b50e4108c0882e90) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/GradebookService.java (.../GradebookService.java) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -1246,7 +1246,7 @@ @Override public LinkedHashMap exportSelectedLessonsGradebook(Integer userId, Integer organisationId, - String[] lessonIds) { + String[] lessonIds, boolean simplified) { SimpleDateFormat cellDateFormat = new SimpleDateFormat(FileUtil.EXPORT_TO_SPREADSHEET_TITLE_DATE_FORMAT); LinkedHashMap dataToExport = new LinkedHashMap(); @@ -1307,108 +1307,97 @@ activityTouserToGradebookUserActivityMap.put(activity.getActivityId(), userToGradebookUserActivityMap); } - int numberCellsPerRow = (selectedLessons.size() * 9) + (allActivities.size() * 2) + 5; + int numberCellsPerRow = simplified ? 3 + selectedLessons.size() + 3 : + (selectedLessons.size() * 9) + (allActivities.size() * 2) + 5; // Lesson names row---------------------- ExcelCell[] lessonsNames = new ExcelCell[numberCellsPerRow]; - int i = 4; - for (Lesson lesson : selectedLessons) { - List lessonActivities = lessonActivitiesMap.get(lesson.getLessonId()); - int numberActivities = lessonActivities.size(); - lessonsNames[i + numberActivities] = new ExcelCell(lesson.getLessonName(), true); - i += 9 + (numberActivities * 2); + if ( simplified ) { + int i = 3; + for (Lesson lesson : selectedLessons) { + lessonsNames[i++] = new ExcelCell(lesson.getLessonName(), true).setAlignment(ExcelCell.ALIGN_CENTER); + } + lessonsNames[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_LEFT_THICK); + lessonsNames[i++] = new ExcelCell(getMessage("label.overall.totals"), true).setAlignment(ExcelCell.ALIGN_CENTER); + lessonsNames[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_RIGHT_THICK); + } else { + int i = 4; + for (Lesson lesson : selectedLessons) { + List lessonActivities = lessonActivitiesMap.get(lesson.getLessonId()); + int numberActivities = lessonActivities.size(); + lessonsNames[i + numberActivities] = new ExcelCell(lesson.getLessonName(), true); + i += 9 + (numberActivities * 2); + } + i -= 2; + lessonsNames[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_LEFT_THIN); + lessonsNames[i++] = new ExcelCell(getMessage("label.overall.totals"), true); + lessonsNames[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_RIGHT_THICK); } - i -= 2; - lessonsNames[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_LEFT_THIN); - lessonsNames[i++] = new ExcelCell(getMessage("label.overall.totals"), true); - lessonsNames[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_RIGHT_THICK); - rowList.add(lessonsNames); // Headers row---------------------- - ExcelCell[] headerRow = new ExcelCell[numberCellsPerRow]; - i = 0; + if ( simplified ) + rowList.add(createSelectedLessonsHeaderSimplified(selectedLessons, numberCellsPerRow)); + else + rowList.add(createSelectedLessonsHeaderFull(selectedLessons, lessonActivitiesMap, + numberCellsPerRow)); - for (Lesson lesson : selectedLessons) { - headerRow[i++] = new ExcelCell(getMessage("gradebook.export.last.name"), false); - headerRow[i++] = new ExcelCell(getMessage("gradebook.export.first.name"), false); - headerRow[i++] = new ExcelCell(getMessage("gradebook.export.login"), false); - headerRow[i++] = new ExcelCell(getMessage("label.group"), false); - headerRow[i++] = new ExcelCell(getMessage("gradebook.columntitle.startDate"), false); - headerRow[i++] = new ExcelCell(getMessage("gradebook.columntitle.completeDate"), false); - - List activities = lessonActivitiesMap.get(lesson.getLessonId()); - for (Activity activity : activities) { - headerRow[i++] = new ExcelCell(activity.getTitle(), true); - headerRow[i++] = new ExcelCell(getMessage("label.max.possible"), false); - } - - headerRow[i++] = new ExcelCell(getMessage("label.total.actuals"), true, - ExcelCell.BORDER_STYLE_LEFT_THIN); - headerRow[i++] = new ExcelCell(getMessage("label.max.mark"), false); - headerRow[i++] = new ExcelCell("%", ExcelCell.BORDER_STYLE_RIGHT_THICK); - } - i += 2; - headerRow[i++] = new ExcelCell(getMessage("label.actuals"), true, ExcelCell.BORDER_STYLE_LEFT_THIN); - headerRow[i++] = new ExcelCell(getMessage("label.max"), true); - headerRow[i++] = new ExcelCell("%", true, ExcelCell.BORDER_STYLE_RIGHT_THICK); - rowList.add(headerRow); - // Actual data rows---------------------- for (User learner : allLearners) { Double overallTotal = 0d; Double overallMaxMark = 0d; ExcelCell[] userRow = new ExcelCell[numberCellsPerRow]; - i = 0; + int i = 0; + if ( simplified ) { + i = addUsernameCells(learner, userRow, i); + } + for (Lesson lesson : selectedLessons) { Double lessonTotal = 0d; Double lessonMaxMark = 0d; List activities = lessonActivitiesMap.get(lesson.getLessonId()); - //first, last names and login - String lastName = (learner.getLastName() == null) ? "" : learner.getLastName().toUpperCase(); - userRow[i++] = new ExcelCell(lastName, false); - String firstName = (learner.getFirstName() == null) ? "" : learner.getFirstName().toUpperCase(); - userRow[i++] = new ExcelCell(firstName, false); - userRow[i++] = new ExcelCell(learner.getLogin(), false); + if ( ! simplified ) { + i = addUsernameCells(learner, userRow, i); - // check if learner is participating in this lesson - if (!lesson.getAllLearners().contains(learner)) { - i += 1 + (activities.size() * 2); - userRow[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_LEFT_THIN); - userRow[i++] = new ExcelCell("", false); - userRow[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_RIGHT_THICK); - continue; - } + // check if learner is participating in this lesson + if (!lesson.getAllLearners().contains(learner)) { + i += 3 + (activities.size() * 2); + userRow[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_LEFT_THIN); + userRow[i++] = new ExcelCell("", false); + userRow[i++] = new ExcelCell("", ExcelCell.BORDER_STYLE_RIGHT_THICK); + continue; + } - // group name - String groupName = ""; - for (Group group : (Set) lesson.getLessonClass().getGroups()) { - if (group.hasLearner(learner)) { - groupName = group.getGroupName(); - break; + // group name + String groupName = ""; + for (Group group : (Set) lesson.getLessonClass().getGroups()) { + if (group.hasLearner(learner)) { + groupName = group.getGroupName(); + break; + } } - } - userRow[i++] = new ExcelCell(groupName, false); + userRow[i++] = new ExcelCell(groupName, false); - //start and complete dates - LearnerProgress learnerProgress = null; - for (LearnerProgress learnerProgressIter : learnerProgresses) { - if (learnerProgressIter.getUser().getUserId().equals(learner.getUserId()) - && learnerProgressIter.getLesson().getLessonId().equals(lesson.getLessonId())) { - learnerProgress = learnerProgressIter; + //start and complete dates + LearnerProgress learnerProgress = null; + for (LearnerProgress learnerProgressIter : learnerProgresses) { + if (learnerProgressIter.getUser().getUserId().equals(learner.getUserId()) + && learnerProgressIter.getLesson().getLessonId().equals(lesson.getLessonId())) { + learnerProgress = learnerProgressIter; + } } + String startDate = (learnerProgress == null || learnerProgress.getStartDate() == null) ? "" + : cellDateFormat.format(learnerProgress.getStartDate()); + userRow[i++] = new ExcelCell(startDate, false); + String finishDate = (learnerProgress == null || learnerProgress.getFinishDate() == null) ? "" + : cellDateFormat.format(learnerProgress.getFinishDate()); + userRow[i++] = new ExcelCell(finishDate, false); } - String startDate = (learnerProgress == null || learnerProgress.getStartDate() == null) ? "" - : cellDateFormat.format(learnerProgress.getStartDate()); - userRow[i++] = new ExcelCell(startDate, false); - String finishDate = (learnerProgress == null || learnerProgress.getFinishDate() == null) ? "" - : cellDateFormat.format(learnerProgress.getFinishDate()); - userRow[i++] = new ExcelCell(finishDate, false); - + for (ToolActivity activity : activities) { Map userToGradebookUserActivityMap = activityTouserToGradebookUserActivityMap .get(activity.getActivityId()); @@ -1417,34 +1406,47 @@ Double mark = 0d; if (gradebookUserActivity != null) { mark = gradebookUserActivity.getMark(); - userRow[i++] = new ExcelCell(mark, false); + if ( ! simplified ) + userRow[i++] = new ExcelCell(mark, false); } else { - userRow[i++] = new ExcelCell("", false); + if ( ! simplified ) + userRow[i++] = new ExcelCell("", false); } Long activityTotalMarks = (activityToTotalMarkMap.get(activity.getActivityId()) != null) ? activityToTotalMarkMap.get(activity.getActivityId()) : 0l; - userRow[i++] = new ExcelCell(activityTotalMarks, false); + if ( ! simplified ) + userRow[i++] = new ExcelCell(activityTotalMarks, false); lessonTotal += mark; overallTotal += mark; lessonMaxMark += activityTotalMarks; overallMaxMark += activityTotalMarks; } - userRow[i++] = new ExcelCell(lessonTotal, ExcelCell.BORDER_STYLE_LEFT_THIN); - userRow[i++] = new ExcelCell(lessonMaxMark, false); - Double percentage = (lessonMaxMark != 0) ? lessonTotal / lessonMaxMark : 0d; - userRow[i++] = new ExcelCell(percentage, ExcelCell.BORDER_STYLE_RIGHT_THICK); - + if ( simplified ) { + userRow[i++] = new ExcelCell(lessonTotal, ExcelCell.BORDER_STYLE_LEFT_THIN); + } else { + userRow[i++] = new ExcelCell(lessonTotal, ExcelCell.BORDER_STYLE_LEFT_THIN); + userRow[i++] = new ExcelCell(lessonMaxMark, false); + Double percentage = (lessonMaxMark != 0) ? lessonTotal / lessonMaxMark : 0d; + userRow[i++] = new ExcelCell(percentage, ExcelCell.BORDER_STYLE_RIGHT_THICK); + } } - i += 2; - userRow[i++] = new ExcelCell(overallTotal, ExcelCell.BORDER_STYLE_LEFT_THIN); - userRow[i++] = new ExcelCell(overallMaxMark, false); + ; Double percentage = (overallMaxMark != 0) ? overallTotal / overallMaxMark : 0d; - userRow[i++] = new ExcelCell(percentage, true, ExcelCell.BORDER_STYLE_RIGHT_THICK); - + if (simplified) { + userRow[i++] = new ExcelCell(overallTotal, ExcelCell.BORDER_STYLE_LEFT_THICK); + userRow[i++] = new ExcelCell(overallMaxMark, false); + userRow[i++] = new ExcelCell(percentage, false, ExcelCell.BORDER_STYLE_RIGHT_THICK); + } else { + i += 2; + userRow[i++] = new ExcelCell(overallTotal, ExcelCell.BORDER_STYLE_LEFT_THIN); + userRow[i++] = new ExcelCell(overallMaxMark, false); + userRow[i++] = new ExcelCell(percentage, true, ExcelCell.BORDER_STYLE_RIGHT_THICK); + } + rowList.add(userRow); } } @@ -1454,6 +1456,66 @@ return dataToExport; } + private int addUsernameCells(User learner, ExcelCell[] userRow, int i) { + //first, last names and login + String lastName = (learner.getLastName() == null) ? "" : learner.getLastName().toUpperCase(); + userRow[i++] = new ExcelCell(lastName, false); + String firstName = (learner.getFirstName() == null) ? "" : learner.getFirstName().toUpperCase(); + userRow[i++] = new ExcelCell(firstName, false); + userRow[i++] = new ExcelCell(learner.getLogin(), false); + return i; + } + + private ExcelCell[] createSelectedLessonsHeaderFull(Set selectedLessons, + Map> lessonActivitiesMap, int numberCellsPerRow) { + int i; + ExcelCell[] headerRow = new ExcelCell[numberCellsPerRow]; + i = 0; + + for (Lesson lesson : selectedLessons) { + headerRow[i++] = new ExcelCell(getMessage("gradebook.export.last.name"), false); + headerRow[i++] = new ExcelCell(getMessage("gradebook.export.first.name"), false); + headerRow[i++] = new ExcelCell(getMessage("gradebook.export.login"), false); + headerRow[i++] = new ExcelCell(getMessage("label.group"), false); + headerRow[i++] = new ExcelCell(getMessage("gradebook.columntitle.startDate"), false); + headerRow[i++] = new ExcelCell(getMessage("gradebook.columntitle.completeDate"), false); + + List activities = lessonActivitiesMap.get(lesson.getLessonId()); + for (Activity activity : activities) { + headerRow[i++] = new ExcelCell(activity.getTitle(), true); + headerRow[i++] = new ExcelCell(getMessage("label.max.possible"), false); + } + + headerRow[i++] = new ExcelCell(getMessage("label.total.actuals"), true, ExcelCell.BORDER_STYLE_LEFT_THIN); + headerRow[i++] = new ExcelCell(getMessage("label.max.mark"), false); + headerRow[i++] = new ExcelCell("%", ExcelCell.BORDER_STYLE_RIGHT_THICK); + } + i += 2; + headerRow[i++] = new ExcelCell(getMessage("label.actuals"), true, ExcelCell.BORDER_STYLE_LEFT_THIN); + headerRow[i++] = new ExcelCell(getMessage("label.max"), true); + headerRow[i++] = new ExcelCell("%", true, ExcelCell.BORDER_STYLE_RIGHT_THICK); + return headerRow; + } + + private ExcelCell[] createSelectedLessonsHeaderSimplified(Set selectedLessons, int numberCellsPerRow) { + int i = 0; + ExcelCell[] headerRow = new ExcelCell[numberCellsPerRow]; + + // Simplified shows the learner's name once at the far left of the spreadsheet. + headerRow[i++] = new ExcelCell(getMessage("gradebook.export.last.name"), false); + headerRow[i++] = new ExcelCell(getMessage("gradebook.export.first.name"), false); + headerRow[i++] = new ExcelCell(getMessage("gradebook.export.login"), false); + + for (Lesson lesson : selectedLessons) { + headerRow[i++] = new ExcelCell(getMessage("label.total.actuals"), false, ExcelCell.BORDER_STYLE_LEFT_THIN) + .setAlignment(ExcelCell.ALIGN_CENTER); + } + + headerRow[i++] = new ExcelCell(getMessage("label.actuals"), true, ExcelCell.BORDER_STYLE_LEFT_THICK).setAlignment(ExcelCell.ALIGN_CENTER); + headerRow[i++] = new ExcelCell(getMessage("label.max"), false).setAlignment(ExcelCell.ALIGN_CENTER); + headerRow[i++] = new ExcelCell("%", false, ExcelCell.BORDER_STYLE_RIGHT_THICK).setAlignment(ExcelCell.ALIGN_CENTER); + return headerRow; + } @Override public void updateActivityMark(Double mark, String feedback, Integer userID, Long toolSessionID, Boolean markedInGradebook) { @@ -1562,23 +1624,6 @@ } } } - // TODO Remove -// /** -// * Gets the internationalised date -// * -// * @param user -// * @param date -// * @return -// */ -// private String getLocaleDateString(User user, Date date) { -// if ((user == null) || (date == null)) { -// return null; -// } -// -// Locale locale = new Locale(user.getLocale().getLanguageIsoCode(), user.getLocale().getCountryIsoCode()); -// String dateStr = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale).format(date); -// return dateStr; -// } /** * Returns progress status as text message. Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/IGradebookService.java =================================================================== diff -u -r0aad94a28574176ae783da37b50e4108c0882e90 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/IGradebookService.java (.../IGradebookService.java) (revision 0aad94a28574176ae783da37b50e4108c0882e90) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/service/IGradebookService.java (.../IGradebookService.java) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -305,5 +305,5 @@ * @return */ LinkedHashMap exportSelectedLessonsGradebook(Integer userId, Integer organisationId, - String[] lessonIds); + String[] lessonIds, boolean simplified); } \ No newline at end of file Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/action/GradebookMonitoringAction.java =================================================================== diff -u -r506e82d55455419723f11c0a8f99270b39f04055 -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/action/GradebookMonitoringAction.java (.../GradebookMonitoringAction.java) (revision 506e82d55455419723f11c0a8f99270b39f04055) +++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/web/action/GradebookMonitoringAction.java (.../GradebookMonitoringAction.java) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -364,6 +364,8 @@ response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the organisation"); return null; } + + boolean simplified = WebUtil.readBooleanParam(request, "simplified", false); Organisation organisation = (Organisation) getUserService().findById(Organisation.class, organisationID); String[] lessonIds = request.getParameterValues(AttributeNames.PARAM_LESSON_ID); @@ -372,7 +374,7 @@ + " from course: " + organisationID); } LinkedHashMap dataToExport = getGradebookService() - .exportSelectedLessonsGradebook(user.getUserID(), organisationID, lessonIds); + .exportSelectedLessonsGradebook(user.getUserID(), organisationID, lessonIds, simplified); String fileName = organisation.getName().replaceAll(" ", "_") + ".xlsx"; fileName = FileUtil.encodeFilenameForDownload(request, fileName); Index: lams_gradebook/web/gradebookCourseMonitor.jsp =================================================================== diff -u -rcf49a1fdafe6a2eee9f39ea840b5d6325fa1d82d -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/web/gradebookCourseMonitor.jsp (.../gradebookCourseMonitor.jsp) (revision cf49a1fdafe6a2eee9f39ea840b5d6325fa1d82d) +++ lams_gradebook/web/gradebookCourseMonitor.jsp (.../gradebookCourseMonitor.jsp) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -398,7 +398,9 @@ } var areaToBlock = "select-lessons-area"; - var exportExcelUrl = "/gradebookMonitoring.do?dispatch=exportExcelSelectedLessons&organisationID=${organisationID}" + lessonIds; + var simplified = jQuery("#export-selected-simplified").prop('checked'); + simplified = "&simplified="+simplified; + var exportExcelUrl = "/gradebookMonitoring.do?dispatch=exportExcelSelectedLessons"+simplified+"&organisationID=${organisationID}" + lessonIds; blockExportButton(areaToBlock, exportExcelUrl, languageLabelWait); } @@ -421,7 +423,7 @@ }); function openSelectLessonsArea() { - $("#select-lessons-area").toggle("slow"); + $("#select-lessons-area").toggle(); return false; } @@ -458,18 +460,18 @@ -
-
- +
+
+
" id="export-selected-lessons-button" />
- +
Index: lams_gradebook/web/includes/css/gradebook.css =================================================================== diff -u -rcf49a1fdafe6a2eee9f39ea840b5d6325fa1d82d -r723b5bcbdf0db6b9a4fbeacdc55f7336992ac935 --- lams_gradebook/web/includes/css/gradebook.css (.../gradebook.css) (revision cf49a1fdafe6a2eee9f39ea840b5d6325fa1d82d) +++ lams_gradebook/web/includes/css/gradebook.css (.../gradebook.css) (revision 723b5bcbdf0db6b9a4fbeacdc55f7336992ac935) @@ -3,12 +3,12 @@ } #export-selected-lessons-button { - margin-left: 295px; margin-bottom: 10px; } #gbox_lessons-jqgrid { - margin: 10px 5px; + margin-left: auto; + margin-right: auto; } .ui-widget-content {