Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Blackboard, Inc. All rights reserved. Enhancing the BB calendar with Microsoft Excel Batch Import and Export Peter Jacobs Catholic University Leuven.

Similar presentations


Presentation on theme: "© Blackboard, Inc. All rights reserved. Enhancing the BB calendar with Microsoft Excel Batch Import and Export Peter Jacobs Catholic University Leuven."— Presentation transcript:

1 © Blackboard, Inc. All rights reserved. Enhancing the BB calendar with Microsoft Excel Batch Import and Export Peter Jacobs Catholic University Leuven Association Belgium

2 2 Toledo project » started in september 2001 » 11 institutes for higher education » active students » active professors » different users a day » over hits a day » hosting the eloV server, used by students from 200 K-12 schools

3 3 Blackboard calendar » Basic features » Good integration with courses (access rights, UI) » Personal view (aggregation) » Real need for shared calendar » Integration with MS Outlook, other calendars? » Easy batch import and export?

4 4 Batch import/export of events » CSV: difficulties with separator, date format » MS Excel 97/2000/XP: a standard and well known format, no ambiguities No dependency on Microsoft software! e.g. Open Office

5 5 Upload file » select an Excel file: » Process with Apache commons fileupload » commons-fileupload-1.0.jar » Result is an InputStream

6 6 Apache commons fileupload 1.0 » if (FileUpload.isMultipartContent(request)) { DiskFileUpload upload = new DiskFileUpload(); // upload.setSizeThreshold(yourMaxMemorySize); upload.setSizeMax( ); // upload.setRepositoryPath(yourTempDirectory); List items = upload.parseRequest(request); Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (!item.isFormField()) { if (item.getFieldName().equals(formFieldName)) { inputStream = item.getInputStream(); …

7 7 Apache POI - HSSF » » Read and write Excel 97/2000/XP files » Workbook, sheet, colors, borders, shapes, … » Data formats!

8 8 HSSF - create Excel workbook » HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("new sheet"); HSSFRow row = sheet.createRow((short)0); » HSSFCell cell = row.createCell((short)0); cell.setCellValue(“this is a string”); row.createCell((short)1).setCellValue(1.2); » OutputStream os = response.getOutputStream(); wb.write(os); os.close();

9 9 HSSF – create date cell » HSSFCellStyle csDate = wb.createCellStyle(); HSSFDataFormat dateFormat = wb.createDataFormat(); csDate.setDataFormat( dateFormat.getFormat("m/d/yy h:mm")); » cell = row.createCell((short)0); cell.setCellStyle(csDate); cell.setCellValue(new Date());

10 10 HSSF – read workbook » POIFSFileSystem fs = new POIFSFileSystem(inputStream); HSSFWorkbook hssfworkbook = new HSSFWorkbook(fs); HSSFSheet sheet = hssfworkbook.getSheetAt(0); int rows = sheet.getPhysicalNumberOfRows(); for (int r = 0; r < rows; r++) { HSSFRow row = sheet.getRow(r); if (row != null) { int cells = row.getPhysicalNumberOfCells(); for (int c = 0; c < cells; c++) { HSSFCell cell = row.getCell((short) c); …

11 11 HSSF – read cell » if (cell != null) { Object value = null; switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_FORMULA: value = "Error: formula"; break; case HSSFCell.CELL_TYPE_NUMERIC: value = new Double(cell.getNumericCellValue()); break; case HSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break; default: } }

12 12 Blackboard – course calendar entry » CalendarEntry entry = new CalendarEntry(); entry.setType(Type.COURSE); entry.setStartDate(startDate); entry.setEndDate(endDate); entry.setTitle(title); entry.setDescription(new FormattedText( description, FormattedText.Type.DEFAULT)); entry.setCourseId(courseId); entry.setCreatorUserId(userId);

13 13 Blackboard – create or delete calendar entry » CalendarEntryDbPersister calendarPersister = CalendarEntryDbPersister.Default.getInstance(); » calendarPersister.persist(entry); » calendarPersister.deleteById(entry.getId());

14 14 Blackboard – load course calendar entries » CalendarEntryDbLoader calendarLoader = CalendarEntryDbLoader.Default.getInstance(); » BbList calendarEntries = calendarLoader.loadByCourseId(courseId, (Calendar) startDate.clone(), (Calendar) endDate.clone()); » loadByUserId(…), loadByCourseIdAndUserId(…), loadByType(…), …

15 15 Issue: time zone » Only import with implicit time zone » Create user preference? » iCalendar format has extensive capabilities for time zones and UTC

16 16 iCalendar » » Google Calendar, Apple iCal, Outlook 2007,… » BEGIN:VCALENDAR PRODID:-//Google Inc//Google Calendar //EN VERSION:2.0 X-WR-TIMEZONE:Europe/Paris … BEGIN:VEVENT DTSTART;TZID=Europe/Paris: T DTEND;TZID=Europe/Paris: T SUMMARY:Toledo presentation END:VEVENT … END:VCALENDAR

17 17 To do » Layout, navigation (breadcrumbs) » Name of calendar entry creator » Location parameter » Time zones » Recurring events, multi day events » Other import/export formats » Other types of events: institution, personal

18 18 More to do » Performance, caching iCalendar » Date boundary checking » Formatted text, HTML, … » Update calendar events (unique id)

19 19 More info » » » Mailinglists BB-OPEN_SRC BBADMIN-L BLKBRD-L


Download ppt "© Blackboard, Inc. All rights reserved. Enhancing the BB calendar with Microsoft Excel Batch Import and Export Peter Jacobs Catholic University Leuven."

Similar presentations


Ads by Google