def _sendMessage(self, action, data): imsmessage = IIMSMessage(self.context) message = imsmessage.sendMessage(data['subject'], data['message'], data['receiver']) if message: IStatusMessage(self.request).addStatusMessage(_("Your message has been sent successfully"), type='info') return self.request.response.redirect(message.absolute_url()) else: IStatusMessage(self.request).addStatusMessage(_("Sending your message failed"), type='error') return self.request.response.redirect(self.context.absolute_url())
def _sendMessage(self, action, data): imsmessage = IIMSMessage(self.context) message = imsmessage.sendMessage(data['subject'], data['message'], data['receiver']) if message: IStatusMessage(self.request).addStatusMessage(_(u"Your message has been sent successfully"), type='info') return self.request.response.redirect(message.absolute_url()) else: IStatusMessage(self.request).addStatusMessage(_(u"Sending your message failed"), type='error') return self.request.response.redirect(self.context.absolute_url())
def createMessageFolders(event): """ creates message-folders for the user """ try: inst = getToolByName(event.principal, 'portal_quickinstaller') except: return if inst.isProductInstalled('IMS'): userid = event.principal.getId() ims = IIMSMessage(event.principal) ims._getMessageFolder(userid, 'received', 'ReceivedMessageFolder') ims._getMessageFolder(userid, 'sent', 'SentMessageFolder')
def forwardMessage(self, title, message, receiver): """ Forward this message to somebody """ adapter = IIMSMessage(self) return adapter.forwardMessage(self, title, message, receiver)
def replyToMessage(self, title, message): """ Reply to this message """ adapter = IIMSMessage(self) return adapter.replyToMessage(self, title, message)