Example #1
0
    def send_ajax(self, request, id):
        """ Send the specified document to the user's email address (AJAX version). """

        document = self.get_document(id)

        form = self._set_user_email_address(request)
        email = self._get_user_email_address(request)
        if not email and not form:
            form = EmailForm()

        if form:
            content = '<form class="ajax_update_email" action="%s" method="post">' % reverse(
                '%s_document_send' % self.name,
                args=[getattr(document, self.url_identifier_field)])
            content += '%s<input type="submit" value="Send"/></form>' % form[
                'email']
            return HttpResponse(content)

        #print "Sending email to %s" % email
        email_document(document,
                       to=[email],
                       subject='Document: %s' % document.title)

        # Send a signal to let everyone know about this document interaction
        document_interaction.send(sender=self,
                                  document=document,
                                  mode="sent",
                                  request=request,
                                  recipient=email)

        return HttpResponse('Email sent to %s' % email)
Example #2
0
    def view(self, request, id, tribe_slug):

        document = self.get_document(id, tribe_slug)

        # Send a signal to let everyone know about this document interaction
        document_interaction.send(sender=self, document=document, mode="viewed", request=request)

        return DocumentViewResponse(document)
Example #3
0
    def view(self, request, id):

        document = self.get_document(id)

        # Send a signal to let everyone know about this document interaction
        document_interaction.send(sender=self,
                                  document=document,
                                  mode="viewed",
                                  request=request)

        return DocumentViewResponse(document)
Example #4
0
 def send(self, request, id, tribe_slug):
     """ Send the specified document to the user's email address (HTML version). """
     tribe = get_object_or_404(Tribe, slug=tribe_slug)
     document = self.get_document(id, tribe_slug)
     
     form     = self._set_user_email_address(request)
     email    = self._get_user_email_address(request)
     if form or not email:
         return render_to_response('django_dms/send.html', locals(), context_instance=RequestContext(request))
 
     # NB: Temporarily disabling actual email sending for development
     #email_document(document, to=[email], subject='Document: %s' % document.title)
     print "Sending email to %s" % email 
 
     # Send a signal to let everyone know about this document interaction
     document_interaction.send(sender=self, document=document, mode="sent", request=request, recipient=email)
 
     return HttpResponseRedirect(reverse('%s_document_list' % self.name, args=(tribe_slug, ) ))
Example #5
0
    def send_ajax(self, request, id, tribe_slug):
        """ Send the specified document to the user's email address (AJAX version). """

        document = self.get_document(id, tribe_slug)

        form     = self._set_user_email_address(request)
        email    = self._get_user_email_address(request)
        if not email and not form:
            form = EmailForm()
    
        if form:
            content = '<form class="ajax_update_email" action="%s" method="post">' % reverse('%s_document_send' % self.name, args=[getattr(document, self.url_identifier_field)])
            content += '%s<input type="submit" value="Send"/></form>' % form['email']
            return HttpResponse(content)
    
        print "Sending email to %s" % email
        #email_document(document, to=[email], subject='Document: %s' % document.title)

        # Send a signal to let everyone know about this document interaction
        document_interaction.send(sender=self, document=document, mode="sent", request=request, recipient=email)
    
        return HttpResponse('Email sent to %s' % email)
Example #6
0
    def send(self, request, id):
        """ Send the specified document to the user's email address (HTML version). """
        document = self.get_document(id)

        form = self._set_user_email_address(request)
        email = self._get_user_email_address(request)
        if form or not email:
            return render_to_response('django_dms/send.html', locals())

        # NB: Temporarily disabling actual email sending for development
        email_document(document,
                       to=[email],
                       subject='Document: %s' % document.title)
        #print "Sending email to %s" % email

        # Send a signal to let everyone know about this document interaction
        document_interaction.send(sender=self,
                                  document=document,
                                  mode="sent",
                                  request=request,
                                  recipient=email)

        return HttpResponseRedirect(reverse('%s_document_list' % self.name))