few changes to emailer

This commit is contained in:
Sanj 2012-01-16 02:21:31 +05:30
parent 6b9af9e0e7
commit dbe7ddb299
3 changed files with 54 additions and 12 deletions

View File

@ -524,3 +524,29 @@ jQuery.fn.hasAttr = function(name) {
return this.attr(name) !== undefined; return this.attr(name) !== undefined;
}; };
//from: http://rosskendall.com/blog/web/javascript-function-to-check-an-email-address-conforms-to-rfc822
function isRFC822ValidEmail(sEmail) {
var sQtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
var sDtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
var sAtom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
var sQuotedPair = '\\x5c[\\x00-\\x7f]';
var sDomainLiteral = '\\x5b(' + sDtext + '|' + sQuotedPair + ')*\\x5d';
var sQuotedString = '\\x22(' + sQtext + '|' + sQuotedPair + ')*\\x22';
var sDomain_ref = sAtom;
var sSubDomain = '(' + sDomain_ref + '|' + sDomainLiteral + ')';
var sWord = '(' + sAtom + '|' + sQuotedString + ')';
var sDomain = sSubDomain + '(\\x2e' + sSubDomain + ')*';
var sLocalPart = sWord + '(\\x2e' + sWord + ')*';
var sAddrSpec = sLocalPart + '\\x40' + sDomain; // complete RFC822 email address spec
var sValidEmail = '^' + sAddrSpec + '$'; // as whole string
var reValidEmail = new RegExp(sValidEmail);
if (reValidEmail.test(sEmail)) {
return true;
}
return false;
}

View File

