blob: 9171d8a6a6a716b7cd1a86afdb318b6ba820bce7 [file] [log] [blame]
Brahma Kd1a2cea2011-08-30 09:33:29 +05301var current_module;
2var is_system_manager = 0;
3var module_content_dict = {};
4var user_full_nm = {};
5
Rushabh Mehta865c00a2012-01-24 14:33:21 +05306wn.provide('erpnext.startup');
Brahma Kd1a2cea2011-08-30 09:33:29 +05307
Rushabh Mehta865c00a2012-01-24 14:33:21 +05308erpnext.startup.set_globals = function() {
9 pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
10 if(inList(user_roles,'System Manager')) is_system_manager = 1;
11}
Rushabh Mehta8c309be2012-01-20 13:47:16 +053012
Rushabh Mehta865c00a2012-01-24 14:33:21 +053013erpnext.startup.start = function() {
14 erpnext.startup.set_globals();
15
16 if(user == 'Guest'){
17 $dh(page_body.left_sidebar);
18 wn.require('erpnext/website/js/topbar.js');
19 } else {
20 // modules
21 wn.require('erpnext/startup/modules.js');
22 pscript.startup_make_sidebar();
Brahma Kd1a2cea2011-08-30 09:33:29 +053023
Rushabh Mehta865c00a2012-01-24 14:33:21 +053024 // setup toolbar
25 wn.require('erpnext/startup/toolbar.js');
26 erpnext.toolbar.setup();
27 wn.require('erpnext/startup/feature_setup.js');
Brahma Kd1a2cea2011-08-30 09:33:29 +053028 }
Rushabh Mehta8c309be2012-01-20 13:47:16 +053029
Brahma Kd1a2cea2011-08-30 09:33:29 +053030 // border to the body
31 // ------------------
Rushabh Mehta865c00a2012-01-24 14:33:21 +053032 $('footer').html('<div class="erpnext-footer">\
33 Powered by <a href="https://erpnext.com">ERPNext</a></div>');
Brahma Kd1a2cea2011-08-30 09:33:29 +053034
35}
36
Brahma Kd1a2cea2011-08-30 09:33:29 +053037// chart of accounts
38// ====================================================================
39show_chart_browser = function(nm, chart_type){
40
41 var call_back = function(){
42 if(nm == 'Sales Browser'){
43 var sb_obj = new SalesBrowser();
44 sb_obj.set_val(chart_type);
45 }
46 else if(nm == 'Accounts Browser')
47 pscript.make_chart(chart_type);
48 }
49 loadpage(nm,call_back);
50}
51
52
53// Module Page
54// ====================================================================
55
56ModulePage = function(parent, module_name, module_label, help_page, callback) {
57 this.parent = parent;
58
59 // add to current page
60 page_body.cur_page.module_page = this;
61
62 this.wrapper = $a(parent,'div');
63 this.module_name = module_name;
64 this.transactions = [];
65 this.page_head = new PageHeader(this.wrapper, module_label);
66
67 if(help_page) {
68 var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
69 btn.help_page = help_page;
70 }
71
72 if(callback) this.callback = function(){ callback(); }
73}
74
Rushabh Mehta865c00a2012-01-24 14:33:21 +053075// start
76erpnext.startup.start();