def _doApply(self): """ """ if not self.mayChangeAttendees(): raise Unauthorized items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber(relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.meeting) # apply removal of redefined attendee position for item_to_update in items_to_update: item_to_update_uid = item_to_update.UID() item_attendees_positions = self.meeting.item_attendees_positions.get( item_to_update_uid, {}) if self.person_uid in item_attendees_positions: del item_attendees_positions[self.person_uid] if not item_attendees_positions: del self.meeting.item_attendees_positions[item_to_update_uid] notifyModifiedAndReindex(item_to_update) first_item_number = items_to_update[0].getItemNumber(for_display=True) last_item_number = items_to_update[-1].getItemNumber(for_display=True) extras = 'item={0} hp={1} from_item_number={2} until_item_number={3}'.format( repr(self.context), self.person_uid, first_item_number, last_item_number) fplog('remove_redefined_item_attendee_position', extras=extras) api.portal.show_message(_("Redefined attendee position was removed."), request=self.request) self._finished = True
def _doApplyItemSignatures(self): """ The method actually do the job, set the itemSignatures on self.context and following items if defined """ self._check_auth() # only apply if different from meeting item_signatures_def = item_signatures_default() if self.item_signatures != item_signatures_def: items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber( relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.context.getMeeting()) for itemToUpdate in items_to_update: itemToUpdate.setItemSignatures(self.item_signatures) first_item_number = items_to_update[0].getItemNumber( for_display=True) last_item_number = items_to_update[-1].getItemNumber( for_display=True) extras = 'item={0} from_item_number={1} until_item_number={2}'.format( repr(self.context), first_item_number, last_item_number) fplog('manage_item_signatures', extras=extras) # invalidate assembly async load on item invalidate_cachekey_volatile_for( 'Products.PloneMeeting.browser.async.AsyncLoadItemAssemblyAndSignaturesRawFields', get_again=True) api.portal.show_message(_("Item signatures have been updated."), request=self.request) self._finished = True
def _doApply(self): """ """ if not self.mayChangeAttendees(): raise Unauthorized items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber(relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.meeting) # apply redefined position for item_to_update in items_to_update: item_to_update_uid = item_to_update.UID() updated = set_meeting_item_attendee_position( self.meeting, item_to_update_uid, self.person_uid, self.position_type) if updated: notifyModifiedAndReindex(item_to_update) first_item_number = items_to_update[0].getItemNumber(for_display=True) last_item_number = items_to_update[-1].getItemNumber(for_display=True) extras = 'item={0} hp={1} from_item_number={2} until_item_number={3}'.format( repr(self.context), self.person_uid, first_item_number, last_item_number) fplog('redefine_item_attendee_position', extras=extras) api.portal.show_message(_("Attendee position has been redefined."), request=self.request) self._finished = True
def _doApply(self): """ """ if not self.mayChangeAttendees(): raise Unauthorized # check where is person_uid, item_absents or item_excused meeting_absent_attr = self._get_meeting_absent_attr() items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber(relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.meeting) for item_to_update in items_to_update: item_to_update_uid = item_to_update.UID() item_absents = meeting_absent_attr.get(item_to_update_uid, []) if self.person_uid in item_absents: item_absents.remove(self.person_uid) meeting_absent_attr[item_to_update_uid] = item_absents notifyModifiedAndReindex(item_to_update) first_item_number = items_to_update[0].getItemNumber(for_display=True) last_item_number = items_to_update[-1].getItemNumber(for_display=True) extras = 'item={0} hp={1} from_item_number={2} until_item_number={3}'.format( repr(self.context), self.person_uid, first_item_number, last_item_number) fplog('welcome_item_attendee', extras=extras) api.portal.show_message(self.attendee_welcome_msg, request=self.request) self._finished = True
def _doApply(self): """ """ if not self.mayChangeAttendees(): raise Unauthorized items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber(relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.meeting) # return a portal_message if trying to byebye an attendee that is # a signatory redefined on the item # user will first have to select another signatory on meeting or item # return a portal_message if trying to set absent and item that is # already excused (and the other way round) error = self._mayByeByeAttendeePrecondition(items_to_update) if error: self._finished = True return # apply item_absents/item_excused meeting_not_present_attr = getattr( self.meeting, self.NOT_PRESENT_MAPPING[self.not_present_type]) for item_to_update in items_to_update: item_to_update_uid = item_to_update.UID() item_not_present = meeting_not_present_attr.get( item_to_update_uid, []) if self.person_uid not in item_not_present: item_not_present.append(self.person_uid) meeting_not_present_attr[item_to_update_uid] = item_not_present notifyModifiedAndReindex(item_to_update) first_item_number = items_to_update[0].getItemNumber(for_display=True) last_item_number = items_to_update[-1].getItemNumber(for_display=True) extras = 'item={0} hp={1} not_present_type={2} from_item_number={3} until_item_number={4}'.format( repr(self.context), self.person_uid, self.not_present_type, first_item_number, last_item_number) fplog('byebye_item_attendee', extras=extras) api.portal.show_message(_("Attendee has been set ${not_present_type}.", mapping={ 'not_present_type': _('item_not_present_type_{0}'.format( self.not_present_type)) }), request=self.request) self._finished = True
def _doApply(self): """ """ if not self.mayChangeAttendees(): raise Unauthorized items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber(relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.meeting) # apply signatory for item_to_update in items_to_update: item_to_update_uid = item_to_update.UID() item_signatories = self.meeting.item_signatories.get( item_to_update_uid, {}) signature_number = [ k for k, v in item_signatories.items() if v['hp_uid'] == self.person_uid ] if signature_number: del item_signatories[signature_number[0]] # if no more redefined item signatories, # remove item UID from meeting.item_signatories if item_signatories: self.meeting.item_signatories[ item_to_update_uid] = item_signatories else: del self.meeting.item_signatories[item_to_update_uid] notifyModifiedAndReindex(item_to_update) first_item_number = items_to_update[0].getItemNumber(for_display=True) last_item_number = items_to_update[-1].getItemNumber(for_display=True) extras = 'item={0} hp={1} from_item_number={2} until_item_number={3}'.format( repr(self.context), self.person_uid, first_item_number, last_item_number) fplog('remove_redefined_item_signatory', extras=extras) api.portal.show_message( _("Attendee is no more defined as item signatory."), request=self.request) self._finished = True
def _doApply(self): """ """ if not self.mayChangeAttendees(): raise Unauthorized # prepare Meeting.itemVotes compatible data # while datagrid used in an overlay, some <NO_VALUE> # wipeout self.votes from these values self.votes = [vote for vote in self.votes if isinstance(vote, dict)] data = {} data['label'] = self.label data['linked_to_previous'] = self.linked_to_previous data['votes'] = {} for vote in self.votes: data['votes'][vote['vote_value_id']] = vote['vote_count'] items_to_update = _itemsToUpdate( from_item_number=self.context.getItemNumber(relativeTo='meeting'), until_item_number=self.apply_until_item_number, meeting=self.meeting) updated = [] not_updated = [] for item_to_update in items_to_update: # set item secret vote if is_vote_updatable_for(self.context, item_to_update): self.meeting.set_item_secret_vote(item_to_update, data, self.vote_number) updated.append(item_to_update.getItemNumber(for_display=True)) else: not_updated.append( item_to_update.getItemNumber(for_display=True)) # finish vote_values = [vote['vote_value_id'] for vote in self.votes] vote_values = "__".join(vote_values) vote_count = [str(vote['vote_count']) for vote in self.votes] vote_count = "__".join(vote_count) first_item_number = items_to_update[0].getItemNumber(for_display=True) last_item_number = items_to_update[-1].getItemNumber(for_display=True) extras = 'item={0} vote_number={1} vote_values={2} vote_count={3} ' \ 'from_item_number={4} until_item_number={5}'.format( repr(self.context), self.vote_number, vote_values, vote_count, first_item_number, last_item_number) fplog('encode_item_secret_votes', extras=extras) if len(updated) == 1: api.portal.show_message( _("Votes have been encoded for current item."), request=self.request) else: api.portal.show_message(_( "Votes have been encoded for items \"${item_numbers}\".", mapping={'item_numbers': display_item_numbers(updated)}), request=self.request) # display items that could not be updated if not_updated: api.portal.show_message(_( "error_updating_votes_for_items", mapping={'item_numbers': display_item_numbers(not_updated)}), request=self.request, type="warning") self._finished = True