@ -22,13 +22,13 @@
<tr> <tr>
<td style="width:290px; padding:0px 10px 0px 10px;border-bottom:2px solid #f8c92d;"> <td style="width:290px; padding:0px 10px 0px 10px;border-bottom:2px solid #f8c92d;">
<p style="font-family:'Century Gothic', Arial, Helvetica, sans-serif; font-size:12px; color:#888; padding-bottom:2px; margin-left:8px;">Issue No: {{ issue.issue_no }} <span>&nbsp;&nbsp; {{ issue.date|date:"d-M-Y" }}</span></p> <p style="font-family:'Century Gothic', Arial, Helvetica, sans-serif; font-size:12px; color:#888; padding-bottom:2px; margin-left:8px;">Issue No: {{ issue.issue_no }} <span>&nbsp;&nbsp; {{ issue.date|date:"F j, Y" }}</span></p>
</td> </td>
<td style="width:290px; padding:0px 0px 0px 10px; font-size:12px; font-family:'Century Gothic', Arial, Helvetica, sans-serif;border-bottom:2px solid #f8c92d; margin-left:8px"> <td style="width:290px; padding:0px 0px 0px 10px; font-size:12px; font-family:'Century Gothic', Arial, Helvetica, sans-serif;border-bottom:2px solid #f8c92d; margin-left:8px">
<p style="text-align:right; margin-bottom:4px;"><a href="http://theatreforum.in/{{ issue.get_absolute_url }}" style="color:#ffcc00; text-decoration:none;">SUBSCRIBE |</a> <a href="http://theatreforum.in/{{ issue.get_absolute_url }}" style="color:#ffcc00; text-decoration:none;">FEEDBACK </a></p> <p style="text-align:right; margin-bottom:4px;"><a href="http://theatreforum.in{{ issue.get_absolute_url }}" style="color:#ffcc00; text-decoration:none;">SUBSCRIBE |</a> <a href="http://theatreforum.in{{ issue.get_absolute_url }}" style="color:#ffcc00; text-decoration:none;">FEEDBACK </a></p>
</td> </td>
</tr> </tr>
@ -40,15 +40,16 @@
<td style="width:250px; background-color:#f7bd00; color:#fff; padding:10px;"> <td style="width:250px; background-color:#f7bd00; color:#fff; padding:10px;">
<p style="font-size:16px; text-align:center; text-transform:uppercase; font-family:'Century Gothic', Arial, Helvetica, sans-serif;">Web Links</p> <p style="font-size:16px; text-align:center; text-transform:uppercase; font-family:'Century Gothic', Arial, Helvetica, sans-serif;">Web Links</p>
{% for weblink in weblinks %}
<p style="font-size:13px; font-family:Arial, Helvetica, sans-serif; padding-left:6px; padding-right:6px;">Some weblink</p> <p style="font-size:13px; font-family:Arial, Helvetica, sans-serif; padding-left:6px; padding-right:6px;">{{ weblink.title|truncatewords:6 }}</p>
<p style="font-size:13px; font-family:Arial, Helvetica, sans-serif; padding-left:6px; padding-right:6px;">Some other weblink</p> {% endfor %}
<p style="text-align:right;"><a href="#weblinks" style="color:#fff; text-decoration:none; font-size:12px;">More &#187;</a></p> <p style="text-align:right;"><a href="#weblinks" style="color:#fff; text-decoration:none; font-size:12px;">More &#187;</a></p>
</td> </td>
<td style="width:250px; background-color:#f7bd00; color:#fff; padding:10px;"> <td style="width:250px; background-color:#f7bd00; color:#fff; padding:10px;">
<p style="font-size:16px; text-align:center; text-transform:uppercase; font-family:'Century Gothic', Arial, Helvetica, sans-serif;">Bulletin Board</p> <p style="font-size:16px; text-align:center; text-transform:uppercase; font-family:'Century Gothic', Arial, Helvetica, sans-serif;">Bulletin Board</p>
<p style="font-size:13px; font-family:Arial, Helvetica, sans-serif; padding-left:6px; padding-right:6px;">Some bb item</p> {% for bbitem in bbitems %}
<p style="font-size:13px; font-family:Arial, Helvetica, sans-serif; padding-left:6px; padding-right:6px;">Some other bb item</p> <p style="font-size:13px; font-family:Arial, Helvetica, sans-serif; padding-left:6px; padding-right:6px;">{{ bbitem.title|truncatewords:6 }}</p>
{% endfor %}
<p style="text-align:right;"><a href="#bbitems" style="color:#fff; text-decoration:none; font-size:12px;">More &#187;</a></p> <p style="text-align:right;"><a href="#bbitems" style="color:#fff; text-decoration:none; font-size:12px;">More &#187;</a></p>
</td> </td>
@ -71,7 +72,7 @@
{% for article in articles %} {% for article in articles %}
<table width="600" border="0" cellspacing="6" cellpadding="1"> <table width="600" border="0" cellspacing="6" cellpadding="1">
<tr> <tr>
<td style="width:350px;"><p style="font-size:24px; font-weight:normal; color:#ffcc00; text-transform:uppercase; font-family:'Century Gothic', Arial, Helvetica, sans-serif; margin-left:10px;">{{ article.title }}</p></td> <td style="width:350px;"><p style="font-size:24px; font-weight:normal; color:#ffcc00; text-transform:uppercase; font-family:'Century Gothic', Arial, Helvetica, sans-serif; margin-left:10px;margin-top:0px;margin-bottom:0px;">{{ article.title }}</p></td>
<td style="width:250px;"><p style="font-size:12px; font-weight:normal; color:#888; font-family:'Century Gothic', Arial, Helvetica, sans-serif; text-align:right;">by: {{ article.author }}</p></td> <td style="width:250px;"><p style="font-size:12px; font-weight:normal; color:#888; font-family:'Century Gothic', Arial, Helvetica, sans-serif; text-align:right;">by: {{ article.author }}</p></td>
</tr> </tr>
</table> </table>
@ -81,7 +82,7 @@
<td style="width:600px;"> <td style="width:600px;">
{% if article.main_image %} {% if article.main_image %}
{% thumbnail article.main_image "570" as im %} {% thumbnail article.main_image "x380" as im %}
<img style="display:block;margin:0 auto;border:1px solid #f7c00c;" src="{{ im.url }}" /> <img style="display:block;margin:0 auto;border:1px solid #f7c00c;" src="{{ im.url }}" />
{% endthumbnail %} {% endthumbnail %}
{% endif %} {% endif %}
@ -102,7 +103,7 @@
<td style="width:580px; margin:10px 0 10px 0;"> <td style="width:580px; margin:10px 0 10px 0;">
<p style="padding:8px; margin-left:10px; background-color:#f7bd00; color:#fff; font-size:24px; font-family:'Century Gothic', Arial, Helvetica, sans-serif;"><a name="weblinks"></a>WEB LINKS</p> <p style="padding:8px; margin-left:10px; background-color:#f7bd00; color:#fff; font-size:24px; font-family:'Century Gothic', Arial, Helvetica, sans-serif;"><a name="weblinks"></a>WEB LINKS</p>
{% for weblink in weblinks %} {% for weblink in weblinks %}
<h2 style="padding-left:10px;"><a href="{{weblink.url}}" target="_blank" style="color:#ff8400;text-decoration:none;font-size:16px">{{ weblink.title }}</a></h2> <h2 style="padding-left:10px;margin-top:0px;margin-bottom:0px;"><a href="{{weblink.url}}" target="_blank" style="color:#ff8400;text-decoration:none;font-size:16px">{{ weblink.title }}</a></h2>
<div style="color:#888; font-family:Arial, Helvetica, sans-serif; font-size:12px; padding-left: 10px;">{{ weblink.text|markdown }}</div> <div style="color:#888; font-family:Arial, Helvetica, sans-serif; font-size:12px; padding-left: 10px;">{{ weblink.text|markdown }}</div>
{% endfor %} {% endfor %}
@ -115,7 +116,7 @@
<td style="width:580px; margin:10px 0 10px 0;"> <td style="width:580px; margin:10px 0 10px 0;">
<p style="padding:8px; margin-left:10px; margin-top: 4px;background-color:#f7bd00; color:#fff; font-size:24px; font-family:'Century Gothic', Arial, Helvetica, sans-serif;"><a name="bbitems"></a>BULLETIN BOARD</p> <p style="padding:8px; margin-left:10px; margin-top: 4px;background-color:#f7bd00; color:#fff; font-size:24px; font-family:'Century Gothic', Arial, Helvetica, sans-serif;"><a name="bbitems"></a>BULLETIN BOARD</p>
{% for bbitem in bbitems %} {% for bbitem in bbitems %}
<h2 style="font-family:Arial;font-size:16px;padding-left:10px;color:#888;">{{ bbitem.title }}</h2> <h2 style="font-family:Arial;font-size:16px;padding-left:10px;color:#888;margin-top:4px;margin-bottom:4px;">{{ bbitem.title }}</h2>
<div style="color:#888; font-family:Arial, Helvetica, sans-serif; font-size:12px; padding-left: 10px;">{{ bbitem.text|markdown }}</div> <div style="color:#888; font-family:Arial, Helvetica, sans-serif; font-size:12px; padding-left: 10px;">{{ bbitem.text|markdown }}</div>
{% endfor %} {% endfor %}

