New wiki pages and edits *in the backend system* will generate an
email to the conference contact address (but not to regular attendees,
subscribed or not).
+
+## Sending email
+
+Using the send email functionality, it is possible to send an email to
+attendees that have explicit permissions on a wiki page. This is a
+one-time email that goes to the attendees email and is optionally
+stored on their registration page.
+
+It is not possible to send an email to a public wiki page - for those,
+using a regular attendee email is better. The same applies to wiki
+pages where the permissions are set by registration type. If a page
+has both registration type and direct attendee permissions, email will
+be sent only to the direct attendees.
from postgresqleu.confreg.util import get_authenticated_conference, get_conference_or_404
from postgresqleu.confreg.util import reglog
from postgresqleu.confreg.util import send_conference_notification_template
+from postgresqleu.confreg.mail import attendee_email_form
from postgresqleu.util.db import exec_to_scalar, exec_to_list
from postgresqleu.util.request import get_int_or_error
})
+@transaction.atomic
+def admin_sendmail(request, urlname, pageid):
+ conference = get_authenticated_conference(request, urlname)
+
+ page = get_object_or_404(Wikipage, conference=conference, pk=pageid)
+
+ if 'idlist' in request.GET or 'idlist' in request.POST:
+ return attendee_email_form(
+ request,
+ conference,
+ breadcrumbs=[
+ ('../../', 'Wiki pages'),
+ ('../', page.title),
+ ],
+ )
+
+ if page.publicview:
+ messages.error(request, "Cannot send wiki page email to public pages. Use regular attendee emails instead.")
+ return HttpResponseRedirect("../")
+
+ if page.viewer_regtype.exists():
+ if page.viewer_attendee.exists():
+ messages.warning(request, "Will not send wiki page emails based on regtype, only direct attendees. Use regular attendee emails to send to regtypes!")
+ else:
+ messages.error(request, "Cannot send wiki page email to pages with regtype permissions. Use regular attendee emails instead.")
+ return HttpResponseRedirect("../")
+
+ return HttpResponseRedirect("?idlist={}".format(",".join([str(r.id) for r in page.viewer_attendee.all()])))
+
+
@login_required
@transaction.atomic
def signup(request, urlname, signupid):
optionstrings = signup.options.split(',')
if 'idlist' in request.GET or 'idlist' in request.POST:
- from postgresqleu.confreg.mail import attendee_email_form
-
def _get_query(idlist):
return _get_signup_email_query(signup, idlist, optionstrings)
url(r'^events/admin/(\w+)/waitlist/sendmail/$', postgresqleu.confreg.views.admin_waitlist_sendmail),
url(r'^events/admin/(\w+)/wiki/$', postgresqleu.confwiki.views.admin),
url(r'^events/admin/(\w+)/wiki/(new|\d+)/$', postgresqleu.confwiki.views.admin_edit_page),
+ url(r'^events/admin/(\w+)/wiki/(\d+)/sendmail/$', postgresqleu.confwiki.views.admin_sendmail),
url(r'^events/admin/(\w+)/signups/$', postgresqleu.confwiki.views.signup_admin),
url(r'^events/admin/(\w+)/signups/(new|\d+)/$', postgresqleu.confwiki.views.signup_admin_edit),
url(r'^events/admin/(\w+)/signups/(\d+)/sendmail/$', postgresqleu.confwiki.views.signup_admin_sendmail),