Merge pull request #674 from rmehta/develop

minor fixes
This commit is contained in:
Anand Doshi 2014-07-07 11:14:48 +05:30
commit 3e76eb95ff
5 changed files with 19 additions and 5 deletions

View file

@ -94,6 +94,7 @@ def init(site, sites_path=None):
local.site_path = os.path.join(sites_path, site)
local.request_method = request.method if request else None
local.request_ip = None
local.response = _dict({"docs":[]})
local.conf = _dict(get_site_config())

View file

@ -20,6 +20,8 @@ class HTTPRequest:
if self.domain and self.domain.startswith('www.'):
self.domain = self.domain[4:]
frappe.local.request_ip = frappe.get_request_header('REMOTE_ADDR') \
or frappe.get_request_header('X-Forwarded-For') or '127.0.0.1'
# language
self.set_lang(frappe.get_request_header('HTTP_ACCEPT_LANGUAGE'))
@ -157,7 +159,7 @@ class LoginManager:
ip_list = [i.strip() for i in ip_list]
for ip in ip_list:
if frappe.get_request_header('REMOTE_ADDR', '').startswith(ip) or frappe.get_request_header('X-Forwarded-For', '').startswith(ip):
if frappe.local.request_ip.startswith(ip):
return
frappe.throw(_("Not allowed from this IP Address"), frappe.AuthenticationError)

View file

@ -129,7 +129,8 @@ _f.Frm.prototype.setup_print_layout = function() {
<div class="col-xs-3" style="padding-top: 7px;">\
<input type="checkbox" class="print-letterhead" checked/> Letterhead</div>\
<div class="col-xs-6 text-right" style="padding-top: 7px;">\
<a style="margin-right: 7px;" class="print-print">Print</a>\
<a style="margin-right: 7px;" class="btn-print-preview text-muted small">Preview</a>\
<strong><a style="margin-right: 7px;" class="btn-print-print">Print</a></strong>\
<a class="close">×</a>\
</div>\
</div>\
@ -156,13 +157,22 @@ _f.Frm.prototype.setup_print_layout = function() {
}, !me.print_letterhead.is(":checked"), true, true);
})
this.print_wrapper.find(".print-print").click(function() {
this.print_wrapper.find(".btn-print-print").click(function() {
_p.build(
me.print_sel.val(), // fmtname
_p.go, // onload
!me.print_letterhead.is(":checked") // no_letterhead
);
})
});
this.print_wrapper.find(".btn-print-preview").click(function() {
_p.build(
me.print_sel.val(), // fmtname
_p.preview, // onload
!me.print_letterhead.is(":checked") // no_letterhead
);
});
}
_f.Frm.prototype.print_doc = function() {

View file

@ -38,6 +38,7 @@ _p.preview = function(html) {
return;
}
w.document.write(html);
w.document.close();
return w
}

View file

@ -7,7 +7,7 @@
{% if (child.lft != None) and (child.rgt - child.lft != 1) and (not loop.first) %}icon-chevron-right{% endif %}"
style="margin-left: -15px; color: #ddd; {% if is_parent %}margin-left: -30px;{% endif %}"></i>
<a href="{{ child.name }}" class="no-decoration {% if child.name == pathname %}active{% endif %}">
{{ child.page_title }}
{{ child.page_title or child.name.replace("_", " ").title() }}
{% if not child.public_read %}
(<i class="icon-fixed-width icon-lock"></i>)
{% endif %}