def getVars(self): vars = wcomponents.WTemplated.getVars(self) csbm = self._conf.getCSBookingManager() pluginNames = csbm.getEventDisplayPlugins() bookings = csbm.getBookingList(filterByType = pluginNames, notify = True, onlyPublic = True) bookings.sort(key = lambda b: b.getStartDate() or minDatetime()) ongoingBookings = [] scheduledBookings = {} #date, list of bookings for b in bookings: if b.isHappeningNow(): ongoingBookings.append(b) if b.getStartDate() and b.getAdjustedStartDate('UTC') > nowutc(): scheduledBookings.setdefault(b.getAdjustedStartDate(self._tz).date(), []).append(b) keys = scheduledBookings.keys() keys.sort() scheduledBookings = [(date, scheduledBookings[date]) for date in keys] vars["OngoingBookings"] = ongoingBookings vars["ScheduledBookings"] = scheduledBookings vars["all_bookings"] = fossilize(bookings) vars["Timezone"] = self._tz vars["conf"] = self._conf return vars
def getVars(self): wvars = WConfDisplayBodyBase.getVars(self) csbm = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId()) pluginNames = csbm.getEventDisplayPlugins() bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True) bookings.sort(key=lambda b: b.getStartDate() or minDatetime()) timeless_bookings = [] ongoingBookings = [] scheduledBookings = {} #date, list of bookings for b in bookings: if b.canBeDisplayed(): if not b.hasStartDate(): timeless_bookings.append(b) else: if b.isHappeningNow(): ongoingBookings.append(b) elif b.getStartDate() and b.getAdjustedStartDate('UTC') > nowutc(): scheduledBookings.setdefault(b.getAdjustedStartDate(self._tz).date(), []).append(b) keys = scheduledBookings.keys() keys.sort() scheduledBookings = [(date, scheduledBookings[date]) for date in keys] wvars["body_title"] = self._getTitle() wvars["OngoingBookings"] = ongoingBookings wvars["ScheduledBookings"] = scheduledBookings wvars["timeless_bookings"] = timeless_bookings wvars["all_bookings"] = fossilize(bookings) wvars["Timezone"] = self._tz wvars["conf"] = self._conf return wvars
def getCollaborationParams(cls, conf): params = {} csbm = Catalog.getIdx("cs_bookingmanager_conference").get(conf.getId()) pluginNames = csbm.getEventDisplayPlugins() bookingData = {} for pluginName in pluginNames: bookingData[pluginName] = CollaborationTools.getServiceInformation(pluginName) bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True) bookings.sort(key=lambda b: b.getStartDate() or minDatetime()) params['bookings'] = bookings params['bookingData'] = bookingData return params
def getCollaborationParams(cls, conf): params = {} csbm = conf.getCSBookingManager() pluginNames = csbm.getEventDisplayPlugins() bookingData = {} for pluginName in pluginNames: bookingData[pluginName] = CollaborationTools.getServiceInformation(pluginName) bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True) bookings.sort(key=lambda b: b.getStartDate() or minDatetime()) params["bookings"] = bookings params["bookingData"] = bookingData return params
def getCollaborationParams(cls, conf): params = {} csbm = Catalog.getIdx("cs_bookingmanager_conference").get(conf.getId()) pluginNames = csbm.getEventDisplayPlugins() bookingData = {} for pluginName in pluginNames: bookingData[pluginName] = CollaborationTools.getServiceInformation( pluginName) bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True) bookings.sort(key=lambda b: b.getStartDate() or minDatetime()) params['bookings'] = bookings params['bookingData'] = bookingData return params
def collaborationToXML(cls, out, conf, tz): """ Generates the xml corresponding to the collaboration plugin system for an event. """ #collaboration XML out.openTag("collaboration") csbm = conf.getCSBookingManager() out.writeComment("Needed for timezone awareness") out.writeTag("todayReference", getAdjustedDate(nowutc(), None, tz).strftime("%Y-%m-%d")) out.writeTag("tomorrowReference", getAdjustedDate(nowutc() + timedelta(days = 1), None, tz).strftime("%Y-%m-%d")) pluginNames = csbm.getEventDisplayPlugins() bookingXmlGenerators = {} for pluginName in pluginNames: xmlGenerator = CollaborationTools.getXMLGenerator(pluginName) bookingXmlGenerators[pluginName] = xmlGenerator bookings = csbm.getBookingList(filterByType = pluginNames, notify = True, onlyPublic = True) bookings.sort(key = lambda b: b.getStartDate() or minDatetime()) ongoingBookings = [] scheduledBookings = [] for b in bookings: if b.canBeStarted(): ongoingBookings.append(b) if b.hasStartDate() and b.getAdjustedStartDate('UTC') > nowutc(): scheduledBookings.append(b) for b in ongoingBookings : bookingType = b.getType() out.openTag("booking") out.writeTag("id", b.getId()) out.writeTag("kind", "ongoing") out.writeTag("type", bookingType) out.writeTag("typeDisplayName", bookingXmlGenerators[bookingType].getDisplayName()) if b.hasStartDate(): out.writeTag("startDate", b.getAdjustedStartDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) out.writeTag("endDate",b.getAdjustedEndDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) bookingXmlGenerators[bookingType].getCustomBookingXML(b, tz, out) out.closeTag("booking") for b in scheduledBookings : bookingType = b.getType() out.openTag("booking") out.writeTag("id", b.getId()) out.writeTag("title", b._getTitle()) out.writeTag("kind", "scheduled") out.writeTag("type", bookingType) out.writeTag("typeDisplayName", bookingXmlGenerators[bookingType].getDisplayName()) if b.hasStartDate(): out.writeTag("startDate", b.getAdjustedStartDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) out.writeTag("endDate",b.getAdjustedEndDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) bookingXmlGenerators[bookingType].getCustomBookingXML(b, tz, out) out.closeTag("booking") out.closeTag("collaboration")
def collaborationToXML(cls, out, conf, tz): """ Generates the xml corresponding to the collaboration plugin system for an event. """ #collaboration XML out.openTag("collaboration") csbm = Catalog.getIdx("cs_bookingmanager_conference").get(conf.getId()) out.writeComment("Needed for timezone awareness") out.writeTag("todayReference", getAdjustedDate(nowutc(), None, tz).strftime("%Y-%m-%d")) out.writeTag( "tomorrowReference", getAdjustedDate(nowutc() + timedelta(days=1), None, tz).strftime("%Y-%m-%d")) pluginNames = csbm.getEventDisplayPlugins() bookingXmlGenerators = {} for pluginName in pluginNames: xmlGenerator = CollaborationTools.getXMLGenerator(pluginName) bookingXmlGenerators[pluginName] = xmlGenerator bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True) bookings.sort(key=lambda b: b.getStartDate() or minDatetime()) ongoingBookings = [] scheduledBookings = [] for b in bookings: if b.canBeStarted(): ongoingBookings.append(b) if b.hasStartDate() and b.getAdjustedStartDate('UTC') > nowutc(): scheduledBookings.append(b) for b in ongoingBookings: bookingType = b.getType() out.openTag("booking") out.writeTag("id", b.getId()) out.writeTag("kind", "ongoing") out.writeTag("type", bookingType) out.writeTag("typeDisplayName", bookingXmlGenerators[bookingType].getDisplayName()) if b.hasStartDate(): out.writeTag( "startDate", b.getAdjustedStartDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) out.writeTag( "endDate", b.getAdjustedEndDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) bookingXmlGenerators[bookingType].getCustomBookingXML(b, tz, out) out.closeTag("booking") for b in scheduledBookings: bookingType = b.getType() out.openTag("booking") out.writeTag("id", b.getId()) out.writeTag("title", b._getTitle()) out.writeTag("kind", "scheduled") out.writeTag("type", bookingType) out.writeTag("typeDisplayName", bookingXmlGenerators[bookingType].getDisplayName()) if b.hasStartDate(): out.writeTag( "startDate", b.getAdjustedStartDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) out.writeTag( "endDate", b.getAdjustedEndDate(tz).strftime("%Y-%m-%dT%H:%M:%S")) bookingXmlGenerators[bookingType].getCustomBookingXML(b, tz, out) out.closeTag("booking") out.closeTag("collaboration")