def saveChanges(self):
        context = aq_inner(self.context)
        request = self.request
        form = request.form

        # edit title

        title = "title" in form and form.pop("title", False)
        if title:
            context.setTitle(title)
        finish = form.pop("finish", False)
        extend = form.pop("extend", False)

        # other form elements are dates
        propositions_by_dates = {}
        for date, propositions in request.form.items():
            propositions_by_dates[date] = [p for p in propositions if p]
            if not propositions_by_dates[date]:
                propositions_by_dates[date] = [""]

        # save in the session only
        RDV_RendezVousUtility.setPropositionsByDates(self, propositions_by_dates)
        if finish:
            # save to the filesystem
            context.setPropositionsByDates(propositions_by_dates)
            request.response.redirect(self.getNextURL())
        elif extend:
            self.incNbColumns()
            request.response.redirect(context.absolute_url() + "/edit_dates")
 def getNbColumns(self):
     """Return the number of columns
     """
     propositionsbydates = RDV_RendezVousUtility.getPropositionsByDates(self)
     try:
         uid = self.context.aq_inner.UID()
         nb = self.request.SESSION["rendezvous"]["nb_columns"][uid]
     except KeyError:
         nb = self.NB_COLUMNS
     for propositions in propositionsbydates.values():
         nb = max(len(propositions), nb)
     return nb
 def toggleSelectedDate(self, selected_date):
     return RDV_RendezVousUtility.toggleSelectedDate(self, selected_date)
 def getSelectedDates(self):
     return RDV_RendezVousUtility.getSelectedDates(self)
 def getPropositionsByOrderedDates(self):
     return RDV_RendezVousUtility.getPropositionsByOrderedDates(self)