示例#1
0
 def _dynamic_content(self):
     context = aq_inner(self.context)
     memberinfo = self.memberdata()
     data = {}
     data['title'] = context.Title()
     data['summary'] = context.Description()
     data['location'] = context.location
     data['text'] = context.text.output
     data['url'] = self._construct_webview_link()
     data['pdf'] = self.pdf_download_link(context)
     data['date'] = self.localize(datetime.now(), longformat=False)
     if IPressRelease.providedBy(context):
         if context.kicker:
             data['kicker'] = context.kicker
         else:
             data['kicker'] = ''
         if context.subtitle:
             data['subtitle'] = context.subtitle
         else:
             data['subtitle'] = ''
         if context.image:
             url = context.absolute_url()
             filename = context.image.filename
             data['file_url'] = url + '/@@download/attachment/' + filename
             data['file_name'] = filename
             data['image_tag'] = self.getImageTag(context)
             data['file_caption'] = context.imagename
         data['attachments'] = self.getAttachments()
     if IPressInvitation.providedBy(context):
         if context.schedule:
             data['schedule'] = context.schedule.output
         else:
             data['schedule'] = ''
         if context.travel:
             data['travel'] = context.travel
         else:
             data['travel'] = ''
         if context.directions:
             data['directions'] = context.directions
         else:
             data['directions'] = ''
         data['start'] = context.start.strftime("%d.%m.%Y %H:%M")
         data['end'] = context.end.strftime("%d.%m.%Y %H:%M")
         closed = context.closed
         if closed is True:
             closed_msg = translate(
                 _(u"Diese Veranstaltung kann nur auf Einladung besucht "
                   u"werden. Von einer Publikation bitten wir daher "
                   u"abzusehen."),
                 domain='pressapp.presscontent',
                 target_language='de')
             data['closed'] = closed_msg
         else:
             data['closed'] = ''
     if memberinfo:
         data['org'] = memberinfo['org']
         data['link'] = memberinfo['link']
     return data
示例#2
0
 def update(self):
     context = aq_inner(self.context)
     self.default_data = self._getPressCenterData()
     send_type = self.request.get('type', '')
     if send_type:
         self.recipients = self._getRecievers(send_type)
         self.status = self.send()
         IStatusMessage(self.request).addStatusMessage(
             _(u"Your request has been dispatched"), type='info')
         return self.request.response.redirect(
             context.absolute_url() + '/@@dispatch-success')