Merge branch 'master' of github.com:webnotes/erpnext into edge

Conflicts:
	hr/doctype/leave_application/locale/_messages_py.json
	hr/doctype/leave_block_list/locale/_messages_doc.json
	public/js/locale/_messages_js.json
	setup/doctype/email_digest/locale/_messages_doc.json
	setup/doctype/global_defaults/global_defaults.txt
This commit is contained in:
Anand Doshi
2013-02-21 11:09:43 +05:30
36 changed files with 1595 additions and 110 deletions

View File

@@ -1,11 +1,11 @@
# Copyright (c) 2012 Web Notes Technologies Pvt Ltd.
# License: GNU General Public License (v3). For more information see license.txt
import os
import webnotes
import website.utils
def make():
import os
import webnotes
import website.utils
import startup.event_handlers
if not webnotes.conn:
webnotes.connect()
@@ -16,17 +16,45 @@ def make():
if os.path.basename(os.path.abspath('.'))!='public':
fname = os.path.join('public', fname)
if hasattr(startup.event_handlers, 'get_web_script'):
with open(fname, 'w') as f:
script = 'window.home_page = "%s";\n' % home_page
script += startup.event_handlers.get_web_script()
f.write(script)
with open(fname, 'w') as f:
f.write(get_web_script())
fname = 'css/wn-web.css'
if os.path.basename(os.path.abspath('.'))!='public':
fname = os.path.join('public', fname)
# style - wn.css
if hasattr(startup.event_handlers, 'get_web_style'):
with open(fname, 'w') as f:
f.write(startup.event_handlers.get_web_style())
with open(fname, 'w') as f:
f.write(get_web_style())
def get_web_script():
"""returns web startup script"""
user_script = ""
ws = webnotes.doc("Website Settings", "Website Settings")
if ws.google_analytics_id:
user_script += google_analytics_template % ws.google_analytics_id
user_script += (webnotes.conn.get_value('Website Script', None, 'javascript') or '')
return user_script
def get_web_style():
"""returns web css"""
return webnotes.conn.get_value('Style Settings', None, 'custom_css') or ''
google_analytics_template = """
// Google Analytics template
window._gaq = window._gaq || [];
window._gaq.push(['_setAccount', '%s']);
window._gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
"""