From eec8e9260483d96a879f4d35d5e3b973848336ae Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 14 Feb 2012 17:25:31 +0530 Subject: [PATCH] login, analytics fix --- erpnext/home/page/dashboard/dashboard.js | 2 +- .../patches/jan_mar_2012/website/analytics.py | 5 ++ erpnext/startup/event_handlers.py | 4 ++ .../products_settings/products_settings.txt | 54 +++++++++---------- .../website_settings/website_settings.txt | 36 +++++++++++-- js/all-app.js | 2 +- js/all-web.js | 2 +- version.num | 2 +- 8 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/website/analytics.py diff --git a/erpnext/home/page/dashboard/dashboard.js b/erpnext/home/page/dashboard/dashboard.js index e8f2992208..b622808041 100644 --- a/erpnext/home/page/dashboard/dashboard.js +++ b/erpnext/home/page/dashboard/dashboard.js @@ -1,6 +1,6 @@ pscript.onload_dashboard = function() { // load jqplot - wn.require('lib/css/jqpot.css'); + wn.require('lib/css/jqplot.css'); wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js'); wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.barRenderer.js'); wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js'); diff --git a/erpnext/patches/jan_mar_2012/website/analytics.py b/erpnext/patches/jan_mar_2012/website/analytics.py new file mode 100644 index 0000000000..68ccfcfadf --- /dev/null +++ b/erpnext/patches/jan_mar_2012/website/analytics.py @@ -0,0 +1,5 @@ +def execute(): + from webnotes.modules import reload_doc + reload_doc('website', 'doctype', 'website_settings') + reload_doc('website', 'doctype', 'product_settings') + \ No newline at end of file diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index d9fbbedfd3..8b81c39262 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -56,6 +56,10 @@ def boot_session(bootinfo): parent_label, parentfield from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1) bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or '' + bootinfo['analytics_code'] = \ + webnotes.conn.get_value('Website Settings', None, 'analytics_code') + bootinfo['analytics_call'] = \ + webnotes.conn.get_value('Website Settings', None, 'analytics_call') else: bootinfo['letter_heads'] = get_letter_heads() diff --git a/erpnext/website/doctype/products_settings/products_settings.txt b/erpnext/website/doctype/products_settings/products_settings.txt index 9e60f95239..aa0fbb3bed 100644 --- a/erpnext/website/doctype/products_settings/products_settings.txt +++ b/erpnext/website/doctype/products_settings/products_settings.txt @@ -5,68 +5,68 @@ { 'creation': '2012-01-30 12:15:00', 'docstatus': 0, - 'modified': '2012-01-30 13:50:53', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-14 14:29:41', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1327906116', - 'colour': 'White:FFF', - 'description': 'Products are automatically updated from the item master. To add products to the website, go to the Item master and check "Show in Website" in the "Website Details"\n\n', + '_last_update': u'1327911653', + 'colour': u'White:FFF', + 'description': u'\n\n', 'doctype': 'DocType', 'issingle': 1, - 'module': 'Website', + 'module': u'Website', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 3 + 'version': 4 }, # These values are common for all DocField { - 'colour': 'White:FFF', - 'description': 'Product Groups that are listed on the website. The first product group from this list will be listed by default on the "Products Page"', - 'doctype': 'DocField', - 'fieldname': 'groups', - 'fieldtype': 'Table', - 'label': 'Groups', + 'colour': u'White:FFF', + 'description': u'Product Groups that are listed on the website. The first product group from this list will be listed by default on the "Products Page"', + 'doctype': u'DocField', + 'fieldname': u'groups', + 'fieldtype': u'Table', + 'label': u'Groups', 'name': '__common__', - 'options': 'Product Group', - 'parent': 'Products Settings', - 'parentfield': 'fields', - 'parenttype': 'DocType', + 'options': u'Product Group', + 'parent': u'Products Settings', + 'parentfield': u'fields', + 'parenttype': u'DocType', 'permlevel': 0 }, # These values are common for all DocPerm { 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Products Settings', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Products Settings', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'permlevel': 0, 'read': 1, - 'role': 'Website Manager', + 'role': u'Website Manager', 'write': 1 }, # DocType, Products Settings { 'doctype': 'DocType', - 'name': 'Products Settings' + 'name': u'Products Settings' }, # DocPerm { - 'doctype': 'DocPerm' + 'doctype': u'DocPerm' }, # DocField { - 'doctype': 'DocField' + 'doctype': u'DocField' } ] \ No newline at end of file diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt index 0ceac4715a..b6ea7a3a11 100644 --- a/erpnext/website/doctype/website_settings/website_settings.txt +++ b/erpnext/website/doctype/website_settings/website_settings.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-02-02 13:51:29', + 'creation': '2012-02-02 13:19:50', 'docstatus': 0, - 'modified': '2012-02-13 12:23:36', + 'modified': '2012-02-14 16:13:59', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -23,7 +23,7 @@ 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 8 + 'version': 9 }, # These values are common for all DocField @@ -205,5 +205,35 @@ 'label': u'Domain List', 'permlevel': 0, 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Analytics', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Code pasted in the head tag to start an Analytics engine like Google Analytics', + 'doctype': u'DocField', + 'fieldname': u'analytics_code', + 'fieldtype': u'Text', + 'label': u'Analytics Code', + 'permlevel': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u"Function to be called when page is changed. (_gaq.push['_trackPageview'] for Google Code)", + 'doctype': u'DocField', + 'fieldname': u'analytics_call', + 'fieldtype': u'Text', + 'label': u'Analytics Call', + 'permlevel': 0 } ] \ No newline at end of file diff --git a/js/all-app.js b/js/all-app.js index 826b6e0cf2..da1a02b193 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -1027,7 +1027,7 @@ if(!(nav_obj.ol[i][0]==t&&nav_obj.ol[i][1]==dt&&nav_obj.ol[i][2]==dn))tmp.push(n en_t=encodeURIComponent(t);en_dt=encodeURIComponent(dt);en_dn=dn?encodeURIComponent(dn):'';if(en_t=='Page'){var id=en_dt+(dn?('/'+en_dn):'')}else{var id=en_t+'/'+en_dt+(dn?('/'+en_dn):'')} if(nav_obj.on_open) nav_obj.on_open(id);if(window.location.hash!='!'+id){window.location.hash='!'+id;}} -nav_obj.notify_observers(t,dt,dn);} +nav_obj.notify_observers(t,dt,dn);if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}} nav_obj.notify_observers=function(t,dt,dn){for(var i=0;i