blob: fe31eab15dffb67f8f59fab6a643cc6d3bda201c [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);
Rushabh Mehta5b927092012-01-24 15:16:06 +053018 wn.require('erpnext/website/css/website.css');
Rushabh Mehta865c00a2012-01-24 14:33:21 +053019 wn.require('erpnext/website/js/topbar.js');
20 } else {
21 // modules
22 wn.require('erpnext/startup/modules.js');
23 pscript.startup_make_sidebar();
Brahma Kd1a2cea2011-08-30 09:33:29 +053024
Rushabh Mehta865c00a2012-01-24 14:33:21 +053025 // setup toolbar
26 wn.require('erpnext/startup/toolbar.js');
27 erpnext.toolbar.setup();
28 wn.require('erpnext/startup/feature_setup.js');
Brahma Kd1a2cea2011-08-30 09:33:29 +053029 }
Rushabh Mehta8c309be2012-01-20 13:47:16 +053030
Brahma Kd1a2cea2011-08-30 09:33:29 +053031 // border to the body
32 // ------------------
Rushabh Mehta865c00a2012-01-24 14:33:21 +053033 $('footer').html('<div class="erpnext-footer">\
34 Powered by <a href="https://erpnext.com">ERPNext</a></div>');
Brahma Kd1a2cea2011-08-30 09:33:29 +053035
36}
37
Brahma Kd1a2cea2011-08-30 09:33:29 +053038// chart of accounts
39// ====================================================================
40show_chart_browser = function(nm, chart_type){
41
42 var call_back = function(){
43 if(nm == 'Sales Browser'){
44 var sb_obj = new SalesBrowser();
45 sb_obj.set_val(chart_type);
46 }
47 else if(nm == 'Accounts Browser')
48 pscript.make_chart(chart_type);
49 }
50 loadpage(nm,call_back);
51}
52
53
54// Module Page
55// ====================================================================
56
57ModulePage = function(parent, module_name, module_label, help_page, callback) {
58 this.parent = parent;
59
60 // add to current page
61 page_body.cur_page.module_page = this;
62
63 this.wrapper = $a(parent,'div');
64 this.module_name = module_name;
65 this.transactions = [];
66 this.page_head = new PageHeader(this.wrapper, module_label);
67
68 if(help_page) {
69 var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
70 btn.help_page = help_page;
71 }
72
73 if(callback) this.callback = function(){ callback(); }
74}
75
Rushabh Mehta865c00a2012-01-24 14:33:21 +053076// start
77erpnext.startup.start();