@@ -397,9 +397,10 @@ def has_website_permission(doctype, ptype="read", doc=None, user=None, verbose=F | |||||
:param doc: Checks User permissions for given doc. | :param doc: Checks User permissions for given doc. | ||||
:param user: [optional] Check for given user. Default: current user.""" | :param user: [optional] Check for given user. Default: current user.""" | ||||
if not user: user = session.user | |||||
if not user: | |||||
user = session.user | |||||
for method in get_hooks("has_website_permission").get(doctype, []): | |||||
for method in (get_hooks("has_website_permission") or {}).get(doctype, []): | |||||
if not call(get_attr(method), doc=doc, ptype=ptype, user=user, verbose=verbose): | if not call(get_attr(method), doc=doc, ptype=ptype, user=user, verbose=verbose): | ||||
return False | return False | ||||
@@ -905,21 +906,32 @@ def get_print(doctype, name, print_format=None, style=None, as_pdf=False): | |||||
else: | else: | ||||
return html | return html | ||||
def attach_print(doctype, name, file_name): | |||||
def attach_print(doctype, name, file_name=None): | |||||
from frappe.utils import scrub_urls | from frappe.utils import scrub_urls | ||||
if not file_name: file_name = name | |||||
print_settings = db.get_singles_dict("Print Settings") | print_settings = db.get_singles_dict("Print Settings") | ||||
local.flags.ignore_print_permissions = True | |||||
if int(print_settings.send_print_as_pdf or 0): | if int(print_settings.send_print_as_pdf or 0): | ||||
return { | |||||
out = { | |||||
"fname": file_name + ".pdf", | "fname": file_name + ".pdf", | ||||
"fcontent": get_print(doctype, name, as_pdf=True) | "fcontent": get_print(doctype, name, as_pdf=True) | ||||
} | } | ||||
else: | else: | ||||
return { | |||||
out = { | |||||
"fname": file_name + ".html", | "fname": file_name + ".html", | ||||
"fcontent": scrub_urls(get_print(doctype, name)).encode("utf-8") | "fcontent": scrub_urls(get_print(doctype, name)).encode("utf-8") | ||||
} | } | ||||
print print_settings, out | |||||
local.flags.ignore_print_permissions = False | |||||
return out | |||||
logging_setup_complete = False | logging_setup_complete = False | ||||
def get_logger(module=None): | def get_logger(module=None): | ||||
from frappe.setup_logging import setup_logging | from frappe.setup_logging import setup_logging | ||||
@@ -119,6 +119,12 @@ class DocType(Document): | |||||
delete_notification_count_for(doctype=self.name) | delete_notification_count_for(doctype=self.name) | ||||
frappe.clear_cache(doctype=self.name) | frappe.clear_cache(doctype=self.name) | ||||
# save singles when made | |||||
if self.issingle and not frappe.db.get_singles_dict(self.name): | |||||
doc = frappe.new_doc(self.name) | |||||
doc.flags.ignore_mandatory=True | |||||
doc.save() | |||||
def before_rename(self, old, new, merge=False): | def before_rename(self, old, new, merge=False): | ||||
"""Throw exception if merge. DocTypes cannot be merged.""" | """Throw exception if merge. DocTypes cannot be merged.""" | ||||
if merge: | if merge: | ||||
@@ -118,6 +118,13 @@ | |||||
"permlevel": 0, | "permlevel": 0, | ||||
"reqd": 1 | "reqd": 1 | ||||
}, | }, | ||||
{ | |||||
"fieldname": "attach_print", | |||||
"fieldtype": "Check", | |||||
"label": "Attach Print", | |||||
"permlevel": 0, | |||||
"precision": "" | |||||
}, | |||||
{ | { | ||||
"fieldname": "message_examples", | "fieldname": "message_examples", | ||||
"fieldtype": "HTML", | "fieldtype": "HTML", | ||||
@@ -127,7 +134,7 @@ | |||||
} | } | ||||
], | ], | ||||
"icon": "icon-envelope", | "icon": "icon-envelope", | ||||
"modified": "2015-02-05 05:11:37.924396", | |||||
"modified": "2015-03-11 16:43:51.288063", | |||||
"modified_by": "Administrator", | "modified_by": "Administrator", | ||||
"module": "Email", | "module": "Email", | ||||
"name": "Email Alert", | "name": "Email Alert", | ||||
@@ -90,6 +90,9 @@ def evaluate_alert(doc, alert, event): | |||||
return | return | ||||
# send alert | # send alert | ||||
print "test" | |||||
frappe.sendmail(recipients=recipients, subject=alert.subject, | frappe.sendmail(recipients=recipients, subject=alert.subject, | ||||
message= frappe.render_template(alert.message, {"doc": doc, "alert":alert}), | message= frappe.render_template(alert.message, {"doc": doc, "alert":alert}), | ||||
bulk=True, ref_doctype = doc.doctype, ref_docname = doc.name) | |||||
bulk=True, ref_doctype = doc.doctype, ref_docname = doc.name, | |||||
attachments = [frappe.attach_print(doc.doctype, doc.name)] if alert.attach_print else None) |
@@ -46,26 +46,23 @@ a.disabled:hover { | |||||
} | } | ||||
a.grey, | a.grey, | ||||
.sidebar-section a, | .sidebar-section a, | ||||
.nav-pills a, | |||||
.control-value a, | .control-value a, | ||||
.data-row a { | .data-row a { | ||||
text-decoration: underline; | |||||
text-decoration: none; | |||||
} | } | ||||
a.grey:hover, | a.grey:hover, | ||||
.sidebar-section a:hover, | .sidebar-section a:hover, | ||||
.nav-pills a:hover, | |||||
.control-value a:hover, | .control-value a:hover, | ||||
.data-row a:hover, | .data-row a:hover, | ||||
a.grey:focus, | a.grey:focus, | ||||
.sidebar-section a:focus, | .sidebar-section a:focus, | ||||
.nav-pills a:focus, | |||||
.control-value a:focus, | .control-value a:focus, | ||||
.data-row a:focus { | .data-row a:focus { | ||||
text-decoration: underline; | text-decoration: underline; | ||||
} | } | ||||
a.text-muted, | a.text-muted, | ||||
a.text-extra-muted { | a.text-extra-muted { | ||||
text-underline: none; | |||||
text-decoration: none; | |||||
} | } | ||||
a.text-muted:hover, | a.text-muted:hover, | ||||
a.text-muted:focus, | a.text-muted:focus, | ||||
@@ -46,26 +46,23 @@ a.disabled:hover { | |||||
} | } | ||||
a.grey, | a.grey, | ||||
.sidebar-section a, | .sidebar-section a, | ||||
.nav-pills a, | |||||
.control-value a, | .control-value a, | ||||
.data-row a { | .data-row a { | ||||
text-decoration: underline; | |||||
text-decoration: none; | |||||
} | } | ||||
a.grey:hover, | a.grey:hover, | ||||
.sidebar-section a:hover, | .sidebar-section a:hover, | ||||
.nav-pills a:hover, | |||||
.control-value a:hover, | .control-value a:hover, | ||||
.data-row a:hover, | .data-row a:hover, | ||||
a.grey:focus, | a.grey:focus, | ||||
.sidebar-section a:focus, | .sidebar-section a:focus, | ||||
.nav-pills a:focus, | |||||
.control-value a:focus, | .control-value a:focus, | ||||
.data-row a:focus { | .data-row a:focus { | ||||
text-decoration: underline; | text-decoration: underline; | ||||
} | } | ||||
a.text-muted, | a.text-muted, | ||||
a.text-extra-muted { | a.text-extra-muted { | ||||
text-underline: none; | |||||
text-decoration: none; | |||||
} | } | ||||
a.text-muted:hover, | a.text-muted:hover, | ||||
a.text-muted:focus, | a.text-muted:focus, | ||||
@@ -85,7 +85,6 @@ body[data-route^="Module"] .main-menu .form-sidebar { | |||||
display: none !important; | display: none !important; | ||||
} | } | ||||
.layout-side-section .sidebar-menu > li > a { | .layout-side-section .sidebar-menu > li > a { | ||||
text-decoration: underline; | |||||
display: inline-block; | display: inline-block; | ||||
} | } | ||||
.layout-side-section .sidebar-menu { | .layout-side-section .sidebar-menu { | ||||
@@ -46,26 +46,23 @@ a.disabled:hover { | |||||
} | } | ||||
a.grey, | a.grey, | ||||
.sidebar-section a, | .sidebar-section a, | ||||
.nav-pills a, | |||||
.control-value a, | .control-value a, | ||||
.data-row a { | .data-row a { | ||||
text-decoration: underline; | |||||
text-decoration: none; | |||||
} | } | ||||
a.grey:hover, | a.grey:hover, | ||||
.sidebar-section a:hover, | .sidebar-section a:hover, | ||||
.nav-pills a:hover, | |||||
.control-value a:hover, | .control-value a:hover, | ||||
.data-row a:hover, | .data-row a:hover, | ||||
a.grey:focus, | a.grey:focus, | ||||
.sidebar-section a:focus, | .sidebar-section a:focus, | ||||
.nav-pills a:focus, | |||||
.control-value a:focus, | .control-value a:focus, | ||||
.data-row a:focus { | .data-row a:focus { | ||||
text-decoration: underline; | text-decoration: underline; | ||||
} | } | ||||
a.text-muted, | a.text-muted, | ||||
a.text-extra-muted { | a.text-extra-muted { | ||||
text-underline: none; | |||||
text-decoration: none; | |||||
} | } | ||||
a.text-muted:hover, | a.text-muted:hover, | ||||
a.text-muted:focus, | a.text-muted:focus, | ||||
@@ -539,6 +536,12 @@ fieldset { | |||||
border-top: 1px solid #d1d8dd; | border-top: 1px solid #d1d8dd; | ||||
margin: 0px -15px -20px -15px; | margin: 0px -15px -20px -15px; | ||||
} | } | ||||
.blog-text { | |||||
padding: 15px 0px; | |||||
} | |||||
.blog-text p { | |||||
margin-bottom: 30px; | |||||
} | |||||
.blogger { | .blogger { | ||||
padding: 10px 15px; | padding: 10px 15px; | ||||
border-top: 1px solid #d1d8dd; | border-top: 1px solid #d1d8dd; | ||||
@@ -685,7 +688,7 @@ a.active { | |||||
.offcanvas .sidebar-menu { | .offcanvas .sidebar-menu { | ||||
margin-bottom: 0; | margin-bottom: 0; | ||||
} | } | ||||
.offcanvas ul { | |||||
.offcanvas .sidebar ul { | |||||
margin: 0px; | margin: 0px; | ||||
} | } | ||||
.offcanvas .sidebar-page-sidebar { | .offcanvas .sidebar-page-sidebar { | ||||
@@ -902,7 +902,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ | |||||
$('<div class="link-field" style="position: relative;">\ | $('<div class="link-field" style="position: relative;">\ | ||||
<input type="text" class="input-with-feedback form-control">\ | <input type="text" class="input-with-feedback form-control">\ | ||||
<span class="link-btn">\ | <span class="link-btn">\ | ||||
<a class="btn-open grey" title="' + __("Open Link") + '">\ | |||||
<a class="btn-open no-decoration" title="' + __("Open Link") + '">\ | |||||
<i class="icon-link"></i></a>\ | <i class="icon-link"></i></a>\ | ||||
</span>\ | </span>\ | ||||
</div>').prependTo(this.input_area); | </div>').prependTo(this.input_area); | ||||
@@ -47,17 +47,17 @@ a.disabled, a.disabled:hover { | |||||
text-decoration: none; | text-decoration: none; | ||||
} | } | ||||
a.grey, .sidebar-section a, .nav-pills a, .control-value a, .data-row a { | |||||
.underline(); | |||||
a.grey, .sidebar-section a, .control-value a, .data-row a { | |||||
text-decoration: none; | |||||
} | } | ||||
a.grey:hover, .sidebar-section a:hover, .nav-pills a:hover, .control-value a:hover, .data-row a:hover, | |||||
a.grey:focus, .sidebar-section a:focus, .nav-pills a:focus, .control-value a:focus, .data-row a:focus { | |||||
.underline-hover(); | |||||
a.grey:hover, .sidebar-section a:hover, .control-value a:hover, .data-row a:hover, | |||||
a.grey:focus, .sidebar-section a:focus, .control-value a:focus, .data-row a:focus { | |||||
text-decoration: underline; | |||||
} | } | ||||
a.text-muted, a.text-extra-muted { | a.text-muted, a.text-extra-muted { | ||||
text-underline: none; | |||||
text-decoration: none; | |||||
} | } | ||||
a.text-muted:hover, | a.text-muted:hover, | ||||
@@ -43,7 +43,6 @@ body[data-route^="Module"] .main-menu { | |||||
} | } | ||||
.sidebar-menu > li > a { | .sidebar-menu > li > a { | ||||
.underline; | |||||
display: inline-block; | display: inline-block; | ||||
} | } | ||||
@@ -244,6 +244,14 @@ fieldset { | |||||
margin: 0px -15px -20px -15px; | margin: 0px -15px -20px -15px; | ||||
} | } | ||||
.blog-text { | |||||
padding: 15px 0px; | |||||
p { | |||||
margin-bottom: 30px; | |||||
} | |||||
} | |||||
.blogger { | .blogger { | ||||
padding: 10px 15px; | padding: 10px 15px; | ||||
border-top: 1px solid @border-color; | border-top: 1px solid @border-color; | ||||
@@ -363,7 +371,7 @@ a.active { | |||||
.offcanvas-mobile-mixin(); | .offcanvas-mobile-mixin(); | ||||
.offcanvas { | .offcanvas { | ||||
ul { | |||||
.sidebar ul { | |||||
margin: 0px; | margin: 0px; | ||||
} | } | ||||
@@ -11,7 +11,7 @@ | |||||
<span itemprop="author">{{ blogger_info and blogger_info.full_name or full_name }}</span>, | <span itemprop="author">{{ blogger_info and blogger_info.full_name or full_name }}</span>, | ||||
<span itemprop="dateCreated">{{ updated }}</span> | <span itemprop="dateCreated">{{ updated }}</span> | ||||
</p> | </p> | ||||
<div itemprop="articleBody" style="padding: 15px 0px;"> | |||||
<div itemprop="articleBody" class="blog-text"> | |||||
{{ content }} | {{ content }} | ||||
</div> | </div> | ||||
<!-- end blog content --> | <!-- end blog content --> | ||||
@@ -5,10 +5,13 @@ | |||||
{% endblock %} | {% endblock %} | ||||
{% block content %} | {% block content %} | ||||
{% if introduction_text %} | |||||
<p class="lead">{{ introduction_text }}</p> | |||||
<hr> | |||||
{% endif %} | |||||
<!-- no-sidebar --> | |||||
<div class="introduction"> | |||||
{% if introduction_text %} | |||||
<p class="lead">{{ introduction_text }}</p> | |||||
<hr> | |||||
{% endif %} | |||||
</div> | |||||
{% if login_required and frappe.user=="Guest" %} | {% if login_required and frappe.user=="Guest" %} | ||||
<div class="text-muted"> | <div class="text-muted"> | ||||
{{ _("Please login to create a new {0}").format(_(doc_type)) }} | {{ _("Please login to create a new {0}").format(_(doc_type)) }} | ||||
@@ -253,11 +256,11 @@ frappe.ready(function() { | |||||
callback: function(data) { | callback: function(data) { | ||||
if(!data.exc) { | if(!data.exc) { | ||||
$form.addClass("hide"); | $form.addClass("hide"); | ||||
$(".comments").addClass("hide"); | |||||
$(".comments, .introduction").addClass("hide"); | |||||
scroll(0, 0); | scroll(0, 0); | ||||
$(".form-message") | $(".form-message") | ||||
.html("{{ success_message or 'Thank You!' }}" | |||||
+ '<p><a href="{{ success_url }}">Continue</a></p>') | |||||
.html('{{ success_message or __("Thank You") }}' | |||||
+ '<p><a href="{{ success_url }}">{{ _("Continue") }}</a></p>') | |||||
.removeClass("hide"); | .removeClass("hide"); | ||||
} | } | ||||
window.saving = false; | window.saving = false; | ||||
@@ -1,7 +1,7 @@ | |||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors | // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors | ||||
// MIT License. See license.txt | // MIT License. See license.txt | ||||
$(document).ready(function() { | |||||
frappe.ready(function() { | |||||
$('.btn-send').click(function() { | $('.btn-send').click(function() { | ||||
var email = $('[name="email"]').val(); | var email = $('[name="email"]').val(); | ||||
@@ -56,7 +56,8 @@ def get_html(doc, name=None, print_format=None, meta=None, | |||||
doc.flags.in_print = True | doc.flags.in_print = True | ||||
validate_print_permission(doc) | |||||
if not frappe.flags.ignore_print_permissions: | |||||
validate_print_permission(doc) | |||||
if hasattr(doc, "before_print"): | if hasattr(doc, "before_print"): | ||||
doc.before_print() | doc.before_print() | ||||
@@ -47,6 +47,10 @@ def after_install(): | |||||
import_country_and_currency() | import_country_and_currency() | ||||
# save default print setting | |||||
print_settings = frappe.get_doc("Print Settings") | |||||
print_settings.save() | |||||
# all roles to admin | # all roles to admin | ||||
frappe.get_doc("User", "Administrator").add_roles(*frappe.db.sql_list("""select name from tabRole""")) | frappe.get_doc("User", "Administrator").add_roles(*frappe.db.sql_list("""select name from tabRole""")) | ||||
@@ -141,7 +141,7 @@ def get_blog_list(doctype, txt=None, filters=None, limit_start=0, limit_page_len | |||||
ifnull(t1.blog_intro, t1.content) as content, | ifnull(t1.blog_intro, t1.content) as content, | ||||
t2.full_name, t2.avatar, t1.blogger, | t2.full_name, t2.avatar, t1.blogger, | ||||
(select count(name) from `tabComment` where | (select count(name) from `tabComment` where | ||||
comment_doctype='Blog Post' and comment_docname=t1.name) as comments | |||||
comment_doctype='Blog Post' and comment_docname=t1.name and comment_type="Comment") as comments | |||||
from `tabBlog Post` t1, `tabBlogger` t2 | from `tabBlog Post` t1, `tabBlogger` t2 | ||||
where ifnull(t1.published,0)=1 | where ifnull(t1.published,0)=1 | ||||
and t1.blogger = t2.name | and t1.blogger = t2.name | ||||
@@ -4,13 +4,6 @@ | |||||
"docstatus": 0, | "docstatus": 0, | ||||
"doctype": "DocType", | "doctype": "DocType", | ||||
"fields": [ | "fields": [ | ||||
{ | |||||
"fieldname": "help", | |||||
"fieldtype": "HTML", | |||||
"label": "Help", | |||||
"options": "<div class=\"alert alert-info\">Link for Contact Page is \"/contact\"</div>", | |||||
"permlevel": 0 | |||||
}, | |||||
{ | { | ||||
"fieldname": "introduction_section", | "fieldname": "introduction_section", | ||||
"fieldtype": "Section Break", | "fieldtype": "Section Break", | ||||
@@ -97,7 +90,7 @@ | |||||
"icon": "icon-cog", | "icon": "icon-cog", | ||||
"idx": 1, | "idx": 1, | ||||
"issingle": 1, | "issingle": 1, | ||||
"modified": "2015-02-05 05:11:36.090289", | |||||
"modified": "2015-03-11 18:08:13.531919", | |||||
"modified_by": "Administrator", | "modified_by": "Administrator", | ||||
"module": "Website", | "module": "Website", | ||||
"name": "Contact Us Settings", | "name": "Contact Us Settings", | ||||