View File

@ -10,7 +10,7 @@
<img src="/static/images/emailer/logoItfSmall.jpg" width="125" height="34" alt="logo-itf-small" id="logoItfSmall" /><!-- LOGO ITF SMALL --> <img src="/static/images/emailer/logoItfSmall.jpg" width="125" height="34" alt="logo-itf-small" id="logoItfSmall" /><!-- LOGO ITF SMALL -->
<div class="clear"></div> <div class="clear"></div>
<p id="issueNo">Issue No: {{ issue.issue_no }}<span id="issueDate">{{ issue.date|date:"d-M-Y" }}</span></p><!-- ISSUE NO CLOSING --> <p id="issueNo">Issue No: {{ issue.issue_no }}<span id="issueDate">{{ issue.date|date:"F j, Y" }}</span></p><!-- ISSUE NO CLOSING -->
<!--<p id="emailerDescription">A fortnightly theatre e-journal from the India Theatre Forum<br>Co-Editors: Vikram Iyengar, Joyoti Roy</p>EMAILER DESCRIPTION CLOSING --> <!--<p id="emailerDescription">A fortnightly theatre e-journal from the India Theatre Forum<br>Co-Editors: Vikram Iyengar, Joyoti Roy</p>EMAILER DESCRIPTION CLOSING -->
@ -159,4 +159,19 @@ association of theatre people coming together in the larger interests of theatre
</div> </div>
<script type="text/javascript">
$('#subscribeBtn').click(function() {
$(this).attr("disabled", "disabled");
var email = $.trim($('#subscribeInput').val());
if (!isRFC822ValidEmail(email)) {
alert("please enter a valid email address");
} else {
$.post("/erang/subscribe/", {
'email': email
}, function(response) {
$('#subscribeForm').text(email + " has been subscribed. Thanks.");
});
}
});
</script>