blob: f97eb39bc13db07ca1e53388ae1b47f34386463d [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() {
Rushabh Mehta9c7a01a2012-01-25 11:04:54 +053014 $('#startup_div').html('Starting up...').toggle(true);
15
Rushabh Mehta865c00a2012-01-24 14:33:21 +053016 erpnext.startup.set_globals();
17
18 if(user == 'Guest'){
19 $dh(page_body.left_sidebar);
Rushabh Mehta5b927092012-01-24 15:16:06 +053020 wn.require('erpnext/website/css/website.css');
Rushabh Mehta865c00a2012-01-24 14:33:21 +053021 wn.require('erpnext/website/js/topbar.js');
22 } else {
23 // modules
24 wn.require('erpnext/startup/modules.js');
25 pscript.startup_make_sidebar();
Brahma Kd1a2cea2011-08-30 09:33:29 +053026
Rushabh Mehta865c00a2012-01-24 14:33:21 +053027 // setup toolbar
28 wn.require('erpnext/startup/toolbar.js');
29 erpnext.toolbar.setup();
30 wn.require('erpnext/startup/feature_setup.js');
Brahma Kd1a2cea2011-08-30 09:33:29 +053031 }
Rushabh Mehta8c309be2012-01-20 13:47:16 +053032
Brahma Kd1a2cea2011-08-30 09:33:29 +053033 // border to the body
34 // ------------------
Rushabh Mehta865c00a2012-01-24 14:33:21 +053035 $('footer').html('<div class="erpnext-footer">\
36 Powered by <a href="https://erpnext.com">ERPNext</a></div>');
Brahma Kd1a2cea2011-08-30 09:33:29 +053037
Rushabh Mehta9c7a01a2012-01-25 11:04:54 +053038 $('#startup_div').toggle(false);
Brahma Kd1a2cea2011-08-30 09:33:29 +053039}
40
Brahma Kd1a2cea2011-08-30 09:33:29 +053041// chart of accounts
42// ====================================================================
43show_chart_browser = function(nm, chart_type){
44
45 var call_back = function(){
46 if(nm == 'Sales Browser'){
47 var sb_obj = new SalesBrowser();
48 sb_obj.set_val(chart_type);
49 }
50 else if(nm == 'Accounts Browser')
51 pscript.make_chart(chart_type);
52 }
53 loadpage(nm,call_back);
54}
55
56
57// Module Page
58// ====================================================================
59
60ModulePage = function(parent, module_name, module_label, help_page, callback) {
61 this.parent = parent;
62
63 // add to current page
64 page_body.cur_page.module_page = this;
65
66 this.wrapper = $a(parent,'div');
67 this.module_name = module_name;
68 this.transactions = [];
69 this.page_head = new PageHeader(this.wrapper, module_label);
70
71 if(help_page) {
72 var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
73 btn.help_page = help_page;
74 }
75
76 if(callback) this.callback = function(){ callback(); }
77}
78
Rushabh Mehta865c00a2012-01-24 14:33:21 +053079// start
80erpnext.startup.start();