@@ -2,7 +2,7 @@ | |||||
{ | { | ||||
"creation": "2012-08-02 15:17:28", | "creation": "2012-08-02 15:17:28", | ||||
"docstatus": 0, | "docstatus": 0, | ||||
"modified": "2013-12-20 19:23:58", | |||||
"modified": "2014-02-12 21:11:05", | |||||
"modified_by": "Administrator", | "modified_by": "Administrator", | ||||
"owner": "Administrator" | "owner": "Administrator" | ||||
}, | }, | ||||
@@ -55,7 +55,7 @@ | |||||
{ | { | ||||
"doctype": "DocField", | "doctype": "DocField", | ||||
"fieldname": "message", | "fieldname": "message", | ||||
"fieldtype": "Text", | |||||
"fieldtype": "Long Text", | |||||
"label": "Message" | "label": "Message" | ||||
}, | }, | ||||
{ | { | ||||
@@ -78,6 +78,19 @@ body { | |||||
padding:10px 0; | padding:10px 0; | ||||
} | } | ||||
.left-padding { | |||||
padding-left: 10px; | |||||
} | |||||
.breadcrumb { | |||||
list-style: none; | |||||
} | |||||
.breadcrumb > li { | |||||
display: inline-block; | |||||
margin-left: 0px; | |||||
margin-right: 5px; | |||||
} | |||||
/* ------------------------------------- | /* ------------------------------------- | ||||
BODY | BODY | ||||
@@ -183,6 +196,19 @@ table.footer-wrap a{ | |||||
width: 100%; | width: 100%; | ||||
} | } | ||||
a.no-decoration { | |||||
text-decoration: none; | |||||
color: inherit; | |||||
} | |||||
small, .small { | |||||
font-size: 85%; | |||||
} | |||||
.text-muted { | |||||
color: #999999; | |||||
} | |||||
</style> | </style> | ||||
</head> | </head> | ||||
@@ -240,7 +266,7 @@ table.footer-wrap a{ | |||||
</div> | </div> | ||||
<div class="print-html">{{ print_html }}</div> | |||||
<div class="print-html">{{ print_html or "" }}</div> | |||||
</body> | </body> | ||||
</html> | </html> |
@@ -5,13 +5,13 @@ | |||||
data-name="{{ post.name }}" | data-name="{{ post.name }}" | ||||
data-group="{{ post.website_group }}" | data-group="{{ post.website_group }}" | ||||
itemscope itemtype="http://schema.org/Article"> | itemscope itemtype="http://schema.org/Article"> | ||||
<a class="pull-left media-link" href="{{ post_url }}"> | |||||
<a class="pull-left media-link" {% if view.name!="post" %} href="{{ post_url }}" {% endif %}> | |||||
<img class="media-object post-avatar" src="{{ post.user_image }}"> | <img class="media-object post-avatar" src="{{ post.user_image }}"> | ||||
</a> | </a> | ||||
<div class="media-body"> | <div class="media-body"> | ||||
{%- if not post.parent_post -%} | {%- if not post.parent_post -%} | ||||
<h4 class="media-heading" itemprop="headline"> | <h4 class="media-heading" itemprop="headline"> | ||||
{%- if view != "post" -%} | |||||
{%- if view.name != "post" -%} | |||||
<a class="no-decoration" | <a class="no-decoration" | ||||
href="{{ post_url }}">{{ post.title }}</a> | href="{{ post_url }}">{{ post.title }}</a> | ||||
{%- else -%} | {%- else -%} | ||||
@@ -903,9 +903,16 @@ def scrub_urls(html): | |||||
def expand_relative_urls(html): | def expand_relative_urls(html): | ||||
# expand relative urls | # expand relative urls | ||||
url = get_url() | url = get_url() | ||||
if not url.endswith("/"): url += "/" | |||||
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', | |||||
'\g<1>\g<2>{}\g<3>\g<4>'.format(url), html) | |||||
if url.endswith("/"): url = url[:-1] | |||||
def _expand_relative_urls(match): | |||||
to_expand = list(match.groups()) | |||||
if not to_expand[2].startswith("/"): | |||||
to_expand[2] = "/" + to_expand[2] | |||||
to_expand.insert(2, url) | |||||
return "".join(to_expand) | |||||
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)', _expand_relative_urls, html) | |||||
def quote_urls(html): | def quote_urls(html): | ||||
def _quote_url(match): | def _quote_url(match): | ||||
@@ -47,7 +47,7 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email', | |||||
"type": doctype, | "type": doctype, | ||||
"email_field": email_field | "email_field": email_field | ||||
})) | })) | ||||
updated = updated.replace("<!--unsubscribe link here-->", unsubscribe_link) | updated = updated.replace("<!--unsubscribe link here-->", unsubscribe_link) | ||||
return updated | return updated | ||||
@@ -57,11 +57,6 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email', | |||||
sender = webnotes.conn.get_value('Email Settings', None, 'auto_email_id') | sender = webnotes.conn.get_value('Email Settings', None, 'auto_email_id') | ||||
check_bulk_limit(len(recipients)) | check_bulk_limit(len(recipients)) | ||||
try: | |||||
text_content = html2text(message) | |||||
except HTMLParser.HTMLParseError: | |||||
text_content = "[See html attachment]" | |||||
formatted = get_formatted_html(subject, message) | formatted = get_formatted_html(subject, message) | ||||
for r in filter(None, list(set(recipients))): | for r in filter(None, list(set(recipients))): | ||||
@@ -72,8 +67,13 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email', | |||||
if not is_unsubscribed(doc): | if not is_unsubscribed(doc): | ||||
# add to queue | # add to queue | ||||
add(r, sender, subject, update_message(formatted, doc, add_unsubscribe_link), | |||||
text_content, ref_doctype, ref_docname) | |||||
updated = update_message(formatted, doc, add_unsubscribe_link) | |||||
try: | |||||
text_content = html2text(updated) | |||||
except HTMLParser.HTMLParseError: | |||||
text_content = "[See html attachment]" | |||||
add(r, sender, subject, updated, text_content, ref_doctype, ref_docname) | |||||
def add(email, sender, subject, formatted, text_content=None, | def add(email, sender, subject, formatted, text_content=None, | ||||
ref_doctype=None, ref_docname=None): | ref_doctype=None, ref_docname=None): | ||||
@@ -83,7 +83,7 @@ def add(email, sender, subject, formatted, text_content=None, | |||||
e.recipient = email | e.recipient = email | ||||
try: | try: | ||||
e.message = get_email(email, sender=e.sender, formatted=formatted, subject=subject, | e.message = get_email(email, sender=e.sender, formatted=formatted, subject=subject, | ||||
text_content = text_content).as_string() | |||||
text_content=text_content).as_string() | |||||
except webnotes.ValidationError: | except webnotes.ValidationError: | ||||
# bad email id - don't add to queue | # bad email id - don't add to queue | ||||
return | return | ||||
@@ -113,7 +113,7 @@ def unsubscribe(): | |||||
def flush(from_test=False): | def flush(from_test=False): | ||||
"""flush email queue, every time: called from scheduler""" | """flush email queue, every time: called from scheduler""" | ||||
smptserver = SMTPServer() | |||||
smtpserver = SMTPServer() | |||||
auto_commit = not from_test | auto_commit = not from_test | ||||
@@ -133,7 +133,7 @@ def flush(from_test=False): | |||||
(email["name"],), auto_commit=auto_commit) | (email["name"],), auto_commit=auto_commit) | ||||
try: | try: | ||||
if not from_test: | if not from_test: | ||||
smptserver.sess.sendmail(email["sender"], email["recipient"], email["message"]) | |||||
smtpserver.sess.sendmail(email["sender"], email["recipient"], email["message"]) | |||||
webnotes.conn.sql("""update `tabBulk Email` set status='Sent' where name=%s""", | webnotes.conn.sql("""update `tabBulk Email` set status='Sent' where name=%s""", | ||||
(email["name"],), auto_commit=auto_commit) | (email["name"],), auto_commit=auto_commit) | ||||
@@ -21,7 +21,7 @@ def send(email, as_bulk=False): | |||||
if not email.reply_to: | if not email.reply_to: | ||||
email.reply_to = email.sender | email.reply_to = email.sender | ||||
email.sender = smtpserver.login | email.sender = smtpserver.login | ||||
smtpserver.sess.sendmail(email.sender, email.recipients + (email.cc or []), | smtpserver.sess.sendmail(email.sender, email.recipients + (email.cc or []), | ||||
email.as_string()) | email.as_string()) | ||||