@@ -4,6 +4,8 @@ | |||||
<title>ERPNext</title> | <title>ERPNext</title> | ||||
{{ ajax_meta_tag }} | {{ ajax_meta_tag }} | ||||
<meta name="author" content=""> | <meta name="author" content=""> | ||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> | |||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon"> | |||||
<script type="text/javascript" src="lib/js/lib/jquery/jquery.min.js"></script> | <script type="text/javascript" src="lib/js/lib/jquery/jquery.min.js"></script> | ||||
<script type="text/javascript"> | <script type="text/javascript"> | ||||
// browser support | // browser support | ||||
@@ -103,7 +103,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit | |||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}} | wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}} | ||||
wn.get_route=function(route){if(!route) | wn.get_route=function(route){if(!route) | ||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});} | route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});} | ||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;} | |||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();} | |||||
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route) | wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route) | ||||
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}}); | return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}}); | ||||
/* | /* | ||||
@@ -59,6 +59,7 @@ function startup() { | |||||
var t = to_open(); | var t = to_open(); | ||||
if(t) { | if(t) { | ||||
window.location.hash = t; | window.location.hash = t; | ||||
set_favicon(); | |||||
} else if(home_page) { | } else if(home_page) { | ||||
loadpage(home_page); | loadpage(home_page); | ||||
} | } | ||||
@@ -149,3 +150,14 @@ get_window_height = function() { | |||||
var ht = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight ? document.documentElement.offsetHeight : document.body.offsetHeight; | var ht = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight ? document.documentElement.offsetHeight : document.body.offsetHeight; | ||||
return ht; | return ht; | ||||
} | } | ||||
// favicon disappears when window.location.hash value is changed in firefox | |||||
// This is used to mitigate this favicon bug in firefox | |||||
function set_favicon() { | |||||
var link = $('link[type="image/x-icon"]').remove().attr("href"); | |||||
var favicon ='\ | |||||
<link rel="shortcut icon" href="' + link + '" type="image/x-icon"> \ | |||||
<link rel="icon" href="' + link + '" type="image/x-icon">' | |||||
$(favicon).appendTo('head'); | |||||
} |
@@ -35,6 +35,9 @@ wn.get_route = function(route) { | |||||
wn.set_route = function() { | wn.set_route = function() { | ||||
route = $.map(arguments, function(a) { return encodeURIComponent(a) }).join('/'); | route = $.map(arguments, function(a) { return encodeURIComponent(a) }).join('/'); | ||||
window.location.hash = route; | window.location.hash = route; | ||||
// Set favicon (app.js) | |||||
set_favicon(); | |||||
} | } | ||||
wn._cur_route = null; | wn._cur_route = null; | ||||
@@ -52,4 +55,4 @@ $(window).bind('hashchange', function() { | |||||
console.log(e); | console.log(e); | ||||
} | } | ||||
} | } | ||||
}); | |||||
}); |
@@ -379,7 +379,7 @@ def get_field_property(dt, fieldname, property): | |||||
prop = webnotes.conn.sql(""" | prop = webnotes.conn.sql(""" | ||||
select value | select value | ||||
from `tabProperty Setter` | from `tabProperty Setter` | ||||
where doc_type=%s and doc_name=%s and property=%s""", (dt, field[0][0], property)) | |||||
where doc_type=%s and field_name=%s and property=%s""", (dt, fieldname, property)) | |||||
if prop: | if prop: | ||||
return prop[0][0] | return prop[0][0] | ||||
else: | else: | ||||
@@ -394,7 +394,7 @@ def get_property(dt, property): | |||||
prop = webnotes.conn.sql(""" | prop = webnotes.conn.sql(""" | ||||
select value | select value | ||||
from `tabProperty Setter` | from `tabProperty Setter` | ||||
where doc_type=%s and doc_name=%s and property=%s""", (dt, dt, property)) | |||||
where doc_type=%s and field_name=%s and property=%s""", (dt, dt, property)) | |||||
if prop: | if prop: | ||||
return prop[0][0] | return prop[0][0] | ||||
else: | else: | ||||