From bedc1fe534ab28d9e8d6c1e64f624bc5e081e4be Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 17 Jan 2012 18:17:06 +0530 Subject: [PATCH 01/70] new login authentication --- .gitignore | 1 + .../home/page/event_updates/event_updates.js | 4 +- erpnext/home/page/my_company/my_company.js | 26 +++-- erpnext/startup/event_handlers.py | 102 +++--------------- erpnext/startup/startup.css | 20 ++-- erpnext/startup/startup.js | 23 ++-- index.html | 2 +- version.num | 2 +- 8 files changed, 48 insertions(+), 132 deletions(-) diff --git a/.gitignore b/.gitignore index 0818a024539..0ef6ee5c4a7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.comp.js .DS_Store server_tools +user_files patch.log lib versions-local.db diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index ee348e63071..6d60418e9cc 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -6,7 +6,7 @@ pscript['onload_Event Updates'] = function() { pscript.home_make_body(); pscript.home_make_status(); - pscript.home_pre_process(); + pscript.home_set_banner(); pscript.home_make_widgets(); } @@ -30,7 +30,7 @@ pscript.home_make_body = function() { // ================================== -pscript.home_pre_process = function(wrapper) { +pscript.home_set_banner = function(wrapper) { var wrapper = page_body.pages['Event Updates']; var cp = locals['Control Panel']['Control Panel']; diff --git a/erpnext/home/page/my_company/my_company.js b/erpnext/home/page/my_company/my_company.js index 58ff91e725f..a7d3bdbe2de 100644 --- a/erpnext/home/page/my_company/my_company.js +++ b/erpnext/home/page/my_company/my_company.js @@ -43,14 +43,11 @@ pscript.myc_show_erpnext_message = function() { // pscript.myc_add_user = function() { var fields = [{ - fieldtype: 'Data', - fieldname: 'user', - reqd: 1, - label: 'Email Id of the user to add' - }]; - - if(!pscript.is_erpnext_saas) { - fields = fields.concat([ + fieldtype: 'Data', + fieldname: 'user', + reqd: 1, + label: 'Email Id of the user to add' + }, { fieldtype: 'Data', fieldname: 'first_name', @@ -67,14 +64,15 @@ pscript.myc_add_user = function() { fieldname: 'password', reqd: 1, label: 'Password' - }]); + }, + { + fieldtype: 'Button', + label: 'Add', + fieldname: 'add' + }]; } - fields.push({ - fieldtype: 'Button', - label: 'Add', - fieldname: 'add' - }); + fields.push(); var d = new wn.widgets.Dialog({ title: 'Add User', diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 304d2e4187a..88d7a332646 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -2,102 +2,28 @@ import webnotes import webnotes.defs from webnotes.utils import cint -# -# alias the current user -# def on_login(login_manager): + """ + called from login manager, before login + """ + try: + import server_tools.gateway_utils + server_tools.gateway_utils.check_login() + except ImportError: + pass - # login as - if login_manager.user == 'Administrator': - user = webnotes.form.getvalue('login_as') - - if user: - # create if missing (due to some bug) - login_as(user, login_manager) - - # alisaing here... so check if the user is disabled - if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]: - # throw execption - webnotes.msgprint("Authentication Failed", raise_exception=1) - - if hasattr(webnotes.defs, 'validate_ip'): - msg = getattr(webnotes.defs, 'validate_ip')() - if msg: webnotes.msgprint(msg, raise_exception=1) - - login_manager.user = user - -# -# update account details -# -def update_account_details(): - # additional details (if from gateway) - if webnotes.form_dict.get('is_trial'): - webnotes.conn.set_global('is_trial', cint(webnotes.form_dict.get('is_trial'))) - - if webnotes.form_dict.get('days_to_expiry'): - webnotes.conn.set_global('days_to_expiry', webnotes.form_dict.get('days_to_expiry')) - - if webnotes.form_dict.get('first_name'): - from server_tools.gateway_utils import update_user_details - update_user_details() -# -# save (login from) -# def on_login_post_session(login_manager): - # login from - if webnotes.form_dict.get('login_from'): - webnotes.session['data']['login_from'] = webnotes.form.getvalue('login_from') - webnotes.session_obj.update() - + """ + called after login + update login_from and delete parallel sessions + """ # Clear previous sessions i.e. logout previous log-in attempts exception_list = ['demo@webnotestech.com', 'Administrator'] if webnotes.session['user'] not in exception_list: sid_list = webnotes.conn.sql(""" - SELECT sid - FROM `tabSessions` + DELETE FROM `tabSessions` WHERE user=%s AND - sid!=%s - ORDER BY lastupdate desc""", \ + sid!=%s""", \ (webnotes.session['user'], webnotes.session['sid']), as_list=1) - for sid in sid_list: - webnotes.conn.sql("DELETE FROM `tabSessions` WHERE sid=%s", sid[0]) - - update_account_details() - -# -# logout the user from SSO -# -def on_logout(login_manager): - if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')): - from server_tools.gateway_utils import logout_sso - logout_sso(user=login_manager.user) - -# -# create a profile (if logs in for the first time) -# -def login_as(user, login_manager): - import os - import webnotes - webnotes.session = {'user': user} - ip = os.environ.get('REMOTE_ADDR') - - # validate if user is from SSO - if ip == '72.55.168.105' or 1: - # if user does not exist, create it - if not webnotes.conn.sql("select name from tabProfile where name=%s", user): - from webnotes.model.doc import Document - - import webnotes - import webnotes.utils.webservice - - p = Document('Profile') - p.first_name = webnotes.form_dict.get('first_name') - p.last_name = webnotes.form_dict.get('last_name') - p.email = user - p.name = user - p.enabled = 1 - p.owner = user - p.save(1) - diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css index 7b2b6e582dc..f7aff1c5355 100644 --- a/erpnext/startup/startup.css +++ b/erpnext/startup/startup.css @@ -12,22 +12,14 @@ body { background-color: #e2e2e2; } -.layout_wrapper { - padding: 13px; - margin: 7px; - -moz-box-shadow: 1px 1px 6px #AAA; - -webkit-box-shadow: 1px 1px 6px #AAA; - box-shadow: 1px 1px 6px #AAA; - background-color: #FFF; +.erpnext-footer { + margin: 3px auto; + color: #888; + text-align: center; } -#birthday_area { - display: none; - padding: 4px; - margin-bottom: 8px; - background-color: #FDD; - padding: 4px; - color: #644; +.erpnext-footer a, .erpnext-footer a:hover, .erpnext-footer a:visited { + color: #666; } .module-icons { diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 5a66ec672d6..1264657756a 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -13,7 +13,6 @@ if(inList(user_roles,'System Manager')) is_system_manager = 1; function startup_setup() { pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway) - if(get_url_arg('embed')) { // hide header, footer $dh(page_body.banner_area); @@ -21,18 +20,18 @@ function startup_setup() { $dh(page_body.footer); return; } - - if(user=='Guest' && !get_url_arg('akey')) { - if(pscript.is_erpnext_saas) { - window.location.href = 'https://www.erpnext.com'; - return; - } - } - // page structure // -------------- - $td(page_body.wntoolbar.body_tab,0,0).innerHTML = 'erpnext'; - $y($td(page_body.wntoolbar.body_tab,0,0), {width:'140px', color:'#FFF', paddingLeft:'8px', paddingRight:'8px', fontSize:'14px'}) + if(page_body.wntoolbar) { + $td(page_body.wntoolbar.body_tab,0,0).innerHTML = 'erpnext'; + $y($td(page_body.wntoolbar.body_tab,0,0), { + width:'140px', + color:'#FFF', + paddingLeft:'8px', + paddingRight:'8px', + fontSize:'14px' + }); + } $dh(page_body.banner_area); // sidebar @@ -41,7 +40,7 @@ function startup_setup() { // border to the body // ------------------ - $dh(page_body.footer); + page_body.footer.innerHTML = ''; // setup toolbar pscript.startup_setup_toolbar(); diff --git a/index.html b/index.html index ce1a617c21e..846e8639e99 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext - +
-
- -
+
Loading...
diff --git a/js/app.js b/js/app.js index 5a8597d48ba..4a276622365 100644 --- a/js/app.js +++ b/js/app.js @@ -1,3 +1,12 @@ +wn.app = { + name: 'ERPNext', + license: 'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is', + source: 'https://github.com/webnotes/erpnext', + publisher: 'Web Notes Technologies Pvt Ltd, Mumbai', + copyright: '© Web Notes Technologies Pvt Ltd', + version: '2.' + window._version_number +} + wn.settings.no_history = true; wn.require('lib/js/lib/jquery.min.js'); @@ -11,4 +20,8 @@ wn.require('lib/css/legacy/default.css'); $(document).bind('ready', function() { startup(); -}); \ No newline at end of file +}); + +$(document).bind('toolbar_setup', function() { + $('.brand').html('erpnext'); +}) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index af0b8e5f79e..4a24783dbae 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,13 +6,12 @@ +
-
- -
+
Loading...
diff --git a/version.num b/version.num index 61395542108..e3f1e9b791c 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -52 \ No newline at end of file +80 \ No newline at end of file From 8c7b4060cbf4b04a3e2a83ffa2aaa3474ff1fb7e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 20 Jan 2012 13:56:15 +0530 Subject: [PATCH 09/70] version update --- index.html | 2 +- version.num | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8f167c1ca73..3d7b8deac5a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext - +throw new SyntaxError('JSON.parse');};}}()); +/* +* lib/js/core.js +*/ + +wn.versions.check();wn.require("lib/js/lib/jquery.min.js");wn.require("lib/js/lib/history/history.min.js");$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});
diff --git a/version.num b/version.num index 8bfa2f5ecdc..0aede4a000a 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -86 \ No newline at end of file +102 \ No newline at end of file From c5bf642c7d113306bd8a38fb8f7e929fe028d8ee Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 23 Jan 2012 16:18:34 +0530 Subject: [PATCH 13/70] version --- .../home/doctype/home_control/home_control.py | 5 ++- .../home/page/event_updates/event_updates.js | 42 ++++++++++--------- erpnext/home/page/my_company/my_company.js | 2 +- erpnext/hr/doctype/appraisal/appraisal.js | 2 - index.html | 2 +- version.num | 2 +- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/erpnext/home/doctype/home_control/home_control.py b/erpnext/home/doctype/home_control/home_control.py index ce15bfd57ac..9d821532cd1 100644 --- a/erpnext/home/doctype/home_control/home_control.py +++ b/erpnext/home/doctype/home_control/home_control.py @@ -197,7 +197,10 @@ class DocType: return count def get_todo_list(self): - return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo Item` where owner=%s order by field(priority,'High','Medium','Low') asc, date asc", session['user'])) + return sql("""select name, description, date, + priority, checked, reference_type, reference_name from `tabToDo Item` + where owner=%s order by field(priority,'High','Medium','Low') asc, date asc""", \ + session['user'], as_dict=1) def add_todo_item(self,args): args = json.loads(args) diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index 6e09cca971d..9e8302e3bfd 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -346,21 +346,32 @@ HomeToDo.prototype.render_item = function(item, det) { $y(tab, {tableLayout:'fixed'}); var span = $a($td(tab, 0, 0), 'span', '', {padding:'2px',color:'#FFF',fontSize:'10px' - ,backgroundColor:(det[3]=='Low' ? '#888' : (det[3]=='High' ? '#EDA857' : '#687FD3'))}); + , backgroundColor:(det.priority=='Low' ? '#888' : + (det.priority=='High' ? '#EDA857' : '#687FD3'))}); $(span).css('-moz-border-radius','3px').css('-webkit-border-radius','3px'); - span.innerHTML = det[3]; + span.innerHTML = det.priority; // text - var span = $a($td(tab, 0, 1), 'span', 'social', {lineHeight:'1.5em'}, replace_newlines(det[1])); - if(det[4]) $y(span,{textDecoration:'line-through'}); + var span = $a($td(tab, 0, 1), 'div', 'social', {lineHeight:'1.5em'}, + replace_newlines(det.description)); + if(det.checked) $y(span,{textDecoration:'line-through'}); + + // reference link + if(det.reference_name) { + $a($td(tab, 0, 1), 'div', 'social', '', + repl('%(reference_name)s', + det)) + } // if expired & open, then in red - if(!det[4] && dateutil.str_to_obj(det[2]) < new Date()) { + if(!det.checked && dateutil.str_to_obj(det.date) < new Date()) { $y(span,{color:'RED'}); - $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2]) + ' (Overdue)'); + $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, + dateutil.str_to_user(det.date) + ' (Overdue)'); } else { - $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, dateutil.str_to_user(det[2])); + $a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, + dateutil.str_to_user(det.date)); } } @@ -371,10 +382,10 @@ HomeToDo.prototype.clear_dialog = function() { HomeToDo.prototype.set_dialog_values = function(det) { var d = this.widget.dialog; d.set_values({ - date: det[2], - priority: det[3], - description: det[1], - checked: det[4] + date: det.date, + priority: det.priority, + description: det.description, + checked: det.checked }); d.det = det; } @@ -389,8 +400,6 @@ HomeToDo.prototype.save = function(btn) { return; } - det.name = d.det ? d.det[0] : ''; - var callback = function(r,rt) { btn.done_working(); me.widget.dialog.hide(); @@ -420,9 +429,6 @@ FeedList.prototype.make_head = function() { // head $a(this.head,'h1','', {display:'inline'}, 'Home'); - $a(this.head,'span','link_type', {marginLeft:'7px', fontSize:'11px'}, 'help', function() { - msgprint('What appears here? This is where you get updates of everything you are permitted to follow') - }) // refresh $a(this.head,'span','link_type', @@ -583,10 +589,6 @@ HomeStatusBar = function() { this.render = function(r) { this.wrapper.innerHTML = ''; - this.profile_settings = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'}); - this.profile_settings.innerHTML = user_fullname + ' (Profile Settings)'; - this.profile_settings.onclick = function() { loadpage('profile-settings'); } - this.span = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'}); this.span.onclick = function() { loadpage('My Company') } diff --git a/erpnext/home/page/my_company/my_company.js b/erpnext/home/page/my_company/my_company.js index a057ac3e7fd..0aea99b3a71 100644 --- a/erpnext/home/page/my_company/my_company.js +++ b/erpnext/home/page/my_company/my_company.js @@ -579,7 +579,7 @@ MemberProfile = function(parent, uid, member_item) { $ds(this.member_item.working_img); $dh(this.wrapper); this.loading = 1; - $c('webnotes.widgets.form.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback); // onload + $c('webnotes.widgets.form.load.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback); // onload } // show / hide diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js index d040c5353df..78b5fd3a09a 100644 --- a/erpnext/hr/doctype/appraisal/appraisal.js +++ b/erpnext/hr/doctype/appraisal/appraisal.js @@ -90,8 +90,6 @@ cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){ declare_completed_dialog.refresh_dt = function(){ cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn); - msgprint("refersh done"); - $c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){}); } declare_completed_dialog.add = function() { diff --git a/index.html b/index.html index 25f47d65fbc..371a7126bf5 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext - +throw new SyntaxError('JSON.parse');};}}());wn.versions.check();wn.require("lib/js/lib/jquery.min.js");wn.require("lib/js/lib/history/history.min.js");$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});
diff --git a/version.num b/version.num index 257e563266b..dec4c59e4a0 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -102 +104 \ No newline at end of file From 865c00a79a1610c22699503604a7b3aa9be22bd3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 24 Jan 2012 14:33:21 +0530 Subject: [PATCH 15/70] started website --- erpnext/accounts/doctype/account/account.js | 2 +- .../journal_voucher/journal_voucher.js | 2 +- .../payable_voucher/payable_voucher.js | 2 +- .../receivable_voucher/receivable_voucher.js | 2 +- .../event_updates/complete_registration.js | 88 +++ .../home/page/event_updates/event_updates.js | 92 +-- erpnext/home/page/my_company/my_company.js | 2 +- .../jan_mar_2012/subdomain_login_patch.py | 13 +- erpnext/projects/page/projects/projects.js | 2 +- .../notification_control.js | 3 +- erpnext/setup/page/setup/setup.html | 4 +- erpnext/setup/page/setup/setup.js | 4 +- .../Setup Masters/Setup Masters.txt | 29 + erpnext/startup/event_handlers.py | 20 +- erpnext/startup/feature_setup.js | 187 +++++ erpnext/startup/modules.js | 372 ++++++++++ erpnext/startup/startup.js | 639 +----------------- .../website/Module Def/Website/Website.txt | 66 ++ erpnext/website/__init__.py | 0 erpnext/website/doctype/__init__.py | 0 .../website/doctype/top_bar_item/__init__.py | 0 .../doctype/top_bar_item/top_bar_item.txt | 74 ++ .../doctype/top_bar_settings/__init__.py | 0 .../top_bar_settings/top_bar_settings.txt | 99 +++ erpnext/website/js/topbar.js | 46 ++ index.html | 3 +- js/app.js | 1 + templates/index.html | 1 + version.num | 2 +- 29 files changed, 1030 insertions(+), 725 deletions(-) create mode 100644 erpnext/home/page/event_updates/complete_registration.js create mode 100644 erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt create mode 100644 erpnext/startup/feature_setup.js create mode 100644 erpnext/startup/modules.js create mode 100644 erpnext/website/Module Def/Website/Website.txt create mode 100644 erpnext/website/__init__.py create mode 100644 erpnext/website/doctype/__init__.py create mode 100644 erpnext/website/doctype/top_bar_item/__init__.py create mode 100644 erpnext/website/doctype/top_bar_item/top_bar_item.txt create mode 100644 erpnext/website/doctype/top_bar_settings/__init__.py create mode 100644 erpnext/website/doctype/top_bar_settings/top_bar_settings.txt create mode 100644 erpnext/website/js/topbar.js diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index 51cacdaf367..b07bb9c3870 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -15,7 +15,7 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) { cur_frm.cscript.onload = function(doc, cdt, cdn) { cur_frm.cscript.account_type(doc, cdt, cdn); // hide India specific fields - var cp = locals['Control Panel']['Control Panel']; + var cp = wn.control_panel; if(cp.country == 'India') unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']); else diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js index f65ee3169dc..983d3038941 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js @@ -1,5 +1,5 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { - var cp = locals['Control Panel']['Control Panel']; + var cp = wn.control_panel; if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date()); diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js index ce268657f14..ff80d6b4f20 100644 --- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js +++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js @@ -7,7 +7,7 @@ $import(Purchase Common) // On Load // -------- cur_frm.cscript.onload = function(doc,dt,dn) { - var cp = locals['Control Panel']['Control Panel']; + var cp = wn.control_panel; if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()}); if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()}); diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js index edff465b7ab..bac1a1b0bd5 100644 --- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js +++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js @@ -71,7 +71,7 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { } // India related fields - var cp = locals['Control Panel']['Control Panel']; + var cp = wn.control_panel; if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']); else hide_field(['c_form_applicable', 'c_form_no']); diff --git a/erpnext/home/page/event_updates/complete_registration.js b/erpnext/home/page/event_updates/complete_registration.js new file mode 100644 index 00000000000..4ed3fe984bc --- /dev/null +++ b/erpnext/home/page/event_updates/complete_registration.js @@ -0,0 +1,88 @@ +// complete my company registration +// -------------------------------- +pscript.complete_registration = function(is_complete) { + if(is_complete == 'No'){ + var d = new Dialog(400, 200, "Please Complete Your Registration"); + if(user != 'Administrator'){ + d.no_cancel(); // Hide close image + $('header').toggle(false); + } + + d.make_body([ + ['Data','Company Name','Example: Your Company LLC'], + ['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'], + ['Select','Fiscal Year Start Date'], + ['Select','Default Currency'], + ['Button','Save'], + ]); + + // if company name is set, set the input value + // and disable it + if(wn.control_panel.company_name) { + d.widgets['Company Name'].value = wn.control_panel.company_name; + d.widgets['Company Name'].disabled = 1; + } + + + //d.widgets['Save'].disabled = true; // disable Save button + pscript.make_dialog_field(d); + + // submit details + d.widgets['Save'].onclick = function() + { + d.widgets['Save'].set_working(); + + flag = pscript.validate_fields(d); + if(flag) + { + var args = [ + d.widgets['Company Name'].value, + d.widgets['Company Abbreviation'].value, + d.widgets['Fiscal Year Start Date'].value, + d.widgets['Default Currency'].value + ]; + + $c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){ + sys_defaults = r.message; + d.hide(); + $('header').toggle(true); + }); + } + } + d.show(); + } +} + +// make dialog fields +// ------------------ +pscript.make_dialog_field = function(d) +{ + // fiscal year format + fisc_format = d.widgets['Fiscal Year Start Date']; + add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']); + + // default currency + currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR']; + currency = d.widgets['Default Currency']; + add_sel_options(currency, currency_list); +} + + +// validate fields +// --------------- +pscript.validate_fields = function(d) +{ + var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency']; + var msg = 'Please enter the following fields'; + var flag = 1; + for(var i=0; i
\ No newline at end of file +
+
Loading...
+
\ No newline at end of file diff --git a/erpnext/setup/page/setup/setup.js b/erpnext/setup/page/setup/setup.js index b3a195effdf..d58f11a1abc 100644 --- a/erpnext/setup/page/setup/setup.js +++ b/erpnext/setup/page/setup/setup.js @@ -1,9 +1,8 @@ pscript.onload_Setup = function() { var parent = $i('setup_div'); - add_space_holder(parent); var callback = function(r,rt){ - + $('#setup_div').empty(); // header parent.page_head = new PageHeader(parent,'Setup'); @@ -11,7 +10,6 @@ pscript.onload_Setup = function() { var setup_data = new SetupData(r.message); pscript.setup_make_sections(setup_data); - remove_space_holder(); } $c_obj('Setup Wizard Control','get_country','',callback); } diff --git a/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt b/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt new file mode 100644 index 00000000000..fe1a04840c3 --- /dev/null +++ b/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt @@ -0,0 +1,29 @@ +# Module Def, Setup Masters +[ + + # These values are common in all dictionaries + { + 'creation': '2010-08-08 17:35:42', + 'docstatus': 0, + 'modified': '2012-01-23 17:04:53', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all Module Def + { + 'disabled': 'No', + 'doctype': u'Module Def', + 'is_hidden': 'No', + 'last_updated_date': '2010-11-29 12:02:02', + 'module_label': 'Setup Masters', + 'module_name': 'Setup Masters', + 'name': '__common__' + }, + + # Module Def, Setup Masters + { + 'doctype': u'Module Def', + 'name': 'Setup Masters' + } +] \ No newline at end of file diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 798c2011d55..02752623a3d 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -32,4 +32,22 @@ def on_login_post_session(login_manager): def doclist_all(doc, method): """doclist trigger called from webnotes.model.doclist on any event""" import home - home.update_feed(doc, method) \ No newline at end of file + home.update_feed(doc, method) + +def boot_session(bootinfo): + """boot session - send website info if guest""" + import webnotes + import webnotes.model.doc + + if webnotes.session['user']=='Guest': + bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings') + bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page, parent_label + from `tabTop Bar Item`""", as_dict=1) + else: + bootinfo['letter_heads'] = get_letter_heads() + +def get_letter_heads(): + """load letter heads with startup""" + import webnotes + ret = webnotes.conn.sql("select name, content from `tabLetter Head` where ifnull(disabled,0)=0") + dict(ret) diff --git a/erpnext/startup/feature_setup.js b/erpnext/startup/feature_setup.js new file mode 100644 index 00000000000..ba81cbde238 --- /dev/null +++ b/erpnext/startup/feature_setup.js @@ -0,0 +1,187 @@ +/* features setup "Dictionary", "Script" +Dictionary Format + 'projects': { + 'Sales Order': { + 'fields':['project_name'], + 'sales_order_details':['projected_qty'] + }, + 'Purchase Order': { + 'fields':['project_name'] + } + } +// ====================================================================*/ +pscript.feature_dict = { + 'fs_projects': { + 'Bill Of Materials': {'fields':['project_name']}, + 'Delivery Note': {'fields':['project_name']}, + 'Payable Voucher': {'fields':['project_name']}, + 'Production Order': {'fields':['project_name']}, + 'Purchase Order': {'fields':['project_name']}, + 'Purchase Receipt': {'fields':['project_name']}, + 'Receivable Voucher': {'fields':['project_name']}, + 'Sales Order': {'fields':['project_name']}, + 'Stock Entry': {'fields':['project_name']}, + 'Timesheet': {'timesheet_details':['project_name']} + }, + 'fs_packing_details': { + 'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']}, + 'Sales Order': {'fields':['packing_details']} + }, + 'fs_discounts': { + 'Delivery Note': {'delivery_note_details':['adj_rate']}, + 'Quotation': {'quotation_details':['adj_rate']}, + 'Receivable Voucher': {'entries':['adj_rate']}, + 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} + }, + 'fs_purchase_discounts': { + 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, + 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, + 'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']} + }, + 'fs_brands': { + 'Delivery Note': {'delivery_note_details':['brand']}, + 'Indent': {'indent_details':['brand']}, + 'Item': {'fields':['brand']}, + 'Purchase Order': {'po_details':['brand']}, + 'Payable Voucher': {'entries':['brand']}, + 'Quotation': {'quotation_details':['brand']}, + 'Receivable Voucher': {'entries':['brand']}, + 'Sales BOM': {'fields':['new_item_brand']}, + 'Sales Order': {'sales_order_details':['brand']}, + 'Serial No': {'fields':['brand']} + }, + 'fs_after_sales_installations': { + 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} + }, + 'fs_item_batch_nos': { + 'Delivery Note': {'delivery_note_details':['batch_no']}, + 'Item': {'fields':['has_batch_no']}, + 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, + 'QA Inspection Report': {'fields':['batch_no']}, + 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']}, + 'Receivable Voucher': {'entries':['batch_no']}, + 'Stock Entry': {'mtn_details':['batch_no']}, + 'Stock Ledger Entry': {'fields':['batch_no']} + }, + 'fs_item_serial_nos': { + 'Customer Issue': {'fields':['serial_no']}, + 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, + 'Installation Note': {'installed_item_details':['serial_no']}, + 'Item': {'fields':['has_serial_no']}, + 'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']}, + 'Maintenance Visit': {'maintenance_visit_details':['serial_no']}, + 'Purchase Receipt': {'purchase_receipt_details':['serial_no']}, + 'QA Inspection Report': {'fields':['item_serial_no']}, + 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']}, + 'Receivable Voucher': {'entries':['serial_no']}, + 'Stock Entry': {'mtn_details':['serial_no']}, + 'Stock Ledger Entry': {'fields':['serial_no']} + }, + 'fs_item_group_in_details': { + 'Delivery Note': {'delivery_note_details':['item_group']}, + 'Enquiry': {'enquiry_details':['item_group']}, + 'Indent': {'indent_details':['item_group']}, + 'Item': {'fields':['item_group']}, + 'Manage Account': {'fields':['default_item_group']}, + 'Purchase Order': {'po_details':['item_group']}, + 'Purchase Receipt': {'purchase_receipt_details':['item_group']}, + 'Purchase Voucher': {'entries':['item_group']}, + 'Quotation': {'quotation_details':['item_group']}, + 'Receivable Voucher': {'entries':['item_group']}, + 'Sales BOM': {'fields':['serial_no']}, + 'Sales Order': {'sales_order_details':['item_group']}, + 'Serial No': {'fields':['item_group']}, + 'Sales Partner': {'partner_target_details':['item_group']}, + 'Sales Person': {'target_details':['item_group']}, + 'Territory': {'target_details':['item_group']} + }, + 'fs_page_break': { + 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, + 'Indent': {'indent_details':['page_break']}, + 'Purchase Order': {'po_details':['page_break']}, + 'Purchase Receipt': {'purchase_receipt_details':['page_break']}, + 'Purchase Voucher': {'entries':['page_break']}, + 'Quotation': {'quotation_details':['page_break']}, + 'Receivable Voucher': {'entries':['page_break']}, + 'Sales Order': {'sales_order_details':['page_break']} + }, + 'fs_exports': { + 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']}, + 'POS Setting': {'fields':['conversion_rate','currency']}, + 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']}, + 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']}, + 'Item': {'ref_rate_details':['ref_currency']}, + 'Sales BOM': {'fields':['currency']}, + 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']} + }, + 'fs_imports': { + 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']}, + 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']}, + 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']}, + 'Supplier Quotation': {'fields':['conversion_rate','currency']} + }, + 'fs_item_advanced': { + 'Item': {'fields':['item_customer_details']} + }, + 'fs_sales_extras': { + 'Address': {'fields':['sales_partner']}, + 'Contact': {'fields':['sales_partner']}, + 'Customer': {'fields':['sales_team']}, + 'Delivery Note': {'fields':['sales_team','Packing List']}, + 'Item': {'fields':['item_customer_details']}, + 'Receivable Voucher': {'fields':['sales_team']}, + 'Sales Order': {'fields':['sales_team','Packing List']} + }, + 'fs_more_info': { + 'Customer': {'fields':['More Info']}, + 'Delivery Note': {'fields':['More Info']}, + 'Enquiry': {'fields':['More Info']}, + 'Indent': {'fields':['More Info']}, + 'Lead': {'fields':['More Info']}, + 'Payable Voucher': {'fields':['More Info']}, + 'Purchase Order': {'fields':['More Info']}, + 'Purchase Receipt': {'fields':['More Info']}, + 'Quotation': {'fields':['More Info']}, + 'Receivable Voucher': {'fields':['More Info']}, + 'Sales Order': {'fields':['More Info']}, + 'Serial No': {'fields':['More Info']}, + 'Supplier': {'fields':['More Info']} + }, + 'fs_quality': { + 'Item': {'fields':['Item Inspection Criteria','inspection_required']}, + 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} + }, + 'fs_manufacturing': { + 'Item': {'fields':['Manufacturing']} + }, + 'fs_pos': { + 'Receivable Voucher': {'fields':['is_pos']} + }, + 'fs_recurring_invoice': { + 'Receivable Voucher': {'fields': ['Recurring Invoice']} + } +} + +$(document).bind('form_refresh', function() { + for(sys_feat in sys_defaults) + { + if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists + { + if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) + { + for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) + { + if(fort=='fields') + hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]); + else if(cur_frm.fields_dict[fort]) + { + for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]) + cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false); + } + else + msgprint('Grid "'+fort+'" does not exists'); + } + } + } + } +}) diff --git a/erpnext/startup/modules.js b/erpnext/startup/modules.js new file mode 100644 index 00000000000..29adfcb1822 --- /dev/null +++ b/erpnext/startup/modules.js @@ -0,0 +1,372 @@ +// ==================================================================== + +pscript.startup_make_sidebar = function() { + $y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'}); + + var callback = function(r,rt) { + // menu + var ml = r.message; + + // clear + page_body.left_sidebar.innerHTML = ''; + + for(var m=0; mNote: These changes will apply to all users!', ml, update_order, 1); + } + $c_obj('Home Control', 'get_module_order', '', callback) + +} diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index ad4e78ec4d6..9171d8a6a6a 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -1,413 +1,39 @@ -if(user == 'Guest'){ - $dh(page_body.left_sidebar); -} - var current_module; var is_system_manager = 0; var module_content_dict = {}; var user_full_nm = {}; -// check if session user is system manager -if(inList(user_roles,'System Manager')) is_system_manager = 1; +wn.provide('erpnext.startup'); -wn.require('erpnext/startup/toolbar.js'); +erpnext.startup.set_globals = function() { + pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway) + if(inList(user_roles,'System Manager')) is_system_manager = 1; +} -function startup_setup() { - pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway) +erpnext.startup.start = function() { + erpnext.startup.set_globals(); + + if(user == 'Guest'){ + $dh(page_body.left_sidebar); + wn.require('erpnext/website/js/topbar.js'); + } else { + // modules + wn.require('erpnext/startup/modules.js'); + pscript.startup_make_sidebar(); - if(get_url_arg('embed')) { - // hide header, footer - $('.topbar').css('display', 'none'); - $dh(page_body.footer); - return; + // setup toolbar + wn.require('erpnext/startup/toolbar.js'); + erpnext.toolbar.setup(); + wn.require('erpnext/startup/feature_setup.js'); } - $dh(page_body.banner_area); - - // sidebar - // ------- - pscript.startup_make_sidebar(); - // border to the body // ------------------ - page_body.footer.innerHTML = ''; - - // setup toolbar - erpnext.toolbar.setup(); -} - -// ==================================================================== - -pscript.startup_make_sidebar = function() { - $y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'}); - - var callback = function(r,rt) { - // menu - var ml = r.message; - - // clear - page_body.left_sidebar.innerHTML = ''; - - for(var m=0; m\ + Powered by ERPNext
'); } -// ==================================================================== - -MenuPointer.prototype.select = function(grey) { - $y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'}); - //$gr(this.wrapper, '#F84', '#F63'); - $gr(this.wrapper, '#888', '#666'); - this.selected = 1; - - if(cur_menu_pointer && cur_menu_pointer != this) - cur_menu_pointer.deselect(); - - cur_menu_pointer = this; -} - -// ==================================================================== - -MenuPointer.prototype.deselect = function() { - $y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'}); - $gr(this.wrapper, body_background, body_background); - this.selected = 0; -} - - -// ==================================================================== -// Sidebar Item -// ==================================================================== - -var cur_sidebar_item = null; - -SidebarItem = function(det) { - var me = this; - this.det = det; - this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'}); - - this.body = $a(this.wrapper, 'div'); - this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'}); - - // icon - var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'}); - - // pointer table - this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label); - $y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'}); - - // for page type - if(det.module_page) { - menu_item_map.Page[det.module_page] = this.pointer; - } - - // items area - this.items_area = $a(this.wrapper, 'div'); - - this.body.onclick = function() { me.onclick(); } -} - -// ==================================================================== - -SidebarItem.prototype.onclick = function() { - var me = this; - - if(this.det.module_page) { - // page type - this.pointer.select(); - - $item_set_working(me.pointer.label_area); - loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); }); - - } else { - // show sub items - this.toggle(); - } -} - -// ==================================================================== - -SidebarItem.prototype.collapse = function() { - $(this.items_area).slideUp(); - this.is_open = 0; - $fg(this.pointer.label_area, '#444') -} - -// ==================================================================== - -SidebarItem.prototype.toggle = function() { - if(this.loading) return; - - if(this.is_open) { - this.collapse(); - } else { - if(this.loaded) $(this.items_area).slideDown(); - else this.show_items(); - this.is_open = 1; - $fg(this.pointer.label_area, '#000') - //this.pointer.select(1); - - // close existing open - if(cur_sidebar_item && cur_sidebar_item != this) { - cur_sidebar_item.collapse(); - } - cur_sidebar_item = this; - } -} - -// ==================================================================== - -SidebarItem.prototype.show_items = function() { - this.loading = 1; - var me = this; - - $item_set_working(this.pointer.label_area); - var callback = function(r,rt){ - me.loaded = 1; - me.loading = 0; - var smi = null; - var has_reports = 0; - var has_tools = 0; - - // widget code - $item_done_working(me.pointer.label_area); - - if(r.message.il) { - me.il = r.message.il; - - // forms - for(var i=0; iNote: These changes will apply to all users!', ml, update_order, 1); - } - $c_obj('Home Control', 'get_module_order', '', callback) - -} // chart of accounts // ==================================================================== show_chart_browser = function(nm, chart_type){ @@ -446,224 +72,5 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) { if(callback) this.callback = function(){ callback(); } } - -// get plural -// ==================================================================== - -get_plural = function(str){ - if(str.charAt(str.length-1).toLowerCase() == 'y') return str.substr(0, str.length-1) + 'ies' - else return str + 's'; -} - -// set user fullname -// ==================================================================== -pscript.set_user_fullname = function(ele,username,get_latest){ - - var set_it = function(){ - if(ele) - ele.innerHTML = user_full_nm[username]; - } - - if(get_latest){ - $c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); }); - } - else{ - if(user_full_nm[username]){ - set_it(); - } - - else - $c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); }); - } -} - -// ==================================================================== -startup_setup(); - -/* features setup "Dictionary", "Script" -Dictionary Format - 'projects': { - 'Sales Order': { - 'fields':['project_name'], - 'sales_order_details':['projected_qty'] - }, - 'Purchase Order': { - 'fields':['project_name'] - } - } -// ====================================================================*/ -pscript.feature_dict = { - 'fs_projects': { - 'Bill Of Materials': {'fields':['project_name']}, - 'Delivery Note': {'fields':['project_name']}, - 'Payable Voucher': {'fields':['project_name']}, - 'Production Order': {'fields':['project_name']}, - 'Purchase Order': {'fields':['project_name']}, - 'Purchase Receipt': {'fields':['project_name']}, - 'Receivable Voucher': {'fields':['project_name']}, - 'Sales Order': {'fields':['project_name']}, - 'Stock Entry': {'fields':['project_name']}, - 'Timesheet': {'timesheet_details':['project_name']} - }, - 'fs_packing_details': { - 'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']}, - 'Sales Order': {'fields':['packing_details']} - }, - 'fs_discounts': { - 'Delivery Note': {'delivery_note_details':['adj_rate']}, - 'Quotation': {'quotation_details':['adj_rate']}, - 'Receivable Voucher': {'entries':['adj_rate']}, - 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} - }, - 'fs_purchase_discounts': { - 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, - 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, - 'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']} - }, - 'fs_brands': { - 'Delivery Note': {'delivery_note_details':['brand']}, - 'Indent': {'indent_details':['brand']}, - 'Item': {'fields':['brand']}, - 'Purchase Order': {'po_details':['brand']}, - 'Payable Voucher': {'entries':['brand']}, - 'Quotation': {'quotation_details':['brand']}, - 'Receivable Voucher': {'entries':['brand']}, - 'Sales BOM': {'fields':['new_item_brand']}, - 'Sales Order': {'sales_order_details':['brand']}, - 'Serial No': {'fields':['brand']} - }, - 'fs_after_sales_installations': { - 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} - }, - 'fs_item_batch_nos': { - 'Delivery Note': {'delivery_note_details':['batch_no']}, - 'Item': {'fields':['has_batch_no']}, - 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, - 'QA Inspection Report': {'fields':['batch_no']}, - 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']}, - 'Receivable Voucher': {'entries':['batch_no']}, - 'Stock Entry': {'mtn_details':['batch_no']}, - 'Stock Ledger Entry': {'fields':['batch_no']} - }, - 'fs_item_serial_nos': { - 'Customer Issue': {'fields':['serial_no']}, - 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, - 'Installation Note': {'installed_item_details':['serial_no']}, - 'Item': {'fields':['has_serial_no']}, - 'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']}, - 'Maintenance Visit': {'maintenance_visit_details':['serial_no']}, - 'Purchase Receipt': {'purchase_receipt_details':['serial_no']}, - 'QA Inspection Report': {'fields':['item_serial_no']}, - 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']}, - 'Receivable Voucher': {'entries':['serial_no']}, - 'Stock Entry': {'mtn_details':['serial_no']}, - 'Stock Ledger Entry': {'fields':['serial_no']} - }, - 'fs_item_group_in_details': { - 'Delivery Note': {'delivery_note_details':['item_group']}, - 'Enquiry': {'enquiry_details':['item_group']}, - 'Indent': {'indent_details':['item_group']}, - 'Item': {'fields':['item_group']}, - 'Manage Account': {'fields':['default_item_group']}, - 'Purchase Order': {'po_details':['item_group']}, - 'Purchase Receipt': {'purchase_receipt_details':['item_group']}, - 'Purchase Voucher': {'entries':['item_group']}, - 'Quotation': {'quotation_details':['item_group']}, - 'Receivable Voucher': {'entries':['item_group']}, - 'Sales BOM': {'fields':['serial_no']}, - 'Sales Order': {'sales_order_details':['item_group']}, - 'Serial No': {'fields':['item_group']}, - 'Sales Partner': {'partner_target_details':['item_group']}, - 'Sales Person': {'target_details':['item_group']}, - 'Territory': {'target_details':['item_group']} - }, - 'fs_page_break': { - 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, - 'Indent': {'indent_details':['page_break']}, - 'Purchase Order': {'po_details':['page_break']}, - 'Purchase Receipt': {'purchase_receipt_details':['page_break']}, - 'Purchase Voucher': {'entries':['page_break']}, - 'Quotation': {'quotation_details':['page_break']}, - 'Receivable Voucher': {'entries':['page_break']}, - 'Sales Order': {'sales_order_details':['page_break']} - }, - 'fs_exports': { - 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']}, - 'POS Setting': {'fields':['conversion_rate','currency']}, - 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']}, - 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']}, - 'Item': {'ref_rate_details':['ref_currency']}, - 'Sales BOM': {'fields':['currency']}, - 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']} - }, - 'fs_imports': { - 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']}, - 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']}, - 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']}, - 'Supplier Quotation': {'fields':['conversion_rate','currency']} - }, - 'fs_item_advanced': { - 'Item': {'fields':['item_customer_details']} - }, - 'fs_sales_extras': { - 'Address': {'fields':['sales_partner']}, - 'Contact': {'fields':['sales_partner']}, - 'Customer': {'fields':['sales_team']}, - 'Delivery Note': {'fields':['sales_team','Packing List']}, - 'Item': {'fields':['item_customer_details']}, - 'Receivable Voucher': {'fields':['sales_team']}, - 'Sales Order': {'fields':['sales_team','Packing List']} - }, - 'fs_more_info': { - 'Customer': {'fields':['More Info']}, - 'Delivery Note': {'fields':['More Info']}, - 'Enquiry': {'fields':['More Info']}, - 'Indent': {'fields':['More Info']}, - 'Lead': {'fields':['More Info']}, - 'Payable Voucher': {'fields':['More Info']}, - 'Purchase Order': {'fields':['More Info']}, - 'Purchase Receipt': {'fields':['More Info']}, - 'Quotation': {'fields':['More Info']}, - 'Receivable Voucher': {'fields':['More Info']}, - 'Sales Order': {'fields':['More Info']}, - 'Serial No': {'fields':['More Info']}, - 'Supplier': {'fields':['More Info']} - }, - 'fs_quality': { - 'Item': {'fields':['Item Inspection Criteria','inspection_required']}, - 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} - }, - 'fs_manufacturing': { - 'Item': {'fields':['Manufacturing']} - }, - 'fs_pos': { - 'Receivable Voucher': {'fields':['is_pos']} - }, - 'fs_recurring_invoice': { - 'Receivable Voucher': {'fields': ['Recurring Invoice']} - } -} - -$(document).bind('form_refresh', function() { - for(sys_feat in sys_defaults) - { - if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists - { - if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) - { - for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) - { - if(fort=='fields') - hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]); - else if(cur_frm.fields_dict[fort]) - { - for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]) - cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false); - } - else - msgprint('Grid "'+fort+'" does not exists'); - } - } - } - } -}) +// start +erpnext.startup.start(); \ No newline at end of file diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt new file mode 100644 index 00000000000..0a5e1b8c5f9 --- /dev/null +++ b/erpnext/website/Module Def/Website/Website.txt @@ -0,0 +1,66 @@ +# Module Def, Website +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-23 17:05:32', + 'docstatus': 0, + 'modified': '2012-01-24 10:29:53', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all Module Def Role + { + 'doctype': 'Module Def Role', + 'name': '__common__', + 'parent': 'Website', + 'parentfield': 'roles', + 'parenttype': 'Module Def' + }, + + # These values are common for all Module Def Item + { + 'display_name': 'Top Bar Settings', + 'doc_name': 'Top Bar Settings', + 'doc_type': 'Single DocType', + 'doctype': 'Module Def Item', + 'name': '__common__', + 'parent': 'Website', + 'parentfield': 'items', + 'parenttype': 'Module Def' + }, + + # These values are common for all Module Def + { + 'disabled': 'No', + 'doctype': u'Module Def', + 'is_hidden': 'No', + 'module_label': 'Website', + 'module_name': 'Website', + 'name': '__common__' + }, + + # Module Def, Website + { + 'doctype': u'Module Def', + 'name': 'Website' + }, + + # Module Def Item + { + 'doctype': 'Module Def Item' + }, + + # Module Def Role + { + 'doctype': 'Module Def Role', + 'role': 'System Manager' + }, + + # Module Def Role + { + 'doctype': 'Module Def Role', + 'role': 'Website Manager' + } +] \ No newline at end of file diff --git a/erpnext/website/__init__.py b/erpnext/website/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/website/doctype/__init__.py b/erpnext/website/doctype/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/website/doctype/top_bar_item/__init__.py b/erpnext/website/doctype/top_bar_item/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/website/doctype/top_bar_item/top_bar_item.txt b/erpnext/website/doctype/top_bar_item/top_bar_item.txt new file mode 100644 index 00000000000..e352ef550f8 --- /dev/null +++ b/erpnext/website/doctype/top_bar_item/top_bar_item.txt @@ -0,0 +1,74 @@ +# DocType, Top Bar Item +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-24 10:24:19', + 'docstatus': 0, + 'modified': '2012-01-24 10:24:19', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all DocType + { + 'colour': 'White:FFF', + 'doctype': 'DocType', + 'istable': 1, + 'module': 'Website', + 'name': '__common__', + 'section_style': 'Simple', + 'show_in_menu': 0, + 'version': 1 + }, + + # These values are common for all DocField + { + 'doctype': 'DocField', + 'name': '__common__', + 'parent': 'Top Bar Item', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0 + }, + + # DocType, Top Bar Item + { + 'doctype': 'DocType', + 'name': 'Top Bar Item' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'label', + 'fieldtype': 'Data', + 'label': 'Label' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'std_page', + 'fieldtype': 'Select', + 'label': 'Std Page', + 'options': 'Home\nAbout\nContact\nProduct\nCustomer\nBlog\nPartner\nCareer\nCustom' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'custom_page', + 'fieldtype': 'Link', + 'label': 'Custom Page', + 'options': 'Web Page' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'parent_label', + 'fieldtype': 'Select', + 'label': 'Parent Label' + } +] \ No newline at end of file diff --git a/erpnext/website/doctype/top_bar_settings/__init__.py b/erpnext/website/doctype/top_bar_settings/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt b/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt new file mode 100644 index 00000000000..d65146106a9 --- /dev/null +++ b/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt @@ -0,0 +1,99 @@ +# DocType, Top Bar Settings +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-24 10:21:41', + 'docstatus': 0, + 'modified': '2012-01-24 10:45:02', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all DocType + { + '_last_update': '1327380941', + 'allow_attach': 1, + 'colour': 'White:FFF', + 'doctype': 'DocType', + 'document_type': 'Other', + 'issingle': 1, + 'max_attachments': 1, + 'module': 'Website', + 'name': '__common__', + 'section_style': 'Simple', + 'show_in_menu': 0, + 'version': 3 + }, + + # These values are common for all DocField + { + 'doctype': 'DocField', + 'name': '__common__', + 'parent': 'Top Bar Settings', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0 + }, + + # These values are common for all DocPerm + { + 'create': 1, + 'doctype': 'DocPerm', + 'name': '__common__', + 'parent': 'Top Bar Settings', + 'parentfield': 'permissions', + 'parenttype': 'DocType', + 'permlevel': 0, + 'read': 1, + 'write': 1 + }, + + # DocType, Top Bar Settings + { + 'doctype': 'DocType', + 'name': 'Top Bar Settings' + }, + + # DocPerm + { + 'doctype': 'DocPerm', + 'role': 'System Manager' + }, + + # DocPerm + { + 'doctype': 'DocPerm', + 'role': 'Website Manager' + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag', + 'doctype': 'DocField', + 'fieldname': 'brand_html', + 'fieldtype': 'Text', + 'label': 'Brand HTML' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'top_bar_items', + 'fieldtype': 'Table', + 'label': 'Top Bar Items', + 'options': 'Top Bar Item' + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'file_list', + 'fieldtype': 'Text', + 'hidden': 1, + 'label': 'File List', + 'no_copy': 1, + 'print_hide': 1 + } +] \ No newline at end of file diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js new file mode 100644 index 00000000000..49ec7000abd --- /dev/null +++ b/erpnext/website/js/topbar.js @@ -0,0 +1,46 @@ +wn.provide('erpnext.topbar'); +wn.require('lib/css/bootstrap/bootstrap-topbar.css'); +wn.require('lib/js/bootstrap/bootstrap-dropdown.js'); + +/* +\ +*/ + +erpnext.topbar.TopBar = Class.extend({ + init: function() { + this.make(); + $('.brand').html(wn.boot.topbar.brand_html); + this.make_items(); + }, + make: function() { + $('header').append('
\ +
\ +
\ + [brand]\ + \ + \ + \ +
\ +
\ +
'); + }, + make_items: function() { + var items = wn.boot.topbaritems + for(var i=0;i\ + %(label)s', item)) + } + } + } +}); + +erpnext.topbar.topbar = new erpnext.topbar.TopBar(); \ No newline at end of file diff --git a/index.html b/index.html index 371a7126bf5..bd74560508a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext -
diff --git a/js/app.js b/js/app.js index 4a276622365..6b724513893 100644 --- a/js/app.js +++ b/js/app.js @@ -7,6 +7,7 @@ wn.app = { version: '2.' + window._version_number } +wn.modules_path = 'erpnext'; wn.settings.no_history = true; wn.require('lib/js/lib/jquery.min.js'); diff --git a/templates/index.html b/templates/index.html index 4a24783dbae..84f05453d5f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,6 +15,7 @@ Loading... +
diff --git a/version.num b/version.num index d55f9f7457c..a3090d211bb 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -136 \ No newline at end of file +168 \ No newline at end of file From 5b9270981c044a592ab62c725b6de99ab417b788 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 24 Jan 2012 15:16:06 +0530 Subject: [PATCH 16/70] added css: --- erpnext/startup/startup.js | 1 + index.html | 2 +- version.num | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 9171d8a6a6a..fe31eab15df 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -15,6 +15,7 @@ erpnext.startup.start = function() { if(user == 'Guest'){ $dh(page_body.left_sidebar); + wn.require('erpnext/website/css/website.css'); wn.require('erpnext/website/js/topbar.js'); } else { // modules diff --git a/index.html b/index.html index 8662485afe2..eddf8de0d03 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ ERPNext - -
- diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 84f05453d5f..00000000000 --- a/templates/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - ERPNext - - - - -
-
- -
- -
- Loading... -
-
-
- -
- diff --git a/version.num b/version.num index 8bc94cb7604..95738485793 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -276 \ No newline at end of file +326 \ No newline at end of file From 9c69914cf677193381c6dfcb311283d3f3be47f9 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 1 Feb 2012 15:03:54 +0530 Subject: [PATCH 30/70] todo fix --- erpnext/home/page/event_updates/event_updates.js | 1 + version.num | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index 1ce83dfcebe..784577a2742 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -401,6 +401,7 @@ HomeToDo.prototype.save = function(btn) { return; } + det.name = d.det.name; var callback = function(r,rt) { btn.done_working(); me.widget.dialog.hide(); diff --git a/version.num b/version.num index 95738485793..98c1572f67e 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -326 \ No newline at end of file +327 \ No newline at end of file From d47e1d14b7f5eecde1e46457a57fdb6bf78f9dae Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 1 Feb 2012 18:02:33 +0530 Subject: [PATCH 31/70] added related page and other cleanups --- erpnext/website/css/website.css | 9 ++++ .../about_us_settings/about_us_settings.py | 1 + erpnext/website/doctype/blog/template.html | 1 + .../contact_us_settings.py | 1 + .../doctype/home_settings/template.html | 2 +- .../website/doctype/related_page/__init__.py | 0 .../doctype/related_page/related_page.txt | 49 +++++++++++++++++++ .../website/doctype/web_page/template.html | 10 +++- erpnext/website/doctype/web_page/web_page.py | 27 ++++++++-- erpnext/website/doctype/web_page/web_page.txt | 28 +++++++++-- version.num | 2 +- 11 files changed, 121 insertions(+), 9 deletions(-) create mode 100644 erpnext/website/doctype/related_page/__init__.py create mode 100644 erpnext/website/doctype/related_page/related_page.txt diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index c653c3be4fb..146599bb278 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -3,6 +3,10 @@ margin: auto; } +.layout_wrapper { + padding: 20px; +} + footer { width: 900px; margin: auto; @@ -12,6 +16,11 @@ header .topbar .container { margin: auto; } +.web-home-banner { + width: 860px; + margin-bottom: 20px +} + .web-content input[type="text"], .web-content input[type="password"], .web-content select { min-width: 180px; } diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.py b/erpnext/website/doctype/about_us_settings/about_us_settings.py index 31a26ce0311..8a31ff098e2 100644 --- a/erpnext/website/doctype/about_us_settings/about_us_settings.py +++ b/erpnext/website/doctype/about_us_settings/about_us_settings.py @@ -20,4 +20,5 @@ class DocType: for t in self.doc.about_team: t['bio'] = markdown2.markdown(t['bio']) + webnotes.conn.set_value('Page', 'about', 'title', self.doc.headline) webnotes.conn.set_value('Page', 'about', 'content', make_template(self.doc, path)) diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html index 8a22cc2ef33..80b030ae9c0 100644 --- a/erpnext/website/doctype/blog/template.html +++ b/erpnext/website/doctype/blog/template.html @@ -7,6 +7,7 @@ {{ doc.content_html }}
diff --git a/erpnext/website/doctype/contact_us_settings/contact_us_settings.py b/erpnext/website/doctype/contact_us_settings/contact_us_settings.py index 65d50dbf7ea..d2fc3c4c49c 100644 --- a/erpnext/website/doctype/contact_us_settings/contact_us_settings.py +++ b/erpnext/website/doctype/contact_us_settings/contact_us_settings.py @@ -13,4 +13,5 @@ class DocType: import os path = os.path.join(os.path.dirname(__file__), 'template.html') + webnotes.conn.set_value('Page', 'contact', 'title', self.doc.headline) webnotes.conn.set_value('Page', 'contact', 'content', make_template(self.doc, path)) diff --git a/erpnext/website/doctype/home_settings/template.html b/erpnext/website/doctype/home_settings/template.html index d43f1efb7f0..8129a509ba0 100644 --- a/erpnext/website/doctype/home_settings/template.html +++ b/erpnext/website/doctype/home_settings/template.html @@ -4,7 +4,7 @@

{{ doc.headline }}

{% endif %} {% if doc.banner %} - + {% endif %}
{{ doc.main_section_html }} diff --git a/erpnext/website/doctype/related_page/__init__.py b/erpnext/website/doctype/related_page/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/website/doctype/related_page/related_page.txt b/erpnext/website/doctype/related_page/related_page.txt new file mode 100644 index 00000000000..3cb674fd53c --- /dev/null +++ b/erpnext/website/doctype/related_page/related_page.txt @@ -0,0 +1,49 @@ +# DocType, Related Page +[ + + # These values are common in all dictionaries + { + 'creation': '2012-02-01 16:16:47', + 'docstatus': 0, + 'modified': '2012-02-01 16:16:48', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all DocType + { + 'colour': 'White:FFF', + 'doctype': 'DocType', + 'istable': 1, + 'module': 'Website', + 'name': '__common__', + 'section_style': 'Simple', + 'show_in_menu': 0, + 'version': 1 + }, + + # These values are common for all DocField + { + 'doctype': 'DocField', + 'fieldname': 'page', + 'fieldtype': 'Link', + 'label': 'Page', + 'name': '__common__', + 'options': 'Page', + 'parent': 'Related Page', + 'parentfield': 'fields', + 'parenttype': 'DocType', + 'permlevel': 0 + }, + + # DocType, Related Page + { + 'doctype': 'DocType', + 'name': 'Related Page' + }, + + # DocField + { + 'doctype': 'DocField' + } +] \ No newline at end of file diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html index 8b0049beda0..c6e20144bc6 100644 --- a/erpnext/website/doctype/web_page/template.html +++ b/erpnext/website/doctype/web_page/template.html @@ -4,10 +4,18 @@
{{ doc.main_section_html }} + {% if doc.next_page_html %} + {{ doc.next_page_html }} + {% endif %}
{{ doc.side_section_html }} + {% if doc.see_also %} +

See Also

+ {{ doc.see_also }} + {% endif %} +
+
-
\ No newline at end of file diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index d2ad6d34a52..754d3b8c5e3 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -18,13 +18,34 @@ class DocType: website.utils.markdown(self.doc, ['main_section', 'side_section']) + self.add_page_links() + with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f: p.content = Template(f.read()).render(doc=self.doc) p.save() website.utils.add_guest_access_to_page(p.name) + self.cleanup_temp() + + def add_page_links(self): + """add links for next_page and see_also""" + if self.doc.next_page: + self.doc.next_page_html = """
+

Next: + %(title)s

""" % {"name":self.doc.next_page, \ + "title": webnotes.conn.get_value("Page", self.doc.next_page, "title")} + + self.doc.see_also = '' + for l in webnotes.conn.sql("""select distinct t1.page, t2.title from + `tabRelated Page` t1, tabPage t2 where + t1.page = t2.name order by t2.title""", as_dict=1): + self.doc.see_also += """

%(title)s

""" % l - del self.doc.fields['main_section_html'] - del self.doc.fields['side_section_html'] - \ No newline at end of file + def cleanup_temp(self): + """cleanup temp fields""" + fl = ['main_section_html', 'side_section_html', 'see_also', 'next_page_html'] + for f in fl: + if f in self.doc.fields: + del self.doc.fields[f] + \ No newline at end of file diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt index aa08a8eb9f3..e2c839abd39 100644 --- a/erpnext/website/doctype/web_page/web_page.txt +++ b/erpnext/website/doctype/web_page/web_page.txt @@ -5,14 +5,14 @@ { 'creation': '2012-01-31 15:18:49', 'docstatus': 0, - 'modified': '2012-01-31 15:48:50', + 'modified': '2012-02-01 16:19:39', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1328003330', + '_last_update': '1328093309', 'allow_attach': 1, 'colour': 'White:FFF', 'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n', @@ -22,7 +22,7 @@ 'name': '__common__', 'section_style': 'Simple', 'show_in_menu': 0, - 'version': 3 + 'version': 5 }, # These values are common for all DocField @@ -97,6 +97,28 @@ 'label': 'Side Section' }, + # DocField + { + 'colour': 'White:FFF', + 'description': 'Link for next page appears at the bottom of the page', + 'doctype': 'DocField', + 'fieldname': 'next_page', + 'fieldtype': 'Link', + 'label': 'Next Page', + 'options': 'Page' + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'Related pages appear on the right side of the link and are linked both ways.', + 'doctype': 'DocField', + 'fieldname': 'related_pages', + 'fieldtype': 'Table', + 'label': 'Related Pages', + 'options': 'Related Page' + }, + # DocField { 'doctype': 'DocField', diff --git a/version.num b/version.num index 98c1572f67e..cfd6ea5ae43 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -327 \ No newline at end of file +335 \ No newline at end of file From 7018b19f426cfd8589f95813efd4e2c8c9d9e046 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 2 Feb 2012 13:42:28 +0530 Subject: [PATCH 32/70] added website settings, refactored home --- erpnext/patches/jan_mar_2012/website.py | 5 +- erpnext/startup/event_handlers.py | 7 +- erpnext/startup/modules.js | 17 +- erpnext/startup/startup.css | 8 +- erpnext/startup/startup.js | 6 + .../website/Module Def/Website/Website.txt | 34 ++-- erpnext/website/css/website.css | 19 ++- erpnext/website/doctype/blog/blog.py | 2 +- erpnext/website/doctype/blog/template.html | 2 +- .../doctype/home_settings/home_settings.py | 17 -- .../doctype/home_settings/home_settings.txt | 118 ------------- .../doctype/home_settings/template.html | 17 -- .../__init__.py | 0 .../style_settings/custom_template.css | 31 ++++ .../doctype/style_settings/style_settings.js | 6 + .../doctype/style_settings/style_settings.py | 17 ++ .../doctype/style_settings/style_settings.txt | 156 ++++++++++++++++++ .../website/doctype/web_page/template.html | 7 +- erpnext/website/doctype/web_page/web_page.py | 5 +- erpnext/website/doctype/web_page/web_page.txt | 16 +- .../__init__.py | 0 .../website_settings/website_settings.py | 20 +++ .../website_settings.txt} | 40 ++++- erpnext/website/js/topbar.js | 11 +- erpnext/website/page/home/__init__.py | 0 erpnext/website/page/home/home.txt | 42 ----- version.num | 2 +- 27 files changed, 349 insertions(+), 256 deletions(-) delete mode 100644 erpnext/website/doctype/home_settings/home_settings.py delete mode 100644 erpnext/website/doctype/home_settings/home_settings.txt delete mode 100644 erpnext/website/doctype/home_settings/template.html rename erpnext/website/doctype/{home_settings => style_settings}/__init__.py (100%) create mode 100644 erpnext/website/doctype/style_settings/custom_template.css create mode 100644 erpnext/website/doctype/style_settings/style_settings.js create mode 100644 erpnext/website/doctype/style_settings/style_settings.py create mode 100644 erpnext/website/doctype/style_settings/style_settings.txt rename erpnext/website/doctype/{top_bar_settings => website_settings}/__init__.py (100%) create mode 100644 erpnext/website/doctype/website_settings/website_settings.py rename erpnext/website/doctype/{top_bar_settings/top_bar_settings.txt => website_settings/website_settings.txt} (72%) delete mode 100644 erpnext/website/page/home/__init__.py delete mode 100644 erpnext/website/page/home/home.txt diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py index 55a1aefabe2..29209bc7405 100644 --- a/erpnext/patches/jan_mar_2012/website.py +++ b/erpnext/patches/jan_mar_2012/website.py @@ -11,8 +11,8 @@ def execute(): from webnotes.modules import reload_doc reload_doc('website', 'Role', 'Website Manager') reload_doc('website', 'Module Def', 'Website') - reload_doc('website', 'doctype', 'home_settings') - reload_doc('website', 'doctype', 'top_bar_settings') + reload_doc('website', 'doctype', 'website_settings') + reload_doc('website', 'doctype', 'style_settings') reload_doc('website', 'doctype', 'top_bar_item') reload_doc('website', 'doctype', 'contact_us_settings') reload_doc('website', 'doctype', 'about_us_settings') @@ -22,7 +22,6 @@ def execute(): reload_doc('website', 'doctype', 'product') reload_doc('website', 'doctype', 'web_page') - reload_doc('website', 'page', 'home') reload_doc('website', 'page', 'contact') reload_doc('website', 'page', 'about') reload_doc('website', 'page', 'blog') diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 1bdbcb4b099..d9fb4511a83 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -40,10 +40,11 @@ def boot_session(bootinfo): import webnotes.model.doc if webnotes.session['user']=='Guest': - bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings') - bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page, + bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings') + bootinfo['website_menus'] = webnotes.conn.sql("""select label, std_page, custom_page, parent_label, parentfield - from `tabTop Bar Item` where parent='Top Bar Settings' order by idx asc""", as_dict=1) + 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 '' else: bootinfo['letter_heads'] = get_letter_heads() diff --git a/erpnext/startup/modules.js b/erpnext/startup/modules.js index 9503dbe70de..c22aee00b25 100644 --- a/erpnext/startup/modules.js +++ b/erpnext/startup/modules.js @@ -55,7 +55,7 @@ pscript.select_sidebar_menu = function(t, dt, dn) { var body_background = '#e2e2e2'; MenuPointer = function(parent, label) { - + var me = this; this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'}); $br(this.wrapper, '3px'); @@ -73,8 +73,10 @@ MenuPointer = function(parent, label) { $(this.wrapper) .hover( - function() { if(!this.selected)$bg(this, '#eee'); } , - function() { if(!this.selected)$bg(this, body_background); } + function() { if(!me.selected) + $bg(this, '#eee'); } , + function() { if(!me.selected) + $bg(this, body_background); } ) $y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'}); @@ -84,9 +86,10 @@ MenuPointer = function(parent, label) { // ==================================================================== MenuPointer.prototype.select = function(grey) { - $y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'}); - //$gr(this.wrapper, '#F84', '#F63'); - $gr(this.wrapper, '#888', '#666'); + $y($td(this.tab, 0, 0), { + color:'#fff', borderBottom:'0px solid #000' + }); + $(this.wrapper).css('background-color', '#999'); this.selected = 1; if(cur_menu_pointer && cur_menu_pointer != this) @@ -99,7 +102,7 @@ MenuPointer.prototype.select = function(grey) { MenuPointer.prototype.deselect = function() { $y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'}); - $gr(this.wrapper, body_background, body_background); + $(this.wrapper).css('background-color', body_background); this.selected = 0; } diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css index 24d380053bf..4f665190ee8 100644 --- a/erpnext/startup/startup.css +++ b/erpnext/startup/startup.css @@ -1,13 +1,17 @@ -h1, h2, h3, h4 { +h1, h2, h3, h4, h5 { font-family: Tahoma, Arial, Verdana, sans-serif; font-weight: bold; } -body, span, div, td, input, textarea, button, select { +body { font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 12px; } +span, div, td, input, textarea, button, select { + font-family: inherit; +} + body { background-color: #e2e2e2; } diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 70dcfc44f58..cbb03a1fba5 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -19,6 +19,12 @@ erpnext.startup.start = function() { $dh(page_body.left_sidebar); wn.require('erpnext/website/css/website.css'); wn.require('erpnext/website/js/topbar.js'); + if(wn.boot.custom_css) { + set_style(wn.boot.custom_css); + } + if(wn.boot.website_settings.title_prefix) { + wn.title_prefix = wn.boot.website_settings.title_prefix; + } } else { // modules wn.require('erpnext/startup/modules.js'); diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt index 8ac31c73619..e4238699e06 100644 --- a/erpnext/website/Module Def/Website/Website.txt +++ b/erpnext/website/Module Def/Website/Website.txt @@ -5,7 +5,7 @@ { 'creation': '2012-01-23 17:05:32', 'docstatus': 0, - 'modified': '2012-01-31 15:19:28', + 'modified': '2012-02-02 13:23:41', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -44,14 +44,6 @@ 'name': 'Website' }, - # Module Def Item - { - 'display_name': 'Top Bar Settings', - 'doc_name': 'Top Bar Settings', - 'doc_type': 'Single DocType', - 'doctype': 'Module Def Item' - }, - # Module Def Item { 'display_name': 'Web Page', @@ -76,6 +68,22 @@ 'doctype': 'Module Def Item' }, + # Module Def Item + { + 'display_name': 'Style Settings', + 'doc_name': 'Style Settings', + 'doc_type': 'Single DocType', + 'doctype': 'Module Def Item' + }, + + # Module Def Item + { + 'display_name': 'Website Settings', + 'doc_name': 'Website Settings', + 'doc_type': 'Single DocType', + 'doctype': 'Module Def Item' + }, + # Module Def Item { 'display_name': 'Home Settings', @@ -100,14 +108,6 @@ 'doctype': 'Module Def Item' }, - # Module Def Item - { - 'display_name': 'About Us Settings', - 'doc_name': 'About Us Settings', - 'doc_type': 'Single DocType', - 'doctype': 'Module Def Item' - }, - # Module Def Item { 'display_name': 'Products Settings', diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index 146599bb278..cdea0877015 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -7,6 +7,10 @@ padding: 20px; } +h1 { + margin-bottom: 15px; +} + footer { width: 900px; margin: auto; @@ -16,8 +20,7 @@ header .topbar .container { margin: auto; } -.web-home-banner { - width: 860px; +.web-head-section { margin-bottom: 20px } @@ -40,9 +43,13 @@ header .topbar .container { overflow-x: hidden; } +footer { + color: #777; +} + .web-footer { + color: inherit; text-align: center; - color: #777; margin: 10px; line-height: 1.7; } @@ -54,11 +61,11 @@ header .topbar .container { .web-footer-menu { margin-bottom: 7px; } -.web-footer a, .web-footer a:visited { +footer a, footer a:visited { color: #777; } -.web-footer a:hover { +footer a:hover { background-color: #777; color: #fff; } @@ -75,5 +82,5 @@ header .topbar .container { } .web-footer-menu ul li:last-child { - border-right: 0px solid #777; + border-right: 0px solid #777 !important; } \ No newline at end of file diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index e9c0d744489..05391eecdeb 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -30,7 +30,7 @@ class DocType(): with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f: p.script = Template(f.read()).render(doc=self.doc) - + p.save() website.utils.add_guest_access_to_page(p.name) diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html index 80b030ae9c0..8c33d83cae7 100644 --- a/erpnext/website/doctype/blog/template.html +++ b/erpnext/website/doctype/blog/template.html @@ -1,9 +1,9 @@

Blog

-

{{ doc.title }}

+
{{ doc.content_html }}
diff --git a/erpnext/website/doctype/home_settings/home_settings.py b/erpnext/website/doctype/home_settings/home_settings.py deleted file mode 100644 index 520b81008fc..00000000000 --- a/erpnext/website/doctype/home_settings/home_settings.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -generate html -""" -import webnotes - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl - - def on_update(self): - """make home html""" - from website.utils import make_template - import os - path = os.path.join(os.path.dirname(__file__), 'template.html') - - webnotes.conn.set_value('Page', 'home', 'content', make_template(self.doc, path)) - \ No newline at end of file diff --git a/erpnext/website/doctype/home_settings/home_settings.txt b/erpnext/website/doctype/home_settings/home_settings.txt deleted file mode 100644 index 413f63fcc4c..00000000000 --- a/erpnext/website/doctype/home_settings/home_settings.txt +++ /dev/null @@ -1,118 +0,0 @@ -# DocType, Home Settings -[ - - # These values are common in all dictionaries - { - 'creation': '2012-01-24 15:56:06', - 'docstatus': 0, - 'modified': '2012-01-25 13:31:56', - 'modified_by': 'Administrator', - 'owner': 'Administrator' - }, - - # These values are common for all DocType - { - '_last_update': '1327476129', - 'allow_attach': 1, - 'colour': 'White:FFF', - 'doctype': 'DocType', - 'issingle': 1, - 'max_attachments': 5, - 'module': 'Website', - 'name': '__common__', - 'section_style': 'Simple', - 'show_in_menu': 0, - 'version': 4 - }, - - # These values are common for all DocField - { - 'doctype': 'DocField', - 'name': '__common__', - 'parent': 'Home Settings', - 'parentfield': 'fields', - 'parenttype': 'DocType', - 'permlevel': 0 - }, - - # These values are common for all DocPerm - { - 'create': 1, - 'doctype': 'DocPerm', - 'name': '__common__', - 'parent': 'Home Settings', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'permlevel': 0, - 'read': 1, - 'write': 1 - }, - - # DocType, Home Settings - { - 'doctype': 'DocType', - 'name': 'Home Settings' - }, - - # DocPerm - { - 'doctype': 'DocPerm', - 'role': 'System Manager' - }, - - # DocPerm - { - 'doctype': 'DocPerm', - 'role': 'Website Manager' - }, - - # DocField - { - 'colour': 'White:FFF', - 'description': 'HTML that will appear on the top part of the home page. For no headline, leave blank', - 'doctype': 'DocField', - 'fieldname': 'headline', - 'fieldtype': 'Text', - 'label': 'Headline' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'banner', - 'fieldtype': 'Select', - 'label': 'Banner', - 'options': 'attach_files:' - }, - - # DocField - { - 'colour': 'White:FFF', - 'description': 'For formatting, use \nmarkdown', - 'doctype': 'DocField', - 'fieldname': 'main_section', - 'fieldtype': 'Code', - 'label': 'Main Section' - }, - - # DocField - { - 'colour': 'White:FFF', - 'description': 'For formatting, use \nmarkdown', - 'doctype': 'DocField', - 'fieldname': 'side_section', - 'fieldtype': 'Code', - 'label': 'Side Section' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'file_list', - 'fieldtype': 'Text', - 'hidden': 1, - 'label': 'File List', - 'no_copy': 1, - 'print_hide': 1 - } -] \ No newline at end of file diff --git a/erpnext/website/doctype/home_settings/template.html b/erpnext/website/doctype/home_settings/template.html deleted file mode 100644 index 8129a509ba0..00000000000 --- a/erpnext/website/doctype/home_settings/template.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- {% if doc.headline %} -

{{ doc.headline }}

- {% endif %} - {% if doc.banner %} - - {% endif %} -
- {{ doc.main_section_html }} -
-
- {{ doc.side_section_html }} -
-
-
-
\ No newline at end of file diff --git a/erpnext/website/doctype/home_settings/__init__.py b/erpnext/website/doctype/style_settings/__init__.py similarity index 100% rename from erpnext/website/doctype/home_settings/__init__.py rename to erpnext/website/doctype/style_settings/__init__.py diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css new file mode 100644 index 00000000000..e6eeeb34fac --- /dev/null +++ b/erpnext/website/doctype/style_settings/custom_template.css @@ -0,0 +1,31 @@ +body { +{% if doc.background_image %} + background: url("files/{{ doc.background_image }}") repeat !important; +{% elif doc.background_color %} + background-color: #{{ doc.background_color }}; +{% endif %} +{% if doc.font %} + font-family: {{ doc.font }} !important; +{% endif %} +{% if doc.font_size %} + font-size: {{ doc.font_size }} !important; +{% endif %} +} + +{% if doc.footer_font_color %} +footer { + color: {{ doc.footer_font_color }}; +} +footer a, footer a:visited, footer a:hover { + color: {{ doc.footer_font_color }}; +} +.web-footer-menu ul li { + border-right: 1px solid {{ doc.footer_font_color }}; +} +{% endif %} + +{% if doc.heading_font %} +h1, h2, h3, h4, h5 { + font-family: {{ doc.heading_font}} !important; +} +{% endif %} diff --git a/erpnext/website/doctype/style_settings/style_settings.js b/erpnext/website/doctype/style_settings/style_settings.js new file mode 100644 index 00000000000..95c4143c728 --- /dev/null +++ b/erpnext/website/doctype/style_settings/style_settings.js @@ -0,0 +1,6 @@ +wn.require('lib/js/lib/jscolor/jscolor.js'); + +cur_frm.cscript.onload_post_render = function() { + cur_frm.fields_dict.background_color.input.className = 'color'; + jscolor.bind(); +} \ No newline at end of file diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py new file mode 100644 index 00000000000..4aefbf6bf9d --- /dev/null +++ b/erpnext/website/doctype/style_settings/style_settings.py @@ -0,0 +1,17 @@ +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl + + def validate(self): + """make custom css""" + from jinja2 import Template + + with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f: + temp = Template(f.read()) + + self.doc.custom_css = temp.render(doc = self.doc) + + from webnotes.session_cache import clear_cache + clear_cache('Guest') + + \ No newline at end of file diff --git a/erpnext/website/doctype/style_settings/style_settings.txt b/erpnext/website/doctype/style_settings/style_settings.txt new file mode 100644 index 00000000000..f07a9479ca1 --- /dev/null +++ b/erpnext/website/doctype/style_settings/style_settings.txt @@ -0,0 +1,156 @@ +# DocType, Style Settings +[ + + # These values are common in all dictionaries + { + 'creation': '2012-02-02 09:57:25', + 'docstatus': 0, + 'modified': '2012-02-02 10:47:38', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all DocType + { + '_last_update': '1328159294', + 'allow_attach': 1, + 'colour': 'White:FFF', + 'description': 'Set your background color, font and image (tiled)', + 'doctype': 'DocType', + 'issingle': 1, + 'max_attachments': 1, + 'module': 'Website', + 'name': '__common__', + 'section_style': 'Simple', + 'show_in_menu': 0, + 'version': 9 + }, + + # These values are common for all DocField + { + 'doctype': 'DocField', + 'name': '__common__', + 'parent': 'Style Settings', + 'parentfield': 'fields', + 'parenttype': 'DocType' + }, + + # These values are common for all DocPerm + { + 'doctype': 'DocPerm', + 'name': '__common__', + 'parent': 'Style Settings', + 'parentfield': 'permissions', + 'parenttype': 'DocType', + 'read': 1, + 'role': 'Website Manager' + }, + + # DocType, Style Settings + { + 'doctype': 'DocType', + 'name': 'Style Settings' + }, + + # DocPerm + { + 'create': 1, + 'doctype': 'DocPerm', + 'permlevel': 0, + 'write': 1 + }, + + # DocPerm + { + 'doctype': 'DocPerm', + 'permlevel': 1 + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'Solid background color (default light gray)', + 'doctype': 'DocField', + 'fieldname': 'background_color', + 'fieldtype': 'Data', + 'label': 'Background Color', + 'permlevel': 0 + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'If image is selected, color will be ignored (attach first)', + 'doctype': 'DocField', + 'fieldname': 'background_image', + 'fieldtype': 'Select', + 'label': 'Background Image', + 'options': 'attach_files:', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'font', + 'fieldtype': 'Select', + 'label': 'Font', + 'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'font_size', + 'fieldtype': 'Select', + 'label': 'Font Size', + 'options': '\n12px\n13px\n14px', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'heading_font', + 'fieldtype': 'Select', + 'label': 'Heaing Font', + 'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma', + 'permlevel': 0 + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'Select a white footer foreground color if you have a dark background', + 'doctype': 'DocField', + 'fieldname': 'footer_font_color', + 'fieldtype': 'Select', + 'label': 'Footer Font Color', + 'options': '\nwhite', + 'permlevel': 0 + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'Auto generated', + 'doctype': 'DocField', + 'fieldname': 'custom_css', + 'fieldtype': 'Code', + 'label': 'Custom CSS', + 'permlevel': 1 + }, + + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'file_list', + 'fieldtype': 'Text', + 'hidden': 1, + 'label': 'File List', + 'no_copy': 1, + 'permlevel': 0, + 'print_hide': 1 + } +] \ No newline at end of file diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html index c6e20144bc6..faacca1566a 100644 --- a/erpnext/website/doctype/web_page/template.html +++ b/erpnext/website/doctype/web_page/template.html @@ -1,7 +1,10 @@
-

{{ doc.title }}

-
+ {% if doc.head_section %} +
+ {{ doc.head_section_html }} +
+ {% endif %}
{{ doc.main_section_html }} {% if doc.next_page_html %} diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index 754d3b8c5e3..14a082b0910 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -16,7 +16,7 @@ class DocType: from jinja2 import Template import os - website.utils.markdown(self.doc, ['main_section', 'side_section']) + website.utils.markdown(self.doc, ['head_section','main_section', 'side_section']) self.add_page_links() @@ -44,7 +44,8 @@ class DocType: def cleanup_temp(self): """cleanup temp fields""" - fl = ['main_section_html', 'side_section_html', 'see_also', 'next_page_html'] + fl = ['main_section_html', 'side_section_html', 'see_also', \ + 'next_page_html', 'head_section_html'] for f in fl: if f in self.doc.fields: del self.doc.fields[f] diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt index e2c839abd39..0bacc43d67f 100644 --- a/erpnext/website/doctype/web_page/web_page.txt +++ b/erpnext/website/doctype/web_page/web_page.txt @@ -5,14 +5,14 @@ { 'creation': '2012-01-31 15:18:49', 'docstatus': 0, - 'modified': '2012-02-01 16:19:39', + 'modified': '2012-02-02 13:15:36', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1328093309', + '_last_update': '1328093379', 'allow_attach': 1, 'colour': 'White:FFF', 'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n', @@ -22,7 +22,7 @@ 'name': '__common__', 'section_style': 'Simple', 'show_in_menu': 0, - 'version': 5 + 'version': 6 }, # These values are common for all DocField @@ -77,6 +77,16 @@ 'reqd': 1 }, + # DocField + { + 'colour': 'White:FFF', + 'description': 'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px', + 'doctype': 'DocField', + 'fieldname': 'head_section', + 'fieldtype': 'Text', + 'label': 'Head Section' + }, + # DocField { 'colour': 'White:FFF', diff --git a/erpnext/website/doctype/top_bar_settings/__init__.py b/erpnext/website/doctype/website_settings/__init__.py similarity index 100% rename from erpnext/website/doctype/top_bar_settings/__init__.py rename to erpnext/website/doctype/website_settings/__init__.py diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py new file mode 100644 index 00000000000..0cbc97d24e3 --- /dev/null +++ b/erpnext/website/doctype/website_settings/website_settings.py @@ -0,0 +1,20 @@ +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl + + def validate(self): + """clear cache""" + # set home page + import webnotes + from webnotes.model.doc import Document + + webnotes.conn.sql("""delete from `tabDefault Home Page` where role='Guest'""") + + d = Document('Default Home Page') + d.parent = 'Control Panel' + d.role = 'Guest' + d.home_page = self.doc.home_page + d.save() + + from webnotes.session_cache import clear_cache + clear_cache('Guest') \ No newline at end of file diff --git a/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt similarity index 72% rename from erpnext/website/doctype/top_bar_settings/top_bar_settings.txt rename to erpnext/website/doctype/website_settings/website_settings.txt index ad9a158cc5a..aaa73272576 100644 --- a/erpnext/website/doctype/top_bar_settings/top_bar_settings.txt +++ b/erpnext/website/doctype/website_settings/website_settings.txt @@ -1,18 +1,18 @@ -# DocType, Top Bar Settings +# DocType, Website Settings [ # These values are common in all dictionaries { - 'creation': '2012-01-24 10:21:41', + 'creation': '2012-02-02 13:19:50', 'docstatus': 0, - 'modified': '2012-01-31 15:55:34', + 'modified': '2012-02-02 13:31:24', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1327382102', + '_last_update': '1328169455', 'allow_attach': 1, 'colour': 'White:FFF', 'doctype': 'DocType', @@ -23,14 +23,14 @@ 'name': '__common__', 'section_style': 'Simple', 'show_in_menu': 0, - 'version': 4 + 'version': 3 }, # These values are common for all DocField { 'doctype': 'DocField', 'name': '__common__', - 'parent': 'Top Bar Settings', + 'parent': 'Website Settings', 'parentfield': 'fields', 'parenttype': 'DocType', 'permlevel': 0 @@ -41,7 +41,7 @@ 'create': 1, 'doctype': 'DocPerm', 'name': '__common__', - 'parent': 'Top Bar Settings', + 'parent': 'Website Settings', 'parentfield': 'permissions', 'parenttype': 'DocType', 'permlevel': 0, @@ -49,10 +49,10 @@ 'write': 1 }, - # DocType, Top Bar Settings + # DocType, Website Settings { 'doctype': 'DocType', - 'name': 'Top Bar Settings' + 'name': 'Website Settings' }, # DocPerm @@ -74,6 +74,28 @@ 'label': 'Top Bar' }, + # DocField + { + 'colour': 'White:FFF', + 'description': 'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.', + 'doctype': 'DocField', + 'fieldname': 'title_prefix', + 'fieldtype': 'Data', + 'label': 'Title Prefix' + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'The "Web Page" that is the website home page', + 'doctype': 'DocField', + 'fieldname': 'home_page', + 'fieldtype': 'Link', + 'label': 'Home Page', + 'options': 'Web Page', + 'reqd': 1 + }, + # DocField { 'colour': 'White:FFF', diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index d7cba895545..8a7870c7de6 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -13,14 +13,14 @@ wn.require('lib/js/bootstrap/bootstrap-dropdown.js'); erpnext.topbar.TopBar = Class.extend({ init: function() { this.make(); - $('.brand').html(wn.boot.topbar.brand_html); + $('.brand').html(wn.boot.website_settings.brand_html); this.make_items(); }, make: function() { $('header').append('
\
\
\ - [brand]\ + [brand]\ \ \ @@ -30,9 +30,10 @@ erpnext.topbar.TopBar = Class.extend({
\
\
'); + $('.brand').attr('href', '#!' + (wn.boot.website_settings.home_page || 'Login Page')) }, make_items: function() { - var items = wn.boot.topbaritems + var items = wn.boot.website_menus for(var i=0;i© %(copyright)s
\ \ -
', wn.boot.topbar)); +
', wn.boot.website_settings)); this.make_items(); }, make_items: function() { - var items = wn.boot.topbaritems + var items = wn.boot.website_menus for(var i=0;i Date: Thu, 2 Feb 2012 13:44:28 +0530 Subject: [PATCH 33/70] patch update --- erpnext/patches/jan_mar_2012/website.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py index 29209bc7405..2d25e1f515e 100644 --- a/erpnext/patches/jan_mar_2012/website.py +++ b/erpnext/patches/jan_mar_2012/website.py @@ -5,7 +5,6 @@ from webnotes.model.doc import Document def execute(): add_website_manager() - return cleanup_file_data() update_patch_log() from webnotes.modules import reload_doc From 50e2cfe78eb4f3f46a92da73c607e401e33a0b2f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 2 Feb 2012 16:40:01 +0530 Subject: [PATCH 34/70] dateutil.js/patch fix --- config/conf.py | 7 ------ erpnext/patches/jan_mar_2012/website.py | 29 ++++++++++++++++++------- version.num | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 config/conf.py diff --git a/config/conf.py b/config/conf.py deleted file mode 100644 index 1cf35e21cb8..00000000000 --- a/config/conf.py +++ /dev/null @@ -1,7 +0,0 @@ -index_path = '/' - -include_paths = [ - 'erpnext', - 'lib/py', - 'lib/py/legacy' -] \ No newline at end of file diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py index 2d25e1f515e..4221cea6f29 100644 --- a/erpnext/patches/jan_mar_2012/website.py +++ b/erpnext/patches/jan_mar_2012/website.py @@ -8,24 +8,37 @@ def execute(): cleanup_file_data() update_patch_log() from webnotes.modules import reload_doc - reload_doc('website', 'Role', 'Website Manager') + from webnotes.model import delete_doc + + delete_doc('Website', 'Module Def', 'Website') reload_doc('website', 'Module Def', 'Website') - reload_doc('website', 'doctype', 'website_settings') - reload_doc('website', 'doctype', 'style_settings') - reload_doc('website', 'doctype', 'top_bar_item') - reload_doc('website', 'doctype', 'contact_us_settings') + reload_doc('website', 'Role', 'Website Manager') + + webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'"""): + d = Document('Module Def Role') + d.parent = 'Website' + d.role = 'Website Manager' + d.save() + reload_doc('website', 'doctype', 'about_us_settings') - reload_doc('website', 'doctype', 'products_settings') + reload_doc('website', 'doctype', 'about_us_team') reload_doc('website', 'doctype', 'blog') reload_doc('website', 'doctype', 'blog_subscriber') + reload_doc('website', 'doctype', 'contact_us_settings') reload_doc('website', 'doctype', 'product') + reload_doc('website', 'doctype', 'product_group') + reload_doc('website', 'doctype', 'products_settings') + reload_doc('website', 'doctype', 'related_page') + reload_doc('website', 'doctype', 'style_settings') + reload_doc('website', 'doctype', 'top_bar_item') reload_doc('website', 'doctype', 'web_page') + reload_doc('website', 'doctype', 'website_settings') - reload_doc('website', 'page', 'contact') reload_doc('website', 'page', 'about') reload_doc('website', 'page', 'blog') - reload_doc('website', 'page', 'unsubscribe') + reload_doc('website', 'page', 'contact') reload_doc('website', 'page', 'products') + reload_doc('website', 'page', 'unsubscribe') def add_website_manager(): """add website manager to system manager""" diff --git a/version.num b/version.num index 0a1b63de8b7..db057cf772e 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -353 \ No newline at end of file +354 \ No newline at end of file From adc9a61bd71685cb7c3f28a329f553715bf41af2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 2 Feb 2012 16:45:26 +0530 Subject: [PATCH 35/70] bugfix --- erpnext/patches/jan_mar_2012/website.py | 7 +++++-- version.num | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/website.py index 4221cea6f29..1b4754aef56 100644 --- a/erpnext/patches/jan_mar_2012/website.py +++ b/erpnext/patches/jan_mar_2012/website.py @@ -14,7 +14,7 @@ def execute(): reload_doc('website', 'Module Def', 'Website') reload_doc('website', 'Role', 'Website Manager') - webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'"""): + webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""") d = Document('Module Def Role') d.parent = 'Website' d.role = 'Website Manager' @@ -53,7 +53,10 @@ def add_website_manager(): def cleanup_file_data(): webnotes.conn.commit() - webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""") + try: + webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""") + except: + pass webnotes.conn.begin() def update_patch_log(): diff --git a/version.num b/version.num index db057cf772e..ac471d3ba0c 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -354 \ No newline at end of file +355 \ No newline at end of file From 63d669f390d9b69d731db45dc19dbad1098ff832 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Feb 2012 12:56:12 +0530 Subject: [PATCH 36/70] updated feed for comments and login --- erpnext/home/__init__.py | 28 ++++++++++----- erpnext/home/doctype/feed/feed.txt | 24 ++++++++----- .../home/page/event_updates/event_updates.js | 35 ++++++++++++------- erpnext/patches/jan_mar_2012/latest/feed.py | 6 ++++ .../login.py} | 0 .../jan_mar_2012/{ => latest}/website.py | 0 erpnext/startup/event_handlers.py | 27 ++++++++++---- version.num | 2 +- 8 files changed, 85 insertions(+), 37 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/latest/feed.py rename erpnext/patches/jan_mar_2012/{subdomain_login_patch.py => latest/login.py} (100%) rename erpnext/patches/jan_mar_2012/{ => latest}/website.py (100%) diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index 7059cec7e5f..5ebf7c01647 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -34,23 +34,33 @@ feed_dict = { 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'] } -def make_feed(doc, subject, color): +def make_feed(feedtype, doctype, name, owner, subject, color): "makes a new Feed record" #msgprint(subject) from webnotes.model.doc import Document - webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name)) + + if feedtype in ('Login', 'Comment'): + # delete old login, comment feed + webnotes.conn.sql("""delete from tabFeed where + datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login')""") + else: + # one feed per item + webnotes.conn.sql("""delete from tabFeed + where doc_type=%s and doc_name=%s + and ifnull(feed_type,'') != 'Comment'""", (doctype, name)) + f = Document('Feed') - f.doc_type = doc.doctype - f.doc_name = doc.name + f.owner = owner + f.feed_type = feedtype + f.doc_type = doctype + f.doc_name = name f.subject = subject f.color = color - f.save(1) + f.save() def update_feed(doc, method=None): "adds a new feed" if method=='on_update': subject, color = feed_dict.get(doc.doctype, [None, None]) - if subject: - subject = subject % doc.fields - - make_feed(doc, subject, color) + if subject: + make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color) diff --git a/erpnext/home/doctype/feed/feed.txt b/erpnext/home/doctype/feed/feed.txt index 5aa4f910e46..f239f7c7c86 100644 --- a/erpnext/home/doctype/feed/feed.txt +++ b/erpnext/home/doctype/feed/feed.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2011-04-08 10:50:41', + 'creation': '2011-04-06 18:11:38', 'docstatus': 0, - 'modified': '2011-04-05 09:16:57', + 'modified': '2012-02-03 11:28:16', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -14,18 +14,18 @@ { 'autoname': '_FEED.#####', 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'module': 'Home', 'name': '__common__', 'section_style': 'Simple', 'show_in_menu': 0, - 'version': 1 + 'version': 2 }, # These values are common for all DocField { 'doctype': 'DocField', - 'fieldtype': 'Data', 'name': '__common__', 'parent': 'Feed', 'parentfield': 'fields', @@ -39,11 +39,19 @@ 'name': 'Feed' }, + # DocField + { + 'doctype': 'DocField', + 'fieldname': 'feed_type', + 'fieldtype': 'Select', + 'label': 'Feed Type' + }, + # DocField { 'doctype': 'DocField', 'fieldname': 'doc_type', - 'idx': 1, + 'fieldtype': 'Data', 'label': 'Doc Type' }, @@ -51,7 +59,7 @@ { 'doctype': 'DocField', 'fieldname': 'doc_name', - 'idx': 2, + 'fieldtype': 'Data', 'label': 'Doc Name' }, @@ -59,7 +67,7 @@ { 'doctype': 'DocField', 'fieldname': 'subject', - 'idx': 3, + 'fieldtype': 'Data', 'label': 'Subject' }, @@ -67,7 +75,7 @@ { 'doctype': 'DocField', 'fieldname': 'color', - 'idx': 4, + 'fieldtype': 'Data', 'label': 'Color' } ] \ No newline at end of file diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index 784577a2742..90aef9e6961 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -456,7 +456,7 @@ FeedList.prototype.make_list = function() { this.list = new wn.widgets.Listing({ parent: this.list_area, query: repl('select \ - distinct t1.name, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \ + distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \ concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")) as full_name, \ t1.modified, t1.color \ from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \ @@ -495,13 +495,11 @@ FeedItem = function(cell, det, feedlist) { this.tab = make_table(this.wrapper, 1, 2, '100%', [(100/7)+'%', (600/7)+'%']); $y(this.tab,{tableLayout:'fixed'}) - // image $y($td(this.tab,0,0),{textAlign:'right',paddingRight:'4px'}); // text this.text_area = $a($td(this.tab,0,1), 'div'); - this.render_references(this.text_area, det); - + this.render_references(this.text_area, det); this.render_tag(det); // add day separator @@ -537,13 +535,21 @@ FeedItem.prototype.add_day_sep = function(det) { // ------------------------------------------------- FeedItem.prototype.render_tag = function(det) { + // type is the name tag = $a($td(this.tab,0,0), 'div', '', - {color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px', whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'}); + {color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px', + whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'}); $br(tag,'3px'); $y(tag, {backgroundColor:(det.color || '#273')}); - tag.innerHTML = get_doctype_label(det.doc_type); - tag.dt = det.doc_type; - tag.onclick = function() { loaddocbrowser(this.dt); } + + // tag label + tag.innerHTML = det.feed_type || get_doctype_label(det.doc_type); + + // not comment / label + if(!det.feed_type) { + tag.dt = det.doc_type; + tag.onclick = function() { loaddocbrowser(this.dt); } + } } FeedItem.prototype.render_references = function(div, det) { @@ -552,10 +558,15 @@ FeedItem.prototype.render_references = function(div, det) { var dt = det.doc_type; var dn = det.doc_name // link - var allow = in_list(profile.can_read, dt); - var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null, det.doc_name); - span.dt = dt; span.dn = dn; - if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); } + if(det.feed_type=='Login') { + // nothing - no link + } else { + var allow = in_list(profile.can_read, dt); + var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null, + det.doc_name); + span.dt = dt; span.dn = dn; + if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); } + } // subject if(det.subject) { diff --git a/erpnext/patches/jan_mar_2012/latest/feed.py b/erpnext/patches/jan_mar_2012/latest/feed.py new file mode 100644 index 00000000000..c913c49c181 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/latest/feed.py @@ -0,0 +1,6 @@ +import webnotes +from webnotes.model.doc import Document +from webnotes.modules import reload_doc + +def execute(): + reload_doc('home', 'doctype', 'feed') \ No newline at end of file diff --git a/erpnext/patches/jan_mar_2012/subdomain_login_patch.py b/erpnext/patches/jan_mar_2012/latest/login.py similarity index 100% rename from erpnext/patches/jan_mar_2012/subdomain_login_patch.py rename to erpnext/patches/jan_mar_2012/latest/login.py diff --git a/erpnext/patches/jan_mar_2012/website.py b/erpnext/patches/jan_mar_2012/latest/website.py similarity index 100% rename from erpnext/patches/jan_mar_2012/website.py rename to erpnext/patches/jan_mar_2012/latest/website.py diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index d9fb4511a83..e3e7fa95d57 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -1,18 +1,18 @@ import webnotes import webnotes.defs from webnotes.utils import cint +import home def on_login(login_manager): """ called from login manager, before login """ - try: - if login_manager.user not in ('Guest', None, ''): + if login_manager.user not in ('Guest', None, ''): + try: import server_tools.gateway_utils server_tools.gateway_utils.check_login(login_manager.user) - except ImportError: - pass - + except ImportError: + pass def on_login_post_session(login_manager): """ @@ -29,9 +29,21 @@ def on_login_post_session(login_manager): sid!=%s""", \ (webnotes.session['user'], webnotes.session['sid']), as_list=1) + if webnotes.session['user'] not in ('Guest'): + # create feed + from webnotes.utils import nowtime + home.make_feed('Login', 'Profile', login_manager.user, login_manager.user, + '%s logged in at %s' % (login_manager.user_fullname, nowtime()), + login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D') + +def comment_added(doc): + """add comment to feed""" + import json + home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by, + '"' + doc.comment + '"', '#6B24B3') + def doclist_all(doc, method): """doclist trigger called from webnotes.model.doclist on any event""" - import home home.update_feed(doc, method) def boot_session(bootinfo): @@ -51,5 +63,6 @@ def boot_session(bootinfo): def get_letter_heads(): """load letter heads with startup""" import webnotes - ret = webnotes.conn.sql("select name, content from `tabLetter Head` where ifnull(disabled,0)=0") + ret = webnotes.conn.sql("""select name, content from `tabLetter Head` + where ifnull(disabled,0)=0""") return dict(ret) diff --git a/version.num b/version.num index ac471d3ba0c..2a9c18ad50e 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -355 \ No newline at end of file +357 \ No newline at end of file From b4c814484ee442394395dbe24de153936f7f0ea7 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Feb 2012 13:36:44 +0530 Subject: [PATCH 37/70] fix to patch --- erpnext/patches/jan_mar_2012/latest/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/latest/__init__.py diff --git a/erpnext/patches/jan_mar_2012/latest/__init__.py b/erpnext/patches/jan_mar_2012/latest/__init__.py new file mode 100644 index 00000000000..e69de29bb2d From 479670e4e13587b62b8b231e3540f01404d6ca86 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 3 Feb 2012 16:56:18 +0530 Subject: [PATCH 38/70] added unicode to mysql, fix in about us --- .../website/doctype/about_us_settings/about_us_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.py b/erpnext/website/doctype/about_us_settings/about_us_settings.py index 8a31ff098e2..770f1d2bceb 100644 --- a/erpnext/website/doctype/about_us_settings/about_us_settings.py +++ b/erpnext/website/doctype/about_us_settings/about_us_settings.py @@ -14,11 +14,11 @@ class DocType: path = os.path.join(os.path.dirname(__file__), 'template.html') self.doc.about_team = webnotes.conn.sql("""select * from `tabAbout Us Team` - where parent='About Us Settings'""", as_dict=1) + where parent='About Us Settings' order by idx""", as_dict=1) import markdown2 for t in self.doc.about_team: - t['bio'] = markdown2.markdown(t['bio']) + t['bio'] = markdown2.markdown(t.get('bio') or '') webnotes.conn.set_value('Page', 'about', 'title', self.doc.headline) webnotes.conn.set_value('Page', 'about', 'content', make_template(self.doc, path)) From 6147451da3821a6d4aaeab0dc69e805256f77cb4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 4 Feb 2012 09:53:25 +0530 Subject: [PATCH 39/70] refactored patches, bug fix for assign_to --- .../patches/jan_mar_2012/latest/cleanups.py | 33 +++++++++++++++++++ erpnext/patches/jan_mar_2012/latest/login.py | 21 ------------ .../patches/jan_mar_2012/latest/website.py | 15 --------- version.num | 2 +- 4 files changed, 34 insertions(+), 37 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/latest/cleanups.py diff --git a/erpnext/patches/jan_mar_2012/latest/cleanups.py b/erpnext/patches/jan_mar_2012/latest/cleanups.py new file mode 100644 index 00000000000..44d24c034b7 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/latest/cleanups.py @@ -0,0 +1,33 @@ +import webnotes + +def execute(): + from webnotes.model import delete_doc + delete_doc("DocType", "SSO Control") + delete_doc("DocType", "WN ERP Client Control") + delete_doc("DocType", "Production Tips Common") + delete_doc("DocType", "DocTrigger") + delete_doc("Page", "Setup Wizard") + + # cleanup control panel + delete_doc("DocType", "Control Panel") + reload_doc("core", "doctype", "control_panel") + + # cleanup page + delete_doc("DocType", "Page") + reload_doc("core", "doctype", "page") + + webnotes.conn.sql("""delete from tabSingles + where field like 'startup_%' and doctype='Control Panel'""") + + webnotes.conn.commit() + + # DDLs + # ------------------- + + webnotes.conn.sql("drop table if exists tabDocTrigger") + + try: webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""") + except: pass + + webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""") + \ No newline at end of file diff --git a/erpnext/patches/jan_mar_2012/latest/login.py b/erpnext/patches/jan_mar_2012/latest/login.py index fcf72dc0e47..97cd323d6ae 100644 --- a/erpnext/patches/jan_mar_2012/latest/login.py +++ b/erpnext/patches/jan_mar_2012/latest/login.py @@ -5,28 +5,7 @@ from webnotes.modules import reload_doc def execute(): add_default_home_page() reload_doc('setup','doctype','manage_account') - webnotes.conn.commit() - webnotes.conn.sql("drop table if exists tabDocTrigger") - cleanup() - -def cleanup(): - webnotes.conn.begin() - from webnotes.model import delete_doc - delete_doc("DocType", "SSO Control") - delete_doc("DocType", "WN ERP Client Control") - delete_doc("DocType", "Production Tips Common") - delete_doc("DocType", "DocTrigger") - # cleanup control panel - delete_doc("DocType", "Control Panel") - reload_doc("core", "doctype", "control_panel") - - # cleanup page - delete_doc("DocType", "Page") - reload_doc("core", "doctype", "page") - - webnotes.conn.sql("""delete from tabSingles - where field like 'startup_%' and doctype='Control Panel'""") def add_default_home_page(): if not webnotes.conn.sql("""select name from `tabDefault Home Page` diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/latest/website.py index 1b4754aef56..a6f1310ee09 100644 --- a/erpnext/patches/jan_mar_2012/latest/website.py +++ b/erpnext/patches/jan_mar_2012/latest/website.py @@ -5,8 +5,6 @@ from webnotes.model.doc import Document def execute(): add_website_manager() - cleanup_file_data() - update_patch_log() from webnotes.modules import reload_doc from webnotes.model import delete_doc @@ -50,16 +48,3 @@ def add_website_manager(): d.parent = i[0] d.role = 'Website Manager' d.save(1) - -def cleanup_file_data(): - webnotes.conn.commit() - try: - webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""") - except: - pass - webnotes.conn.begin() - -def update_patch_log(): - webnotes.conn.commit() - webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""") - webnotes.conn.begin() diff --git a/version.num b/version.num index 2a9c18ad50e..b0e9f8d0ff9 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -357 \ No newline at end of file +358 \ No newline at end of file From af1cb632d60cbbac89d2ed66324eab538d6b090c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 07:29:52 +0100 Subject: [PATCH 40/70] bugfix to topbar --- erpnext/website/js/topbar.js | 6 +++--- erpnext/website/utils.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index 8a7870c7de6..90e530d0ded 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -37,7 +37,7 @@ erpnext.topbar.TopBar = Class.extend({ for(var i=0;i%(label)s', item)) } @@ -64,7 +64,7 @@ erpnext.Footer = Class.extend({ for(var i=0;i%(label)s', item)) } @@ -72,4 +72,4 @@ erpnext.Footer = Class.extend({ } }); -erpnext.footer = new erpnext.Footer(); \ No newline at end of file +erpnext.footer = new erpnext.Footer(); diff --git a/erpnext/website/utils.py b/erpnext/website/utils.py index 330f7a39a47..66be4d2bb5f 100644 --- a/erpnext/website/utils.py +++ b/erpnext/website/utils.py @@ -25,7 +25,8 @@ def markdown(doc, fields): def page_name(title): """make page name from title, and check that there is no duplicate""" import re - name = re.sub('[~!@#$%^&*()<>,."\']', '', title.lower()) + name = title.lower() + name = re.sub('[~!@#$%^&*()<>,."\']', '', name) return '-'.join(name.split()[:4]) def add_page(title): @@ -50,4 +51,4 @@ def add_guest_access_to_page(page): d = Document('Page Role') d.parent = page d.role = 'Guest' - d.save() \ No newline at end of file + d.save() From 594a0ca11d2acfe88c650f9b94bd2d085d5c068f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 12:52:15 +0530 Subject: [PATCH 41/70] fix in related page --- .../doctype/related_page/related_page.txt | 34 +++++++++---------- erpnext/website/doctype/web_page/web_page.py | 11 +++--- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/erpnext/website/doctype/related_page/related_page.txt b/erpnext/website/doctype/related_page/related_page.txt index 3cb674fd53c..67a30b7cf23 100644 --- a/erpnext/website/doctype/related_page/related_page.txt +++ b/erpnext/website/doctype/related_page/related_page.txt @@ -5,45 +5,45 @@ { 'creation': '2012-02-01 16:16:47', 'docstatus': 0, - 'modified': '2012-02-01 16:16:48', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-06 12:24:29', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - 'colour': 'White:FFF', + 'colour': u'White:FFF', 'doctype': 'DocType', 'istable': 1, - 'module': 'Website', + 'module': u'Website', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 1 + 'version': 3 }, # These values are common for all DocField { - 'doctype': 'DocField', - 'fieldname': 'page', - 'fieldtype': 'Link', - 'label': 'Page', + 'doctype': u'DocField', + 'fieldname': u'page', + 'fieldtype': u'Link', + 'label': u'Page', 'name': '__common__', - 'options': 'Page', - 'parent': 'Related Page', - 'parentfield': 'fields', - 'parenttype': 'DocType', + 'options': u'Page', + 'parent': u'Related Page', + 'parentfield': u'fields', + 'parenttype': u'DocType', 'permlevel': 0 }, # DocType, Related Page { 'doctype': 'DocType', - 'name': 'Related Page' + 'name': u'Related Page' }, # DocField { - 'doctype': 'DocField' + 'doctype': u'DocField' } ] \ No newline at end of file diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index 14a082b0910..8f7c38f18d7 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -37,10 +37,13 @@ class DocType: "title": webnotes.conn.get_value("Page", self.doc.next_page, "title")} self.doc.see_also = '' - for l in webnotes.conn.sql("""select distinct t1.page, t2.title from - `tabRelated Page` t1, tabPage t2 where - t1.page = t2.name order by t2.title""", as_dict=1): - self.doc.see_also += """

%(title)s

""" % l + for d in self.doclist: + if d.doctype=='Related Page': + tmp = {"page":d.page, "title":webnotes.conn.get_value('Page', d.page, 'title')} + self.doc.see_also += """
  • %(title)s
  • """ % tmp + + if self.doc.see_also: + self.doc.see_also = '
      %s
    ' % self.doc.see_also def cleanup_temp(self): """cleanup temp fields""" From 74fab559483d01be0ad67ae68585f8a92721422a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 14:34:42 +0530 Subject: [PATCH 42/70] add home in website patch --- erpnext/patches/jan_mar_2012/latest/website.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/latest/website.py index a6f1310ee09..cd40ccbb876 100644 --- a/erpnext/patches/jan_mar_2012/latest/website.py +++ b/erpnext/patches/jan_mar_2012/latest/website.py @@ -38,6 +38,21 @@ def execute(): reload_doc('website', 'page', 'products') reload_doc('website', 'page', 'unsubscribe') + create_home_page() + +def create_home_page(): + """create a dummy home page""" + if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'""") + d = Document('Web Page') + d.title = 'Home' + d.head_section = "

    Your Headline

    " + d.main_section = "

    Some introduction about your company

    " + d.side_section = "

    Links to other pages

    " + d.save() + obj = get_obj(doc = d) + obj.validate() + obj.doc.save() + def add_website_manager(): """add website manager to system manager""" for i in webnotes.conn.sql("""select distinct parent from tabUserRole From 4167e2f97a0e444e29297100cfc85034e2b1e990 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 10:58:48 +0100 Subject: [PATCH 43/70] patch fix --- erpnext/patches/jan_mar_2012/latest/cleanups.py | 6 ++++-- index.cgi | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/latest/cleanups.py b/erpnext/patches/jan_mar_2012/latest/cleanups.py index 44d24c034b7..9a78a70dd51 100644 --- a/erpnext/patches/jan_mar_2012/latest/cleanups.py +++ b/erpnext/patches/jan_mar_2012/latest/cleanups.py @@ -2,6 +2,7 @@ import webnotes def execute(): from webnotes.model import delete_doc + from webnotes.modules import reload_doc delete_doc("DocType", "SSO Control") delete_doc("DocType", "WN ERP Client Control") delete_doc("DocType", "Production Tips Common") @@ -18,7 +19,8 @@ def execute(): webnotes.conn.sql("""delete from tabSingles where field like 'startup_%' and doctype='Control Panel'""") - + webnotes.conn.sql("""delete from __SessionCache""") + webnotes.conn.commit() # DDLs @@ -30,4 +32,4 @@ def execute(): except: pass webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""") - \ No newline at end of file + diff --git a/index.cgi b/index.cgi index a119daeeda9..bc1de92863f 100755 --- a/index.cgi +++ b/index.cgi @@ -19,7 +19,13 @@ def init(): webnotes.form_dict[key] = webnotes.form.getvalue(key) # init request - webnotes.http_request = webnotes.auth.HTTPRequest() + try: + webnotes.http_request = webnotes.auth.HTTPRequest() + except Exception, e: + if webnotes.response['message']=='Authentication Failed': + pass + else: + raise e def respond(): import webnotes @@ -34,4 +40,4 @@ def respond(): if __name__=="__main__": init() - respond() \ No newline at end of file + respond() From e219db0e201c338d397b41800c187647707ff9eb Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 15:33:08 +0530 Subject: [PATCH 44/70] moved wnf.py to erpnext and added website manager role --- .../Role/Website Manager/Website Manager.txt | 26 ++++ wnf.py | 134 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 erpnext/website/Role/Website Manager/Website Manager.txt create mode 100755 wnf.py diff --git a/erpnext/website/Role/Website Manager/Website Manager.txt b/erpnext/website/Role/Website Manager/Website Manager.txt new file mode 100644 index 00000000000..ad1ad9aef3b --- /dev/null +++ b/erpnext/website/Role/Website Manager/Website Manager.txt @@ -0,0 +1,26 @@ +# Role, Website Manager +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-24 10:18:47', + 'docstatus': 0, + 'modified': '2012-02-06 15:22:27', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all Role + { + 'doctype': 'Role', + 'module': u'Website', + 'name': '__common__', + 'role_name': u'Website Manager' + }, + + # Role, Website Manager + { + 'doctype': 'Role', + 'name': u'Website Manager' + } +] \ No newline at end of file diff --git a/wnf.py b/wnf.py new file mode 100755 index 00000000000..bc113879291 --- /dev/null +++ b/wnf.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python + +import os, sys + +def replace_code(start, txt1, txt2, extn): + """replace all txt1 by txt2 in files with extension (extn)""" + import os, re + for wt in os.walk(start, followlinks=1): + for fn in wt[2]: + if fn.split('.')[-1]==extn: + fpath = os.path.join(wt[0], fn) + with open(fpath, 'r') as f: + content = f.read() + + if re.search(txt1, content): + a = raw_input('Change in %s [y/n]?' % fpath) + if a=='y': + with open(fpath, 'w') as f: + f.write(re.sub(txt1, txt2, content)) + + print 'updated in %s' % fpath + +def setup_options(): + from optparse import OptionParser + parser = OptionParser() + parser.add_option("-b", "--build", default=False, action="store_true", + help="minify + concat js files") + parser.add_option("-c", "--clear", default=False, action="store_true", + help="increment version") + parser.add_option("--replace", nargs=3, default=False, + metavar = "search replace_by extension", + help="file search-replace") + parser.add_option("--status", default=False, action="store_true", + help="git status") + parser.add_option("--pull", nargs=2, default=False, + metavar = "remote branch", + help="git pull (both repos)") + parser.add_option("--push", nargs=3, default=False, + metavar = "remote branch comment", + help="git commit + push (both repos) [remote] [branch] [comment]") + parser.add_option("-l", "--latest", + action="store_true", dest="run_latest", default=False, + help="Apply the latest patches") + parser.add_option("-p", "--patch", nargs=1, dest="patch_list", metavar='patch_module', + action="append", + help="Apply patch") + parser.add_option("-f", "--force", + action="store_true", dest="force", default=False, + help="Force Apply all patches specified using option -p or --patch") + parser.add_option("-d", "--db", + dest="db_name", + help="Apply the patches on given db") + parser.add_option('-r', '--reload_doc', nargs=3, metavar = "module doctype docname", + help="reload doc") + + return parser.parse_args() + +def run(): + sys.path.append('.') + sys.path.append('lib/py') + import webnotes + import webnotes.defs + sys.path.append(webnotes.defs.modules_path) + + (options, args) = setup_options() + + + from webnotes.db import Database + import webnotes.modules.patch_handler + + # build + if options.build: + import build.project + build.project.build() + + elif options.clear: + from build.project import increment_version + print "Version:" + str(increment_version()) + + # code replace + elif options.replace: + replace_code('.', options.replace[0], options.replace[1], options.replace[2]) + + # git + elif options.status: + os.system('git status') + os.chdir('lib') + os.system('git status') + + elif options.pull: + os.system('git pull %s %s' % (options.pull[0], options.pull[1])) + os.chdir('lib') + os.system('git pull %s %s' % (options.pull[0], options.pull[1])) + + elif options.push: + os.system('git commit -a -m "%s"' % options.push[2]) + os.system('git push %s %s' % (options.push[0], options.push[1])) + os.chdir('lib') + os.system('git commit -a -m "%s"' % options.push[2]) + os.system('git push %s %s' % (options.push[0], options.push[1])) + + + + # patch + elif options.patch_list: + # clear log + webnotes.modules.patch_handler.log_list = [] + + # connect to db + if options.db_name is not None: + webnotes.connect(options.db_name) + else: + webnotes.connect() + + # run individual patches + for patch in options.patch_list: + webnotes.modules.patch_handler.run_single(\ + patchmodule = patch, force = options.force) + + print '\n'.join(webnotes.modules.patch_handler.log_list) + + # reload + elif options.reload_doc: + webnotes.modules.patch_handler.reload_doc(\ + {"module":args[0], "dt":args[1], "dn":args[2]}) + print '\n'.join(webnotes.modules.patch_handler.log_list) + + # run all pending + elif options.run_latest: + webnotes.modules.patch_handler.run_all() + print '\n'.join(webnotes.modules.patch_handler.log_list) + +if __name__=='__main__': + run() From e651648b1be4c2b37062ecd69d6b599095838f08 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 16:28:06 +0530 Subject: [PATCH 45/70] added missing icons --- .../page/accounts_browser/accounts_browser.js | 4 +- erpnext/home/page/my_company/my_company.js | 2 +- .../page/sales_browser/sales_browser.js | 4 +- erpnext/website/doctype/product/product.txt | 216 +++++++++--------- version.num | 2 +- wnf.py | 6 +- 6 files changed, 117 insertions(+), 117 deletions(-) diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js index e5fca9f1fd9..13416e6a534 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.js +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js @@ -125,7 +125,7 @@ pscript.make_ac_tree = function() { var imgsrc=null; var has_children = true; if(cl[i].group_or_ledger=='Ledger') { - var imgsrc = 'lib/images/icons/page.gif'; + var imgsrc = 'lib/images/icons/page.png'; has_children = false; } var t = tree.addNode(n, cl[i].account_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null); @@ -138,7 +138,7 @@ pscript.make_ac_tree = function() { var imgsrc=null; var has_children = true; if(cl[i].group_or_ledger=='Ledger') { - var imgsrc = 'lib/images/icons/page.gif'; + var imgsrc = 'lib/images/icons/page.png'; has_children = false; } var t = tree.addNode(n, cl[i].cost_center_name, imgsrc,tree.std_onclick, has_children ? tree.std_onexp : null); diff --git a/erpnext/home/page/my_company/my_company.js b/erpnext/home/page/my_company/my_company.js index e85623f80c1..298b3138388 100644 --- a/erpnext/home/page/my_company/my_company.js +++ b/erpnext/home/page/my_company/my_company.js @@ -858,7 +858,7 @@ RoleObj.prototype.make_label = function(tbl, ridx, cidx, role){ var t = make_table($td(tbl, ridx, cidx),1,2,null,['16px', null],{marginRight:'5px'}); var ic = $a($td(t,0,0), 'img','',{cursor:'pointer', marginRight:'5px'}); - ic.src= 'lib/images/icons/help.gif'; + ic.src= 'lib/images/icons/help.png'; ic.role = role; ic.onclick = function(){ diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js index d2ba627afde..c7e400e4cc5 100644 --- a/erpnext/selling/page/sales_browser/sales_browser.js +++ b/erpnext/selling/page/sales_browser/sales_browser.js @@ -140,7 +140,7 @@ SalesBrowser.prototype.make_tree = function() { var has_children = true; if(cl[i].is_group=='No') { - var imgsrc = 'lib/images/icons/page.gif'; + var imgsrc = 'lib/images/icons/page.png'; has_children = false; } var t = me.tree.addNode(n, cl[i].name, imgsrc,me.tree.std_onclick, has_children ? me.tree.std_onexp : null); @@ -220,7 +220,7 @@ SalesBrowser.prototype.first_level_node = function(){ var has_children = true; if(cl[i].is_group=='No') { - var imgsrc = 'lib/images/icons/page.gif'; + var imgsrc = 'lib/images/icons/page.png'; has_children = false; } me.tree_area.innerHTML = ''; diff --git a/erpnext/website/doctype/product/product.txt b/erpnext/website/doctype/product/product.txt index fac4cfbda44..6258691a911 100644 --- a/erpnext/website/doctype/product/product.txt +++ b/erpnext/website/doctype/product/product.txt @@ -5,245 +5,245 @@ { 'creation': '2012-01-30 16:21:29', 'docstatus': 0, - 'modified': '2012-01-31 13:46:23', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-06 16:15:29', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1327995660', + '_last_update': u'1327997783', 'allow_attach': 1, - 'autoname': 'field:item', - 'colour': 'White:FFF', - 'description': 'A Product is shown on the website and is linked to an item.', + 'autoname': u'field:item', + 'colour': u'White:FFF', + 'description': u'A Product is shown on the website and is linked to an item.', 'doctype': 'DocType', 'max_attachments': 5, - 'module': 'Website', + 'module': u'Website', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 10 + 'version': 11 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Product', - 'parentfield': 'fields', - 'parenttype': 'DocType' + 'parent': u'Product', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Product', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Product', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1, - 'role': 'Website Manager' + 'role': u'Website Manager' }, # DocType, Product { 'doctype': 'DocType', - 'name': 'Product' + 'name': u'Product' }, # DocPerm { 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1 }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'item', - 'fieldtype': 'Link', - 'label': 'Item', - 'options': 'Item', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'item', + 'fieldtype': u'Link', + 'label': u'Item', + 'options': u'Item', 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'title', - 'fieldtype': 'Link', - 'label': 'Title', + 'doctype': u'DocField', + 'fieldname': u'title', + 'fieldtype': u'Data', + 'label': u'Title', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'published', - 'fieldtype': 'Check', - 'label': 'Published', + 'doctype': u'DocField', + 'fieldname': u'published', + 'fieldtype': u'Check', + 'label': u'Published', 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'Select Price List for the web. Leave blank to hide price.', - 'doctype': 'DocField', - 'fieldname': 'price_list', - 'fieldtype': 'Link', - 'label': 'Price List', - 'options': 'Price List', + 'colour': u'White:FFF', + 'description': u'Select Price List for the web. Leave blank to hide price.', + 'doctype': u'DocField', + 'fieldname': u'price_list', + 'fieldtype': u'Link', + 'label': u'Price List', + 'options': u'Price List', 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'Select shipping warehouse to show "In Stock" or "Out of Stock". To hide, leave blank', - 'doctype': 'DocField', - 'fieldname': 'warehouse', - 'fieldtype': 'Link', - 'label': 'Warehouse', - 'options': 'Warehouse', + 'colour': u'White:FFF', + 'description': u'Select shipping warehouse to show "In Stock" or "Out of Stock". To hide, leave blank', + 'doctype': u'DocField', + 'fieldname': u'warehouse', + 'fieldtype': u'Link', + 'label': u'Warehouse', + 'options': u'Warehouse', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'Image for listing (Width: 100px) (Attach First)', - 'doctype': 'DocField', - 'fieldname': 'thumbnail_image', - 'fieldtype': 'Select', - 'label': 'Thumbnail Image', - 'options': 'attach_files:', + 'colour': u'White:FFF', + 'description': u'Image for listing (Width: 100px) (Attach First)', + 'doctype': u'DocField', + 'fieldname': u'thumbnail_image', + 'fieldtype': u'Select', + 'label': u'Thumbnail Image', + 'options': u'attach_files:', 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'Image for listing (Width: 300px) (Attach First)', - 'doctype': 'DocField', - 'fieldname': 'full_image', - 'fieldtype': 'Select', - 'label': 'Full Image', - 'options': 'attach_files:', + 'colour': u'White:FFF', + 'description': u'Image for listing (Width: 300px) (Attach First)', + 'doctype': u'DocField', + 'fieldname': u'full_image', + 'fieldtype': u'Select', + 'label': u'Full Image', + 'options': u'attach_files:', 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'short_description', - 'fieldtype': 'Text', - 'label': 'Short Description', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'short_description', + 'fieldtype': u'Text', + 'label': u'Short Description', 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'Full description (formatted as markdown)', - 'doctype': 'DocField', - 'fieldname': 'long_description', - 'fieldtype': 'Code', - 'label': 'Long Description', + 'colour': u'White:FFF', + 'description': u'Full description (formatted as markdown)', + 'doctype': u'DocField', + 'fieldname': u'long_description', + 'fieldtype': u'Code', + 'label': u'Long Description', 'permlevel': 0, 'reqd': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'page_name', - 'fieldtype': 'Data', - 'label': 'Page Name', + 'doctype': u'DocField', + 'fieldname': u'page_name', + 'fieldtype': u'Data', + 'label': u'Page Name', 'permlevel': 1 }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'price', - 'fieldtype': 'Currency', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'price', + 'fieldtype': u'Currency', 'hidden': 0, - 'label': 'Price', + 'label': u'Price', 'permlevel': 1 }, # DocField { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'sales', - 'fieldtype': 'Currency', - 'label': 'Sales', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'sales', + 'fieldtype': u'Currency', + 'label': u'Sales', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'stock', - 'fieldtype': 'Currency', - 'label': 'Stock', + 'doctype': u'DocField', + 'fieldname': u'stock', + 'fieldtype': u'Currency', + 'label': u'Stock', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'currency', - 'fieldtype': 'Link', - 'label': 'Currency', - 'options': 'Currency', + 'doctype': u'DocField', + 'fieldname': u'currency', + 'fieldtype': u'Link', + 'label': u'Currency', + 'options': u'Currency', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'file_list', - 'fieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'file_list', + 'fieldtype': u'Text', 'hidden': 1, - 'label': 'File List', + 'label': u'File List', 'no_copy': 1, 'permlevel': 0, 'print_hide': 1 diff --git a/version.num b/version.num index b0e9f8d0ff9..755152b7ef4 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -358 \ No newline at end of file +359 \ No newline at end of file diff --git a/wnf.py b/wnf.py index bc113879291..368e5c88a81 100755 --- a/wnf.py +++ b/wnf.py @@ -50,13 +50,13 @@ def setup_options(): parser.add_option("-d", "--db", dest="db_name", help="Apply the patches on given db") - parser.add_option('-r', '--reload_doc', nargs=3, metavar = "module doctype docname", + parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname", help="reload doc") return parser.parse_args() def run(): - sys.path.append('.') + sys.path.append('lib') sys.path.append('lib/py') import webnotes import webnotes.defs @@ -122,7 +122,7 @@ def run(): # reload elif options.reload_doc: webnotes.modules.patch_handler.reload_doc(\ - {"module":args[0], "dt":args[1], "dn":args[2]}) + {"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]}) print '\n'.join(webnotes.modules.patch_handler.log_list) # run all pending From cc54fd46bc623996e1e57d109012e4521244cf24 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 13:09:08 +0100 Subject: [PATCH 46/70] website fixes --- .../patches/jan_mar_2012/latest/website.py | 24 ++++++++++--------- .../setup/doctype/item_group/item_group.txt | 2 +- erpnext/website/doctype/product/product.py | 14 ++++++++++- wnf.py | 18 +++++++------- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/latest/website.py index cd40ccbb876..9c930e2659b 100644 --- a/erpnext/patches/jan_mar_2012/latest/website.py +++ b/erpnext/patches/jan_mar_2012/latest/website.py @@ -7,7 +7,8 @@ def execute(): add_website_manager() from webnotes.modules import reload_doc from webnotes.model import delete_doc - + + reload_doc('setup', 'doctype', 'item_group') delete_doc('Website', 'Module Def', 'Website') reload_doc('website', 'Module Def', 'Website') reload_doc('website', 'Role', 'Website Manager') @@ -42,16 +43,17 @@ def execute(): def create_home_page(): """create a dummy home page""" - if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'""") - d = Document('Web Page') - d.title = 'Home' - d.head_section = "

    Your Headline

    " - d.main_section = "

    Some introduction about your company

    " - d.side_section = "

    Links to other pages

    " - d.save() - obj = get_obj(doc = d) - obj.validate() - obj.doc.save() + from webnotes.model.code import get_obj + if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'"""): + d = Document('Web Page') + d.title = 'Home' + d.head_section = "

    Your Headline

    " + d.main_section = "

    Some introduction about your company

    " + d.side_section = "

    Links to other pages

    " + d.save() + obj = get_obj(doc = d) + obj.validate() + obj.doc.save() def add_website_manager(): """add website manager to system manager""" diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt index 2e0731c2394..548c1733b34 100644 --- a/erpnext/setup/doctype/item_group/item_group.txt +++ b/erpnext/setup/doctype/item_group/item_group.txt @@ -236,4 +236,4 @@ 'print_hide': 1, 'report_hide': 1 } -] \ No newline at end of file +] diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py index 935d762010e..5880d34c7b5 100644 --- a/erpnext/website/doctype/product/product.py +++ b/erpnext/website/doctype/product/product.py @@ -1,3 +1,5 @@ +import webnotes + class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl @@ -24,4 +26,14 @@ class DocType: website.utils.add_guest_access_to_page(p.name) self.doc.page_name = p.name - del self.doc.fields['long_description_html'] \ No newline at end of file + del self.doc.fields['long_description_html'] + self.make_item_group_active() + + + def make_item_group_active(self): + """show item group in website""" + if self.doc.published: + from webnotes.model.doc import Document + ig = Document('Item Group', webnotes.conn.get_value('Item', self.doc.item, 'item_group')) + ig.show_in_website = 1 + ig.save() diff --git a/wnf.py b/wnf.py index 368e5c88a81..355474f58c6 100755 --- a/wnf.py +++ b/wnf.py @@ -68,6 +68,10 @@ def run(): from webnotes.db import Database import webnotes.modules.patch_handler + # connect + if options.db_name is not None: + webnotes.connect(options.db_name) + # build if options.build: import build.project @@ -99,19 +103,11 @@ def run(): os.system('git commit -a -m "%s"' % options.push[2]) os.system('git push %s %s' % (options.push[0], options.push[1])) - - # patch elif options.patch_list: # clear log webnotes.modules.patch_handler.log_list = [] - # connect to db - if options.db_name is not None: - webnotes.connect(options.db_name) - else: - webnotes.connect() - # run individual patches for patch in options.patch_list: webnotes.modules.patch_handler.run_single(\ @@ -129,6 +125,10 @@ def run(): elif options.run_latest: webnotes.modules.patch_handler.run_all() print '\n'.join(webnotes.modules.patch_handler.log_list) - + + # print messages + if webnotes.message_log: + print '\n'.join(webnotes.message_log) + if __name__=='__main__': run() From 28307193a130a183c42e23d9c0fabbe8f20a2458 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 17:40:37 +0530 Subject: [PATCH 47/70] item group txt --- .../setup/doctype/item_group/item_group.txt | 189 +++++++++--------- 1 file changed, 100 insertions(+), 89 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt index 2e0731c2394..4d5a0b8f36f 100644 --- a/erpnext/setup/doctype/item_group/item_group.txt +++ b/erpnext/setup/doctype/item_group/item_group.txt @@ -5,54 +5,54 @@ { 'creation': '2010-08-08 17:09:06', 'docstatus': 0, - 'modified': '2012-01-30 12:14:30', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-06 17:38:00', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1322549700', + '_last_update': u'1322549700', 'allow_trash': 1, - 'autoname': 'field:item_group_name', - 'colour': 'White:FFF', - 'default_print_format': 'Standard', + 'autoname': u'field:item_group_name', + 'colour': u'White:FFF', + 'default_print_format': u'Standard', 'doctype': 'DocType', - 'document_type': 'Master', + 'document_type': u'Master', 'in_create': 1, 'issingle': 0, - 'module': 'Setup', + 'module': u'Setup', 'name': '__common__', - 'search_fields': 'parent_item_group', - 'section_style': 'Simple', - 'server_code_error': ' ', + 'search_fields': u'parent_item_group', + 'section_style': u'Simple', + 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 57 + 'version': 58 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Item Group', - 'parentfield': 'fields', - 'parenttype': 'DocType' + 'parent': u'Item Group', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Item Group', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Item Group', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, Item Group { 'doctype': 'DocType', - 'name': 'Item Group' + 'name': u'Item Group' }, # DocPerm @@ -60,9 +60,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Material Manager', + 'role': u'Material Manager', 'submit': 0, 'write': 0 }, @@ -72,9 +72,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material Manager', + 'role': u'Material Manager', 'submit': 0, 'write': 0 }, @@ -84,9 +84,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Material User', + 'role': u'Material User', 'submit': 0, 'write': 0 }, @@ -96,9 +96,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material User', + 'role': u'Material User', 'submit': 0, 'write': 0 }, @@ -107,9 +107,9 @@ { 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'System Manager', + 'role': u'System Manager', 'write': 1 }, @@ -117,87 +117,98 @@ { 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material Master Manager', + 'role': u'Material Master Manager', 'write': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'item_group_name', - 'fieldtype': 'Data', - 'label': 'Item Group Name', - 'oldfieldname': 'item_group_name', - 'oldfieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'item_group_name', + 'fieldtype': u'Data', + 'label': u'Item Group Name', + 'oldfieldname': u'item_group_name', + 'oldfieldtype': u'Data', 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'description', - 'fieldtype': 'Text', - 'label': 'Description', - 'oldfieldname': 'description', - 'oldfieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Text', + 'label': u'Description', + 'oldfieldname': u'description', + 'oldfieldtype': u'Text', 'permlevel': 0, - 'width': '300px' + 'width': u'300px' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'parent_item_group', - 'fieldtype': 'Link', - 'label': 'Parent Item Group', - 'oldfieldname': 'parent_item_group', - 'oldfieldtype': 'Link', - 'options': 'Item Group', + 'colour': u'White:FFF', + 'description': u'Check this if you want to show in website', + 'doctype': u'DocField', + 'fieldname': u'show_in_website', + 'fieldtype': u'Check', + 'label': u'Show in Website', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'parent_item_group', + 'fieldtype': u'Link', + 'label': u'Parent Item Group', + 'oldfieldname': u'parent_item_group', + 'oldfieldtype': u'Link', + 'options': u'Item Group', 'permlevel': 0, 'reqd': 1, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Only leaf nodes are allowed in transaction', - 'doctype': 'DocField', - 'fieldname': 'is_group', - 'fieldtype': 'Select', - 'label': 'Has Child Node', - 'oldfieldname': 'is_group', - 'oldfieldtype': 'Select', - 'options': '\nYes\nNo', + 'colour': u'White:FFF', + 'description': u'Only leaf nodes are allowed in transaction', + 'doctype': u'DocField', + 'fieldname': u'is_group', + 'fieldtype': u'Select', + 'label': u'Has Child Node', + 'oldfieldname': u'is_group', + 'oldfieldtype': u'Select', + 'options': u'\nYes\nNo', 'permlevel': 0, 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'trash_reason', - 'fieldtype': 'Small Text', - 'label': 'Trash Reason', - 'oldfieldname': 'trash_reason', - 'oldfieldtype': 'Small Text', + 'doctype': u'DocField', + 'fieldname': u'trash_reason', + 'fieldtype': u'Small Text', + 'label': u'Trash Reason', + 'oldfieldname': u'trash_reason', + 'oldfieldtype': u'Small Text', 'permlevel': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'lft', - 'fieldtype': 'Int', + 'doctype': u'DocField', + 'fieldname': u'lft', + 'fieldtype': u'Int', 'hidden': 1, 'in_filter': 1, - 'label': 'lft', + 'label': u'lft', 'no_copy': 1, - 'oldfieldname': 'lft', - 'oldfieldtype': 'Int', + 'oldfieldname': u'lft', + 'oldfieldtype': u'Int', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -206,15 +217,15 @@ # DocField { - 'doctype': 'DocField', - 'fieldname': 'rgt', - 'fieldtype': 'Int', + 'doctype': u'DocField', + 'fieldname': u'rgt', + 'fieldtype': u'Int', 'hidden': 1, 'in_filter': 1, - 'label': 'rgt', + 'label': u'rgt', 'no_copy': 1, - 'oldfieldname': 'rgt', - 'oldfieldtype': 'Int', + 'oldfieldname': u'rgt', + 'oldfieldtype': u'Int', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -223,15 +234,15 @@ # DocField { - 'doctype': 'DocField', - 'fieldname': 'old_parent', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'old_parent', + 'fieldtype': u'Link', 'hidden': 1, - 'label': 'old_parent', + 'label': u'old_parent', 'no_copy': 1, - 'oldfieldname': 'old_parent', - 'oldfieldtype': 'Data', - 'options': 'Item Group', + 'oldfieldname': u'old_parent', + 'oldfieldtype': u'Data', + 'options': u'Item Group', 'permlevel': 0, 'print_hide': 1, 'report_hide': 1 From f35992f6955c83d2d5b2bfbd5ec7e8625d6c1ec2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 10:39:17 +0530 Subject: [PATCH 48/70] top bar to accept url --- erpnext/startup/event_handlers.py | 2 +- .../doctype/top_bar_item/top_bar_item.txt | 59 +++++++++---------- erpnext/website/js/topbar.js | 4 +- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index e3e7fa95d57..3c6281f1fda 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -53,7 +53,7 @@ def boot_session(bootinfo): if webnotes.session['user']=='Guest': bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings') - bootinfo['website_menus'] = webnotes.conn.sql("""select label, std_page, custom_page, + bootinfo['website_menus'] = webnotes.conn.sql("""select label, url, custom_page, 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 '' diff --git a/erpnext/website/doctype/top_bar_item/top_bar_item.txt b/erpnext/website/doctype/top_bar_item/top_bar_item.txt index 410352c2355..3ff23b3a63f 100644 --- a/erpnext/website/doctype/top_bar_item/top_bar_item.txt +++ b/erpnext/website/doctype/top_bar_item/top_bar_item.txt @@ -5,70 +5,69 @@ { 'creation': '2012-01-24 10:24:19', 'docstatus': 0, - 'modified': '2012-01-30 14:14:48', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-07 10:35:19', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - 'colour': 'White:FFF', + 'colour': u'White:FFF', 'doctype': 'DocType', 'istable': 1, - 'module': 'Website', + 'module': u'Website', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 2 + 'version': 4 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Top Bar Item', - 'parentfield': 'fields', - 'parenttype': 'DocType', + 'parent': u'Top Bar Item', + 'parentfield': u'fields', + 'parenttype': u'DocType', 'permlevel': 0 }, # DocType, Top Bar Item { 'doctype': 'DocType', - 'name': 'Top Bar Item' + 'name': u'Top Bar Item' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'label', - 'fieldtype': 'Data', - 'label': 'Label' + 'doctype': u'DocField', + 'fieldname': u'label', + 'fieldtype': u'Data', + 'label': u'Label' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'std_page', - 'fieldtype': 'Select', - 'label': 'Std Page', - 'options': 'Home\nAbout\nContact\nProducts\nBlog\nCustom' + 'doctype': u'DocField', + 'fieldname': u'custom_page', + 'fieldtype': u'Link', + 'label': u'Page', + 'options': u'Page' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'custom_page', - 'fieldtype': 'Link', - 'label': 'Custom Page', - 'options': 'Web Page' + 'doctype': u'DocField', + 'fieldname': u'url', + 'fieldtype': u'Data', + 'label': u'URL' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'parent_label', - 'fieldtype': 'Select', - 'label': 'Parent Label' + 'doctype': u'DocField', + 'fieldname': u'parent_label', + 'fieldtype': u'Select', + 'label': u'Parent Label' } ] \ No newline at end of file diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index 90e530d0ded..cffc825e90f 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -37,7 +37,7 @@ erpnext.topbar.TopBar = Class.extend({ for(var i=0;i%(label)s', item)) } @@ -64,7 +64,7 @@ erpnext.Footer = Class.extend({ for(var i=0;i%(label)s', item)) } From 002340080db4d5da350c5c4f5774f11c717e0510 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 07:08:05 +0100 Subject: [PATCH 49/70] fixes to products --- erpnext/website/js/product_category.js | 11 ++++++----- erpnext/website/page/products/products.js | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js index 04b7e71862b..5296029a5b8 100644 --- a/erpnext/website/js/product_category.js +++ b/erpnext/website/js/product_category.js @@ -5,12 +5,13 @@ erpnext.make_product_categories = function(wrapper) { wrapper.category_list = new wn.widgets.Listing({ parent: $(wrapper).find('.web-side-section').get(0), query: 'select label, count(t2.name) as items, t1.item_group \ - from `tabProduct Group` t1, `tabItem` t2\ + from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\ where t1.parent="Products Settings" \ - and t2.item_group = t1.item_group \ - and ifnull(t2.show_in_website, 0)=1 \ - group by t2.item_group \ - order by t1.idx desc', + and t2.item = t3.name \ + and t3.item_group = t1.item_group \ + and ifnull(t2.published, 0)=1 \ + group by t1.item_group \ + order by t1.idx', hide_refresh: true, render_row: function(parent, data) { parent.innerHTML = repl('%(label)s (%(items)s)', diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js index 0e7dec501b7..f61979b840d 100644 --- a/erpnext/website/page/products/products.js +++ b/erpnext/website/page/products/products.js @@ -54,6 +54,7 @@ erpnext.products.make_product_list = function(wrapper) { t1.page_name, t1.short_description \ from tabProduct t1, tabItem t2 \ where t1.item = t2.name \ + and ifnull(t1.published,0)=1 \ and t2.item_group="%(cat)s" \ and t1.short_description like "%%(searchstr)s%"', args) }, @@ -63,7 +64,7 @@ erpnext.products.make_product_list = function(wrapper) {
    \ %(title)s\

    %(short_description)s

    \ -
    ', data); +
    ', data); } }); @@ -81,4 +82,4 @@ erpnext.products.set_group = function() { $(wrapper).find('h1').html(cat.label); wrapper.mainlist.run(); -} \ No newline at end of file +} From f42e682f67940daaf1aa716adbed1df43218d4ca Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 07:12:48 +0100 Subject: [PATCH 50/70] fixes to products --- index.html | 79 ------------------------------------------------------ 1 file changed, 79 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 150a2cf730e..00000000000 --- a/index.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - ERPNext - - - - -
    - - -
    - - -
    - Loading... -
    -
    - -
    - From 8b96b05163950407290e4caf10107fbe410028dd Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 11:43:41 +0530 Subject: [PATCH 51/70] fixes to products --- erpnext/home/__init__.py | 6 +++++- erpnext/website/page/products/products.html | 2 +- erpnext/website/page/products/products.js | 7 +++++-- js/app.js | 1 - 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index 5ebf7c01647..d41b26289bb 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -31,7 +31,11 @@ feed_dict = { # Support 'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'], 'Maintenance Visit':['To %(customer_name)s', '#4169E1'], - 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'] + 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'], + + # Website + 'Web Page': ['%(title)s', '#00080'], + 'Blog': ['%(title)s', '#00080'] } def make_feed(feedtype, doctype, name, owner, subject, color): diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html index 4ef5bf49fc7..d12004ee2f0 100644 --- a/erpnext/website/page/products/products.html +++ b/erpnext/website/page/products/products.html @@ -2,7 +2,7 @@

    diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js index 0e7dec501b7..ca30feee5b9 100644 --- a/erpnext/website/page/products/products.js +++ b/erpnext/website/page/products/products.js @@ -46,8 +46,11 @@ erpnext.products.make_product_list = function(wrapper) { run_btn: $(wrapper).find('.products-search .btn').get(0), hide_refresh: true, get_query: function() { + var srch = $('input[name="products-search"]').val() + var search_cond = 'and (t1.short_description like "%%(srch)s%"\ + or t1.title like "%%(srch)s%")'; args = { - searchstr: $('input[name="products-search"]').val() || '', + search_cond: srch ? repl(search_cond, {srch:srch}) : '', cat: erpnext.products.cur_group }; return repl('select t1.name, t1.title, t1.thumbnail_image, \ @@ -55,7 +58,7 @@ erpnext.products.make_product_list = function(wrapper) { from tabProduct t1, tabItem t2 \ where t1.item = t2.name \ and t2.item_group="%(cat)s" \ - and t1.short_description like "%%(searchstr)s%"', args) + %(search_cond)s', args) }, render_row: function(parent, data) { parent.innerHTML = repl('
    \ diff --git a/js/app.js b/js/app.js index 6b724513893..cba6a8493f3 100644 --- a/js/app.js +++ b/js/app.js @@ -12,7 +12,6 @@ wn.settings.no_history = true; wn.require('lib/js/lib/jquery.min.js'); wn.require('lib/js/legacy/tiny_mce_33/jquery.tinymce.js'); -wn.require('lib/js/wn/ui/status_bar.js'); // for datepicker wn.require('lib/js/legacy/jquery/jquery-ui.min.js') From 518533fde01b4374d7769f27753d2218f32e58db Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 13:29:31 +0530 Subject: [PATCH 52/70] added sitemap, rss feeds --- erpnext/website/doctype/blog/blog.py | 2 +- erpnext/website/doctype/blog/blog.txt | 96 +++++++++++++-------- erpnext/website/doctype/blog/template.html | 5 ++ erpnext/website/page/blog/blog.html | 8 ++ images/feed.png | Bin 0 -> 691 bytes rss.xml | 18 ++++ sitemap.xml | 19 ++++ version.num | 2 +- 8 files changed, 111 insertions(+), 39 deletions(-) create mode 100755 images/feed.png create mode 100755 rss.xml create mode 100755 sitemap.xml diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index 05391eecdeb..c0e70a61004 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -15,7 +15,7 @@ class DocType(): """save file by its name""" self.doc.name = website.utils.page_name(self.doc.title) - def on_update(self): + def validate(self): """write/update 'Page' with the blog""" p = website.utils.add_page(self.doc.title) diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt index 9e0949203f8..2471c2dfa44 100644 --- a/erpnext/website/doctype/blog/blog.txt +++ b/erpnext/website/doctype/blog/blog.txt @@ -5,84 +5,106 @@ { 'creation': '2012-01-27 12:24:03', 'docstatus': 0, - 'modified': '2012-01-27 12:24:03', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-07 12:59:01', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - 'colour': 'White:FFF', + '_last_update': u'1327647244', + 'colour': u'White:FFF', 'doctype': 'DocType', - 'module': 'Website', + 'module': u'Website', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 1 + 'version': 2 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Blog', - 'parentfield': 'fields', - 'parenttype': 'DocType', - 'permlevel': 0 + 'parent': u'Blog', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Blog', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'permlevel': 0, - 'read': 1, - 'write': 1 + 'parent': u'Blog', + 'parentfield': u'permissions', + 'parenttype': u'DocType', + 'read': 1 }, # DocType, Blog { 'doctype': 'DocType', - 'name': 'Blog' + 'name': u'Blog' }, # DocPerm { - 'doctype': 'DocPerm', - 'role': 'Website Manager' + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Website Manager', + 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', - 'role': 'Blogger' + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Blogger', + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'title', - 'fieldtype': 'Data', - 'label': 'Title' + 'doctype': u'DocField', + 'fieldname': u'title', + 'fieldtype': u'Data', + 'label': u'Title', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'published', - 'fieldtype': 'Check', - 'label': 'Published' + 'doctype': u'DocField', + 'fieldname': u'published', + 'fieldtype': u'Check', + 'label': u'Published', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'content', - 'fieldtype': 'Code', - 'label': 'Content' + 'doctype': u'DocField', + 'fieldname': u'content', + 'fieldtype': u'Code', + 'label': u'Content', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'content_html', + 'fieldtype': u'Text', + 'label': u'Preview', + 'permlevel': 1 } ] \ No newline at end of file diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html index 8c33d83cae7..f70bacb7287 100644 --- a/erpnext/website/doctype/blog/template.html +++ b/erpnext/website/doctype/blog/template.html @@ -8,6 +8,11 @@

    All Blogs

    +

    Subscribe

    +

    + + RSS Feed +

    diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html index f271e030e58..79ea7f0f1f3 100644 --- a/erpnext/website/page/blog/blog.html +++ b/erpnext/website/page/blog/blog.html @@ -5,9 +5,17 @@
    + +

    Subscribe

    +

    + + RSS Feed +

    diff --git a/images/feed.png b/images/feed.png new file mode 100755 index 0000000000000000000000000000000000000000..315c4f4fa62cb720326ba3f54259666ba3999e42 GIT binary patch literal 691 zcmV;k0!;mhP)bpQb1=l6TxbDZwj&S={?7%qx-u`rsG(Zp`-rh=e^=%((1yvsuf5d=&62Zj)Y zH&JviNS_F4_Hj|T(1j4$p-!}kixP9&dB4uv^MveG?dGf%sUCoc2!IFxD6wHRA2^dX zXRVk!-qSfk(jcaUKn#RP48(whfPlJUpApdrA!TQi_4D+fVoM;3I0gZ8{=Xv~Po;geVA+Em9@0Wq2 zr>OTZEGR05L=gf1T;ucCxq6Q6EgJiH@@-lVaAlQyw`jIF^c=&IVnj|95hHbE_cnt| zTzZQ?F4Ne@(bH(~&3nM%m)I@ID{@jJ2qZPjr)jhpe9hViOwH5k&|T#EmmL3(vHeUQ zq^!t^Al6JD;=mHq^Bg?J-8-zG2Od7gZbknG;K9czYjPqG*xjPo0k(c4%lPXTpw(qq z@aGMnxtFS(np+2kC} z7P02O874ZkJH$v#nCUVx$({yDN`IX@o2wyvTD#e`qN`_w5<}$3F+_ Date: Tue, 7 Feb 2012 13:31:09 +0530 Subject: [PATCH 53/70] moved index to webnotes/cms --- index.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.cgi b/index.cgi index bc1de92863f..3ec31e7985e 100755 --- a/index.cgi +++ b/index.cgi @@ -32,11 +32,11 @@ def respond(): if 'cmd' in webnotes.form_dict: webnotes.handler.handle() else: - import webnotes.index + import webnotes.cms.index print "Content-Type: text/html" webnotes.handler.print_cookies() print - print webnotes.index.get() + print webnotes.cms.index.get() if __name__=="__main__": init() From f9620eaf441c0ee2882d1aff6be495e2c3452f3e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 14:31:49 +0530 Subject: [PATCH 54/70] fix to product, blog --- erpnext/home/__init__.py | 4 +-- .../{latest => website}/__init__.py | 0 .../{latest => website}/cleanups.py | 0 .../jan_mar_2012/{latest => website}/feed.py | 0 .../jan_mar_2012/{latest => website}/login.py | 0 .../{latest => website}/website.py | 1 + erpnext/website/Role/Blogger/Blogger.txt | 26 ++++++++++++++ erpnext/website/doctype/blog/blog.py | 1 + erpnext/website/doctype/blog/blog.txt | 20 +++++++++-- erpnext/website/doctype/product/product.py | 6 ++-- .../website/doctype/product/product_page.js | 36 ++++++++++++++++++- erpnext/website/doctype/product/template.html | 4 +++ erpnext/website/js/product_category.js | 2 +- erpnext/website/page/products/products.html | 1 + erpnext/website/page/products/products.js | 1 - version.num | 2 +- wnf.py | 6 ++++ 17 files changed, 99 insertions(+), 11 deletions(-) rename erpnext/patches/jan_mar_2012/{latest => website}/__init__.py (100%) rename erpnext/patches/jan_mar_2012/{latest => website}/cleanups.py (100%) rename erpnext/patches/jan_mar_2012/{latest => website}/feed.py (100%) rename erpnext/patches/jan_mar_2012/{latest => website}/login.py (100%) rename erpnext/patches/jan_mar_2012/{latest => website}/website.py (98%) create mode 100644 erpnext/website/Role/Blogger/Blogger.txt diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index d41b26289bb..bec99d48ff8 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -34,8 +34,8 @@ feed_dict = { 'Support Ticket': ['[%(status)s] %(subject)s', '#000080'], # Website - 'Web Page': ['%(title)s', '#00080'], - 'Blog': ['%(title)s', '#00080'] + 'Web Page': ['%(title)s', '#000080'], + 'Blog': ['%(title)s', '#000080'] } def make_feed(feedtype, doctype, name, owner, subject, color): diff --git a/erpnext/patches/jan_mar_2012/latest/__init__.py b/erpnext/patches/jan_mar_2012/website/__init__.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/__init__.py rename to erpnext/patches/jan_mar_2012/website/__init__.py diff --git a/erpnext/patches/jan_mar_2012/latest/cleanups.py b/erpnext/patches/jan_mar_2012/website/cleanups.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/cleanups.py rename to erpnext/patches/jan_mar_2012/website/cleanups.py diff --git a/erpnext/patches/jan_mar_2012/latest/feed.py b/erpnext/patches/jan_mar_2012/website/feed.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/feed.py rename to erpnext/patches/jan_mar_2012/website/feed.py diff --git a/erpnext/patches/jan_mar_2012/latest/login.py b/erpnext/patches/jan_mar_2012/website/login.py similarity index 100% rename from erpnext/patches/jan_mar_2012/latest/login.py rename to erpnext/patches/jan_mar_2012/website/login.py diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/website/website.py similarity index 98% rename from erpnext/patches/jan_mar_2012/latest/website.py rename to erpnext/patches/jan_mar_2012/website/website.py index 9c930e2659b..4ffb4417388 100644 --- a/erpnext/patches/jan_mar_2012/latest/website.py +++ b/erpnext/patches/jan_mar_2012/website/website.py @@ -12,6 +12,7 @@ def execute(): delete_doc('Website', 'Module Def', 'Website') reload_doc('website', 'Module Def', 'Website') reload_doc('website', 'Role', 'Website Manager') + reload_doc('website', 'Role', 'Blogger') webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""") d = Document('Module Def Role') diff --git a/erpnext/website/Role/Blogger/Blogger.txt b/erpnext/website/Role/Blogger/Blogger.txt new file mode 100644 index 00000000000..a380d4c7b7e --- /dev/null +++ b/erpnext/website/Role/Blogger/Blogger.txt @@ -0,0 +1,26 @@ +# Role, Blogger +[ + + # These values are common in all dictionaries + { + 'creation': '2012-01-27 12:22:24', + 'docstatus': 0, + 'modified': '2012-01-27 12:22:24', + 'modified_by': u'Administrator', + 'owner': u'Administrator' + }, + + # These values are common for all Role + { + 'doctype': 'Role', + 'module': u'Website', + 'name': '__common__', + 'role_name': u'Blogger' + }, + + # Role, Blogger + { + 'doctype': 'Role', + 'name': u'Blogger' + } +] \ No newline at end of file diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index c0e70a61004..c83b922d507 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -18,6 +18,7 @@ class DocType(): def validate(self): """write/update 'Page' with the blog""" p = website.utils.add_page(self.doc.title) + self.doc.name = p.name from jinja2 import Template import markdown2 diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt index 2471c2dfa44..59444f81138 100644 --- a/erpnext/website/doctype/blog/blog.txt +++ b/erpnext/website/doctype/blog/blog.txt @@ -5,21 +5,23 @@ { 'creation': '2012-01-27 12:24:03', 'docstatus': 0, - 'modified': '2012-02-07 12:59:01', + 'modified': '2012-02-07 13:55:17', 'modified_by': u'Administrator', 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': u'1327647244', + '_last_update': u'1328599743', + 'allow_attach': 1, 'colour': u'White:FFF', 'doctype': 'DocType', + 'max_attachments': 5, 'module': u'Website', 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 2 + 'version': 3 }, # These values are common for all DocField @@ -106,5 +108,17 @@ 'fieldtype': u'Text', 'label': u'Preview', 'permlevel': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'file_list', + 'fieldtype': u'Text', + 'hidden': 1, + 'label': u'File List', + 'no_copy': 1, + 'permlevel': 0, + 'print_hide': 1 } ] \ No newline at end of file diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py index 5880d34c7b5..223a790df98 100644 --- a/erpnext/website/doctype/product/product.py +++ b/erpnext/website/doctype/product/product.py @@ -14,6 +14,7 @@ class DocType: import markdown2 import os + self.doc.item_group = webnotes.conn.get_value('Item', self.doc.item, 'item_group') self.doc.long_description_html = markdown2.markdown(self.doc.long_description or '') with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f: @@ -26,14 +27,15 @@ class DocType: website.utils.add_guest_access_to_page(p.name) self.doc.page_name = p.name - del self.doc.fields['long_description_html'] self.make_item_group_active() + del self.doc.fields['long_description_html'] + del self.doc.fields['item_group'] def make_item_group_active(self): """show item group in website""" if self.doc.published: from webnotes.model.doc import Document - ig = Document('Item Group', webnotes.conn.get_value('Item', self.doc.item, 'item_group')) + ig = Document('Item Group', self.doc.item_group) ig.show_in_website = 1 ig.save() diff --git a/erpnext/website/doctype/product/product_page.js b/erpnext/website/doctype/product/product_page.js index 7d031ef94b3..35359cca414 100644 --- a/erpnext/website/doctype/product/product_page.js +++ b/erpnext/website/doctype/product/product_page.js @@ -1,6 +1,8 @@ wn.require('erpnext/website/js/product_category.js'); pscript["onload_{{ doc.page_name }}"] = function(wrapper) { + wrapper.product_group = "{{ doc.item_group }}"; + wrapper.product_name = "{{ doc.name }}"; erpnext.make_product_categories(wrapper); $(wrapper).find('.product-inquiry').click(function() { loadpage('contact', function() { @@ -9,5 +11,37 @@ pscript["onload_{{ doc.page_name }}"] = function(wrapper) { My contact details are:\n\nThank you!\ "); }) - }) + }); + + // similar products + wrapper.similar = new wn.widgets.Listing({ + parent: $(wrapper).find('.similar-products').get(0), + hide_refresh: true, + page_length: 5, + get_query: function() { + args = { + cat: wrapper.product_group, + name: wrapper.product_name + }; + return repl('select t1.name, t1.title, t1.thumbnail_image, \ + t1.page_name, t1.short_description \ + from tabProduct t1, tabItem t2 \ + where t1.item = t2.name \ + and ifnull(t1.published,0)=1 \ + and t1.name != "%(name)s" \ + and t2.item_group="%(cat)s" order by t1.modified desc', args) + }, + render_row: function(parent, data) { + if(data.short_description.length > 100) { + data.short_description = data.short_description.substr(0,100) + '...'; + } + parent.innerHTML = repl('
    \ +
    \ +
    \ + %(title)s\ +

    %(short_description)s

    \ +
    ', data); + } + }); + wrapper.similar.run(); } \ No newline at end of file diff --git a/erpnext/website/doctype/product/template.html b/erpnext/website/doctype/product/template.html index 8c7f918ef16..926b650847d 100644 --- a/erpnext/website/doctype/product/template.html +++ b/erpnext/website/doctype/product/template.html @@ -22,6 +22,10 @@

    More Categories

    +
    +
    +

    Similar Products

    +
    diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js index 5296029a5b8..076578ae251 100644 --- a/erpnext/website/js/product_category.js +++ b/erpnext/website/js/product_category.js @@ -3,7 +3,7 @@ erpnext.product_item_group = {} erpnext.make_product_categories = function(wrapper) { wrapper.category_list = new wn.widgets.Listing({ - parent: $(wrapper).find('.web-side-section').get(0), + parent: $(wrapper).find('.more-categories').get(0), query: 'select label, count(t2.name) as items, t1.item_group \ from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\ where t1.parent="Products Settings" \ diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html index d12004ee2f0..7ca74958932 100644 --- a/erpnext/website/page/products/products.html +++ b/erpnext/website/page/products/products.html @@ -7,6 +7,7 @@

    Categories

    +
    \ No newline at end of file diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js index 6284d186a99..b9fa167514f 100644 --- a/erpnext/website/page/products/products.js +++ b/erpnext/website/page/products/products.js @@ -70,7 +70,6 @@ erpnext.products.make_product_list = function(wrapper) {
    ', data); } }); - } erpnext.products.set_group = function() { diff --git a/version.num b/version.num index 4f36264f98d..e24b797f8d0 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -360 \ No newline at end of file +361 \ No newline at end of file diff --git a/wnf.py b/wnf.py index 355474f58c6..52308d0902a 100755 --- a/wnf.py +++ b/wnf.py @@ -52,6 +52,8 @@ def setup_options(): help="Apply the patches on given db") parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname", help="reload doc") + parser.add_option('--export_doc', nargs=2, metavar = "doctype docname", + help="export doc") return parser.parse_args() @@ -121,6 +123,10 @@ def run(): {"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]}) print '\n'.join(webnotes.modules.patch_handler.log_list) + elif options.export_doc: + from webnotes.modules import export_doc + export_doc(options.export_doc[0], options.export_doc[1]) + # run all pending elif options.run_latest: webnotes.modules.patch_handler.run_all() From 4d20b2246c3fb947581dd4046c52276ba837e3ab Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 7 Feb 2012 14:57:49 +0530 Subject: [PATCH 55/70] style fixes --- erpnext/website/css/website.css | 1 + erpnext/website/page/products/products.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index cdea0877015..73cafcb5048 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -73,6 +73,7 @@ footer a:hover { .web-footer-menu ul { list-style: none; margin: 0px; + padding: 0px; } .web-footer-menu ul li { diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html index 7ca74958932..6c4fa97b174 100644 --- a/erpnext/website/page/products/products.html +++ b/erpnext/website/page/products/products.html @@ -1,6 +1,6 @@
    +

    -

    From bd20d29dae9515ac0100c75c48427542a8c48321 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Feb 2012 10:23:16 +0530 Subject: [PATCH 56/70] pre style --- erpnext/website/css/website.css | 11 +++++++++++ version.num | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index 73cafcb5048..c4208b2a790 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -11,6 +11,17 @@ h1 { margin-bottom: 15px; } +pre { + background-color: #F8F8F8; + border: 1px solid #CCCCCC; + border-radius: 3px 3px 3px 3px; + font-size: 13px; + line-height: 19px; + overflow: auto; + padding: 6px 10px; + margin-bottom: 9px; +} + footer { width: 900px; margin: auto; diff --git a/version.num b/version.num index e24b797f8d0..e8930b6df94 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -361 \ No newline at end of file +364 \ No newline at end of file From 3fd279977b57b3ff48fe8b240426dd9de97e88f8 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Feb 2012 10:44:02 +0530 Subject: [PATCH 57/70] website p sty;e --- erpnext/website/css/website.css | 7 +++++++ version.num | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index c4208b2a790..8a90b1b0038 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -45,6 +45,13 @@ header .topbar .container { margin-bottom: 20px; } +.web-main-section p, +.web-main-section h4, +.web-main-section h5, +.web-main-section pre { + margin-left: 9px; +} + .web-side-section { width: 30%; float: right; diff --git a/version.num b/version.num index e8930b6df94..24f98f2d5fb 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -364 \ No newline at end of file +367 \ No newline at end of file From a1f3764238fb25ca16cd48592dd98bac7491a044 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Feb 2012 10:51:08 +0530 Subject: [PATCH 58/70] about us style fix --- erpnext/website/doctype/about_us_settings/template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/website/doctype/about_us_settings/template.html b/erpnext/website/doctype/about_us_settings/template.html index 47ef402d1c6..864fb655063 100644 --- a/erpnext/website/doctype/about_us_settings/template.html +++ b/erpnext/website/doctype/about_us_settings/template.html @@ -19,7 +19,7 @@

    {{ p.person_name }}

    -
    {{ p.designation }}
    +

    {{ p.designation }}

    {{ p.bio }}
    From b8d649781852f38d6d25171b53866b052b1f1d57 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Feb 2012 12:33:13 +0530 Subject: [PATCH 59/70] many style fixes --- erpnext/home/__init__.py | 6 +- erpnext/home/doctype/feed/feed.txt | 76 ++++++++++--------- .../home/page/event_updates/event_updates.js | 5 +- erpnext/startup/event_handlers.py | 1 - erpnext/startup/modules.js | 34 --------- erpnext/website/css/website.css | 21 +++++ erpnext/website/doctype/blog/blog.py | 9 +++ erpnext/website/doctype/blog/blog_page.js | 6 +- erpnext/website/doctype/blog/template.html | 3 +- .../website/doctype/web_page/template.html | 10 ++- erpnext/website/doctype/web_page/web_page.py | 17 ++--- erpnext/website/page/blog/blog.js | 6 +- version.num | 2 +- 13 files changed, 102 insertions(+), 94 deletions(-) diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py index bec99d48ff8..75556e39370 100644 --- a/erpnext/home/__init__.py +++ b/erpnext/home/__init__.py @@ -42,11 +42,12 @@ def make_feed(feedtype, doctype, name, owner, subject, color): "makes a new Feed record" #msgprint(subject) from webnotes.model.doc import Document + from webnotes.utils import get_full_name - if feedtype in ('Login', 'Comment'): + if feedtype in ('Login', 'Comment', 'Assignment'): # delete old login, comment feed webnotes.conn.sql("""delete from tabFeed where - datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login')""") + datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login', 'Assignment')""") else: # one feed per item webnotes.conn.sql("""delete from tabFeed @@ -60,6 +61,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color): f.doc_name = name f.subject = subject f.color = color + f.full_name = get_full_name(owner) f.save() def update_feed(doc, method=None): diff --git a/erpnext/home/doctype/feed/feed.txt b/erpnext/home/doctype/feed/feed.txt index f239f7c7c86..62d6633a0b4 100644 --- a/erpnext/home/doctype/feed/feed.txt +++ b/erpnext/home/doctype/feed/feed.txt @@ -5,77 +5,85 @@ { 'creation': '2011-04-06 18:11:38', 'docstatus': 0, - 'modified': '2012-02-03 11:28:16', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-08 11:35:40', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - 'autoname': '_FEED.#####', - 'colour': 'White:FFF', - 'default_print_format': 'Standard', + 'autoname': u'_FEED.#####', + 'colour': u'White:FFF', + 'default_print_format': u'Standard', 'doctype': 'DocType', - 'module': 'Home', + 'module': u'Home', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 2 + 'version': 3 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Feed', - 'parentfield': 'fields', - 'parenttype': 'DocType', + 'parent': u'Feed', + 'parentfield': u'fields', + 'parenttype': u'DocType', 'permlevel': 0 }, # DocType, Feed { 'doctype': 'DocType', - 'name': 'Feed' + 'name': u'Feed' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'feed_type', - 'fieldtype': 'Select', - 'label': 'Feed Type' + 'doctype': u'DocField', + 'fieldname': u'feed_type', + 'fieldtype': u'Select', + 'label': u'Feed Type' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'doc_type', - 'fieldtype': 'Data', - 'label': 'Doc Type' + 'doctype': u'DocField', + 'fieldname': u'doc_type', + 'fieldtype': u'Data', + 'label': u'Doc Type' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'doc_name', - 'fieldtype': 'Data', - 'label': 'Doc Name' + 'doctype': u'DocField', + 'fieldname': u'doc_name', + 'fieldtype': u'Data', + 'label': u'Doc Name' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'subject', - 'fieldtype': 'Data', - 'label': 'Subject' + 'doctype': u'DocField', + 'fieldname': u'subject', + 'fieldtype': u'Data', + 'label': u'Subject' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'color', - 'fieldtype': 'Data', - 'label': 'Color' + 'doctype': u'DocField', + 'fieldname': u'color', + 'fieldtype': u'Data', + 'label': u'Color' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'full_name', + 'fieldtype': u'Data', + 'label': u'Full Name' } ] \ No newline at end of file diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index 90aef9e6961..9a76d16892a 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -457,11 +457,10 @@ FeedList.prototype.make_list = function() { parent: this.list_area, query: repl('select \ distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \ - concat(ifnull(t2.first_name,""), " ", ifnull(t2.last_name,"")) as full_name, \ + if(ifnull(t1.full_name,"")="", t1.owner, t1.full_name) as full_name, \ t1.modified, t1.color \ - from tabFeed t1, tabProfile t2, tabUserRole t3, tabDocPerm t4 \ + from tabFeed t1, tabUserRole t3, tabDocPerm t4 \ where t1.doc_type = t4.parent \ - and t2.name = t1.owner \ and t3.parent = "%(user)s" \ and t4.role = t3.role \ and ifnull(t4.`read`,0) = 1 \ diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 3c6281f1fda..d9fbbedfd3e 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -38,7 +38,6 @@ def on_login_post_session(login_manager): def comment_added(doc): """add comment to feed""" - import json home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by, '"' + doc.comment + '"', '#6B24B3') diff --git a/erpnext/startup/modules.js b/erpnext/startup/modules.js index c22aee00b25..0280c742651 100644 --- a/erpnext/startup/modules.js +++ b/erpnext/startup/modules.js @@ -15,10 +15,6 @@ pscript.startup_make_sidebar = function() { new SidebarItem(ml[m]); } } - if(in_list(user_roles, 'System Manager')) { - var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'}); - $(div).html('[edit]').click(pscript.startup_set_module_order) - } nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }}); // select current @@ -352,33 +348,3 @@ SidebarModuleItem = function(si, det) { si.show_section(me.det.doc_type); } } - - -// ==================================================================== -// Drag & Drop order selection -// ==================================================================== - -pscript.startup_set_module_order = function() { - var update_order= function(ml) { - mdict = {}; - for(var i=0; iNote: These changes will apply to all users!', ml, update_order, 1); - } - $c_obj('Home Control', 'get_module_order', '', callback) - -} - - - diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index 8a90b1b0038..7d60d84348e 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -61,6 +61,27 @@ header .topbar .container { overflow-x: hidden; } +.web-page-status { + background-color: #DDD; + padding: 7px; + color: #777; + clear: both; + text-align: right; +} + +.web-page-status a, +.web-page-status a:hover, +.web-page-status a:visited { + padding: 2px; + background-color: #777; + color: #FFF; + text-decoration: none; +} + +.web-page-status a:hover { + background-color: #444; +} + footer { color: #777; } diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index c83b922d507..5e50327e047 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -23,8 +23,11 @@ class DocType(): from jinja2 import Template import markdown2 import os + from webnotes.utils import global_date_format, get_full_name self.doc.content_html = markdown2.markdown(self.doc.content or '') + self.doc.full_name = get_full_name(self.doc.owner) + self.doc.updated = global_date_format(self.doc.modified) with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f: p.content = Template(f.read()).render(doc=self.doc) @@ -35,5 +38,11 @@ class DocType(): p.save() website.utils.add_guest_access_to_page(p.name) + + # cleanup + for f in ['content_html', 'full_name', 'updated']: + if f in self.doc.fields: + del self.doc.fields[f] + \ No newline at end of file diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js index 1df9b5498c0..3ad25356ff4 100644 --- a/erpnext/website/doctype/blog/blog_page.js +++ b/erpnext/website/doctype/blog/blog_page.js @@ -25,14 +25,14 @@ pscript['onload_{{ doc.name }}'] = function(wrapper) { wrapper.comment_list = new wn.widgets.Listing({ parent: $(wrapper).find('.web-main-section').get(0), - query: 'select comment, comment_by_fullname, comment_date\ + query: 'select comment, comment_by_fullname, modified\ from `tabComment Widget Record` where comment_doctype="Page"\ and comment_docname="{{ doc.name }}"', no_result_message: 'Be the first one to comment', render_row: function(parent, data) { - data.comment_date = dateutil.str_to_user(data.comment_date); + data.comment_date = prettyDate(data.modified); $(parent).html(repl("
    \ - On %(comment_date)s %(comment_by_fullname)s said:\ + %(comment_by_fullname)s | %(comment_date)s:\
    \

    %(comment)s


    ", data)) }, diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html index f70bacb7287..1b81fe2d905 100644 --- a/erpnext/website/doctype/blog/template.html +++ b/erpnext/website/doctype/blog/template.html @@ -2,7 +2,8 @@

    Blog

    -

    {{ doc.title }}

    +

    {{ doc.title }}

    +
    By {{ doc.full_name }} on {{ doc.updated }}

    {{ doc.content_html }}
    diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html index faacca1566a..1fb613c70dd 100644 --- a/erpnext/website/doctype/web_page/template.html +++ b/erpnext/website/doctype/web_page/template.html @@ -14,11 +14,15 @@
    {{ doc.side_section_html }} {% if doc.see_also %} +

    See Also

    {{ doc.see_also }} +
    {% endif %}
    -
    -
    +
    -
    \ No newline at end of file +
    +
    + Last Modified: {{ doc.updated }} Feedback +
    diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index 8f7c38f18d7..e262bfe7577 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -14,8 +14,10 @@ class DocType: p = website.utils.add_page(self.doc.title) from jinja2 import Template + from webnotes.utils import global_date_format import os + self.doc.updated = global_date_format(self.doc.modified) website.utils.markdown(self.doc, ['head_section','main_section', 'side_section']) self.add_page_links() @@ -31,24 +33,21 @@ class DocType: def add_page_links(self): """add links for next_page and see_also""" if self.doc.next_page: - self.doc.next_page_html = """
    -

    Next: - %(title)s

    """ % {"name":self.doc.next_page, \ + self.doc.next_page_html = """
    + Next: + %(title)s
    """ % {"name":self.doc.next_page, \ "title": webnotes.conn.get_value("Page", self.doc.next_page, "title")} self.doc.see_also = '' for d in self.doclist: if d.doctype=='Related Page': tmp = {"page":d.page, "title":webnotes.conn.get_value('Page', d.page, 'title')} - self.doc.see_also += """
  • %(title)s
  • """ % tmp - - if self.doc.see_also: - self.doc.see_also = '
      %s
    ' % self.doc.see_also - + self.doc.see_also += """""" % tmp + def cleanup_temp(self): """cleanup temp fields""" fl = ['main_section_html', 'side_section_html', 'see_also', \ - 'next_page_html', 'head_section_html'] + 'next_page_html', 'head_section_html', 'updated'] for f in fl: if f in self.doc.fields: del self.doc.fields[f] diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js index 6be1d0768f4..9e89acdca83 100644 --- a/erpnext/website/page/blog/blog.js +++ b/erpnext/website/page/blog/blog.js @@ -10,9 +10,9 @@ pscript.onload_blog = function(wrapper) { render_row: function(parent, data) { if(data.content.length==300) data.content += '...'; data.date = prettyDate(data.modified); - parent.innerHTML = repl('

    %(title)s

    \ -
    By %(first_name)s %(last_name)s on %(date)s
    \ -

    %(content)s


    ', data); + parent.innerHTML = repl('

    %(title)s

    \ +

    By %(first_name)s %(last_name)s on %(date)s

    \ +
    %(content)s

    ', data); }, page_length: 10 }); diff --git a/version.num b/version.num index 24f98f2d5fb..6d540e9f236 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -367 \ No newline at end of file +382 \ No newline at end of file From f16e32eca1be252ef0803af286208e76f4ef445c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Feb 2012 16:16:28 +0530 Subject: [PATCH 60/70] report builder fix' --- erpnext/website/css/website.css | 1 - version.num | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index 7d60d84348e..28303dbd343 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -62,7 +62,6 @@ header .topbar .container { } .web-page-status { - background-color: #DDD; padding: 7px; color: #777; clear: both; diff --git a/version.num b/version.num index 6d540e9f236..be6c136492c 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -382 \ No newline at end of file +383 \ No newline at end of file From 0b2874afdb24754c6f2281f80fd1547952ed6a24 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 9 Feb 2012 12:45:50 +0530 Subject: [PATCH 61/70] fix to install --- erpnext/patches/jan_mar_2012/website/__init__.py | 2 ++ erpnext/patches/jan_mar_2012/website/all.py | 10 ++++++++++ erpnext/patches/jan_mar_2012/website/cleanups.py | 4 ---- erpnext/patches/jan_mar_2012/website/website.py | 5 ++++- wnf.py | 8 ++++++++ 5 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/website/all.py diff --git a/erpnext/patches/jan_mar_2012/website/__init__.py b/erpnext/patches/jan_mar_2012/website/__init__.py index e69de29bb2d..680c79a18ef 100644 --- a/erpnext/patches/jan_mar_2012/website/__init__.py +++ b/erpnext/patches/jan_mar_2012/website/__init__.py @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/erpnext/patches/jan_mar_2012/website/all.py b/erpnext/patches/jan_mar_2012/website/all.py new file mode 100644 index 00000000000..03b79775e1f --- /dev/null +++ b/erpnext/patches/jan_mar_2012/website/all.py @@ -0,0 +1,10 @@ +import patches.jan_mar_2012.website.login +import patches.jan_mar_2012.website.feed +import patches.jan_mar_2012.website.website +import patches.jan_mar_2012.website.cleanups + +def execute(): + patches.jan_mar_2012.website.login.execute() + patches.jan_mar_2012.website.feed.execute() + patches.jan_mar_2012.website.website.execute() + patches.jan_mar_2012.website.cleanups.execute() \ No newline at end of file diff --git a/erpnext/patches/jan_mar_2012/website/cleanups.py b/erpnext/patches/jan_mar_2012/website/cleanups.py index 9a78a70dd51..b7b7736ad74 100644 --- a/erpnext/patches/jan_mar_2012/website/cleanups.py +++ b/erpnext/patches/jan_mar_2012/website/cleanups.py @@ -12,10 +12,6 @@ def execute(): # cleanup control panel delete_doc("DocType", "Control Panel") reload_doc("core", "doctype", "control_panel") - - # cleanup page - delete_doc("DocType", "Page") - reload_doc("core", "doctype", "page") webnotes.conn.sql("""delete from tabSingles where field like 'startup_%' and doctype='Control Panel'""") diff --git a/erpnext/patches/jan_mar_2012/website/website.py b/erpnext/patches/jan_mar_2012/website/website.py index 4ffb4417388..3494b709d2e 100644 --- a/erpnext/patches/jan_mar_2012/website/website.py +++ b/erpnext/patches/jan_mar_2012/website/website.py @@ -8,6 +8,10 @@ def execute(): from webnotes.modules import reload_doc from webnotes.model import delete_doc + # cleanup page + delete_doc("DocType", "Page") + reload_doc("core", "doctype", "page") + reload_doc('setup', 'doctype', 'item_group') delete_doc('Website', 'Module Def', 'Website') reload_doc('website', 'Module Def', 'Website') @@ -23,7 +27,6 @@ def execute(): reload_doc('website', 'doctype', 'about_us_settings') reload_doc('website', 'doctype', 'about_us_team') reload_doc('website', 'doctype', 'blog') - reload_doc('website', 'doctype', 'blog_subscriber') reload_doc('website', 'doctype', 'contact_us_settings') reload_doc('website', 'doctype', 'product') reload_doc('website', 'doctype', 'product_group') diff --git a/wnf.py b/wnf.py index 52308d0902a..cc82eb56ed9 100755 --- a/wnf.py +++ b/wnf.py @@ -54,6 +54,8 @@ def setup_options(): help="reload doc") parser.add_option('--export_doc', nargs=2, metavar = "doctype docname", help="export doc") + parser.add_option('--install', nargs=3, metavar = "rootpassword dbname source", + help="install fresh db") return parser.parse_args() @@ -132,6 +134,12 @@ def run(): webnotes.modules.patch_handler.run_all() print '\n'.join(webnotes.modules.patch_handler.log_list) + elif options.install: + from webnotes.install_lib.install import Installer + inst = Installer('root', options.install[0]) + inst.import_from_db(options.install[1], source_path=options.install[2], \ + password='admin', verbose = 1) + # print messages if webnotes.message_log: print '\n'.join(webnotes.message_log) From ad37575701f5ae508c50f74a65ae5d3e34d9e226 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 Feb 2012 12:48:04 +0530 Subject: [PATCH 62/70] First name and last name in setup account dialog --- .../event_updates/complete_registration.js | 32 +++++- .../home/page/event_updates/event_updates.js | 108 ------------------ 2 files changed, 26 insertions(+), 114 deletions(-) diff --git a/erpnext/home/page/event_updates/complete_registration.js b/erpnext/home/page/event_updates/complete_registration.js index 4ed3fe984bc..e7e05742211 100644 --- a/erpnext/home/page/event_updates/complete_registration.js +++ b/erpnext/home/page/event_updates/complete_registration.js @@ -1,14 +1,18 @@ // complete my company registration // -------------------------------- -pscript.complete_registration = function(is_complete) { +pscript.complete_registration = function(is_complete, profile) { if(is_complete == 'No'){ - var d = new Dialog(400, 200, "Please Complete Your Registration"); + var d = new Dialog(400, 200, "Setup your Account"); if(user != 'Administrator'){ d.no_cancel(); // Hide close image $('header').toggle(false); } d.make_body([ + ['HTML', 'Your Profile Details', '

    Your Profile Details

    '], + ['Data', 'First Name'], + ['Data', 'Last Name'], + ['HTML', 'Company Details', '

    Create your first company

    '], ['Data','Company Name','Example: Your Company LLC'], ['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'], ['Select','Fiscal Year Start Date'], @@ -23,6 +27,16 @@ pscript.complete_registration = function(is_complete) { d.widgets['Company Name'].disabled = 1; } + if(profile && profile.length>0) { + if(profile[0].first_name && profile[0].first_name!='None') { + d.widgets['First Name'].value = profile[0].first_name; + } + + if(profile[0].last_name && profile[0].last_name!='None') { + d.widgets['Last Name'].value = profile[0].last_name; + } + } + //d.widgets['Save'].disabled = true; // disable Save button pscript.make_dialog_field(d); @@ -39,14 +53,20 @@ pscript.complete_registration = function(is_complete) { d.widgets['Company Name'].value, d.widgets['Company Abbreviation'].value, d.widgets['Fiscal Year Start Date'].value, - d.widgets['Default Currency'].value + d.widgets['Default Currency'].value, + d.widgets['First Name'].value, + d.widgets['Last Name'].value ]; $c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){ sys_defaults = r.message; + user_fullname = r.message.user_fullname; d.hide(); $('header').toggle(true); + page_body.wntoolbar.set_user_name(); }); + } else { + d.widgets['Save'].done_working(); } } d.show(); @@ -72,12 +92,12 @@ pscript.make_dialog_field = function(d) // --------------- pscript.validate_fields = function(d) { - var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency']; + var lst = ['First Name', 'Company Name', 'Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency']; var msg = 'Please enter the following fields'; var flag = 1; for(var i=0; iYour Profile Details'], - ['Data', 'First Name'], - ['Data', 'Last Name'], - ['HTML', 'Company Details', '

    Create your first company

    '], - ['Data','Company Name','Example: Your Company LLC'], - ['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'], - ['Select','Fiscal Year Start Date'], - ['Select','Default Currency'], - ['Button','Save'], - ]); - - // if company name is set, set the input value - // and disable it - if(locals['Control Panel']['Control Panel'].company_name) { - d.widgets['Company Name'].value = locals['Control Panel']['Control Panel'].company_name; - d.widgets['Company Name'].disabled = 1; - } - - if(profile && profile.length>0) { - if(profile[0].first_name && profile[0].first_name!='None') { - d.widgets['First Name'].value = profile[0].first_name; - } - - if(profile[0].last_name && profile[0].last_name!='None') { - d.widgets['Last Name'].value = profile[0].last_name; - } - } - - //d.widgets['Save'].disabled = true; // disable Save button - pscript.make_dialog_field(d); - - // submit details - d.widgets['Save'].onclick = function() - { - d.widgets['Save'].set_working(); - - flag = pscript.validate_fields(d); - if(flag) - { - var args = [ - d.widgets['Company Name'].value, - d.widgets['Company Abbreviation'].value, - d.widgets['Fiscal Year Start Date'].value, - d.widgets['Default Currency'].value, - d.widgets['First Name'].value, - d.widgets['Last Name'].value - ]; - - $c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){ - sys_defaults = r.message.sys_defaults; - user_fullname = r.message.user_fullname; - d.hide(); - $ds(page_body.wntoolbar.wrapper); - $('#user_fullname').html(user_fullname + " (Profile Settings)"); - }); - } else { - d.widgets['Save'].done_working(); - } - } - d.show(); - } -} - -// make dialog fields -// ------------------ -pscript.make_dialog_field = function(d) -{ - // fiscal year format - fisc_format = d.widgets['Fiscal Year Start Date']; - add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']); - - // default currency - currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR']; - currency = d.widgets['Default Currency']; - add_sel_options(currency, currency_list); -} - - -// validate fields -// --------------- -pscript.validate_fields = function(d) -{ - var lst = ['First Name', 'Company Name', 'Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency']; - var msg = 'Please enter the following fields\n'; - var flag = 1; - for(var i=0; i Date: Thu, 9 Feb 2012 13:34:12 +0530 Subject: [PATCH 63/70] added sync_with_gateway change function in wnf.py --- version.num | 2 +- wnf.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/version.num b/version.num index be6c136492c..e41567feb87 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -383 \ No newline at end of file +384 \ No newline at end of file diff --git a/wnf.py b/wnf.py index cc82eb56ed9..4f18187fccb 100755 --- a/wnf.py +++ b/wnf.py @@ -56,7 +56,8 @@ def setup_options(): help="export doc") parser.add_option('--install', nargs=3, metavar = "rootpassword dbname source", help="install fresh db") - + parser.add_option('--sync_with_gateway', nargs=1, metavar = "1/0", help="Set or Unset Sync with Gateway") + return parser.parse_args() def run(): @@ -138,7 +139,18 @@ def run(): from webnotes.install_lib.install import Installer inst = Installer('root', options.install[0]) inst.import_from_db(options.install[1], source_path=options.install[2], \ - password='admin', verbose = 1) + password='admin', verbose = 1) + + elif options.sync_with_gateway: + if int(options.sync_with_gateway[0]) in [0, 1]: + webnotes.conn.begin() + webnotes.conn.sql("""\ + UPDATE `tabSingles` SET value=%s + WHERE field='sync_with_gateway' AND doctype='Control Panel'""", int(options.sync_with_gateway[0])) + webnotes.conn.commit() + webnotes.message_log.append("sync_with_gateway set to %s" % options.sync_with_gateway[0]) + else: + webnotes.message_log.append("ERROR: sync_with_gateway can be either 0 or 1") # print messages if webnotes.message_log: From ba746dfb2f3dd917c56826fcb1a3ebe31f62f660 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 10 Feb 2012 15:46:54 +0530 Subject: [PATCH 64/70] Stop support ticket refresh on send, if there is a server message --- erpnext/support/doctype/support_ticket/support_ticket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js index 2b379db4324..397ee8d7699 100644 --- a/erpnext/support/doctype/support_ticket/support_ticket.js +++ b/erpnext/support/doctype/support_ticket/support_ticket.js @@ -84,7 +84,7 @@ $.extend(cur_frm.cscript, { Send: function(doc, dt, dn) { $c_obj([doc], 'send_response', '', function(r,rt) { locals[dt][dn].new_response = ''; - if(!r.exc) { + if(!(r.exc || r.server_messages)) { cur_frm.refresh(); } }); From 945b3c46802dac95c6a4ef7c91960e8477a1ad07 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 13 Feb 2012 14:04:54 +0530 Subject: [PATCH 65/70] Domain Name list in Website Settings --- .../doctype/setup_control/setup_control.py | 17 +- .../website_settings/website_settings.py | 37 +++- .../website_settings/website_settings.txt | 199 +++++++++++------- 3 files changed, 170 insertions(+), 83 deletions(-) diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 6616338e421..194da7a4bee 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -35,13 +35,24 @@ class DocType: # set account details #----------------------- def set_account_details(self, args): - args = eval(args) + """ + Called from gateway after allocation + """ + import json + args = json.loads(args) self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name']) self.create_profile(args['user'], args['first_name'], args['last_name']) - from server_tools.gateway_utils import update_client_control - update_client_control(args['total_users']) + # Domain related updates + try: + from server_tools.gateway_utils import add_domain_map + add_domain_map(args) + except ImportError, e: + pass + + # add record in domain_list of Website Settings + webnotes.conn.set_value('Website Settings', 'Website Settings', 'subdomain', args['url_name'] + ".erpnext.com") # Account Setup diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py index 0cbc97d24e3..fb30f7be5a5 100644 --- a/erpnext/website/doctype/website_settings/website_settings.py +++ b/erpnext/website/doctype/website_settings/website_settings.py @@ -3,8 +3,21 @@ class DocType: self.doc, self.doclist = d, dl def validate(self): - """clear cache""" - # set home page + """ + * set home page + * validate domain list + * clear cache + """ + self.set_home_page() + + self.validate_domain_list() + + from webnotes.session_cache import clear_cache + clear_cache('Guest') + + + def set_home_page(self): + import webnotes from webnotes.model.doc import Document @@ -15,6 +28,20 @@ class DocType: d.role = 'Guest' d.home_page = self.doc.home_page d.save() - - from webnotes.session_cache import clear_cache - clear_cache('Guest') \ No newline at end of file + + + def validate_domain_list(self): + """ + Validate domain list if SaaS + """ + import webnotes + + try: + from server_tools.gateway_utils import validate_domain_list + res = validate_domain_list(self.doc.domain_list, webnotes.conn.cur_db_name) + if not res: + webnotes.msgprint("""\ + There was some error in validating the domain list. + Please contact us at support@erpnext.com""", raise_exception=1) + except ImportError, e: + pass diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt index aaa73272576..0ceac4715a9 100644 --- a/erpnext/website/doctype/website_settings/website_settings.txt +++ b/erpnext/website/doctype/website_settings/website_settings.txt @@ -3,158 +3,207 @@ # These values are common in all dictionaries { - 'creation': '2012-02-02 13:19:50', + 'creation': '2012-02-02 13:51:29', 'docstatus': 0, - 'modified': '2012-02-02 13:31:24', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-02-13 12:23:36', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1328169455', + '_last_update': u'1329115882', 'allow_attach': 1, - 'colour': 'White:FFF', + 'colour': u'White:FFF', 'doctype': 'DocType', - 'document_type': 'Other', + 'document_type': u'Other', 'issingle': 1, 'max_attachments': 1, - 'module': 'Website', + 'module': u'Website', 'name': '__common__', - 'section_style': 'Simple', + 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 3 + 'version': 8 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Website Settings', - 'parentfield': 'fields', - 'parenttype': 'DocType', - 'permlevel': 0 + 'parent': u'Website Settings', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Website Settings', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'permlevel': 0, - 'read': 1, - 'write': 1 + 'parent': u'Website Settings', + 'parentfield': u'permissions', + 'parenttype': u'DocType', + 'read': 1 }, # DocType, Website Settings { 'doctype': 'DocType', - 'name': 'Website Settings' + 'name': u'Website Settings' }, # DocPerm { - 'doctype': 'DocPerm', - 'role': 'System Manager' + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', - 'role': 'Website Manager' + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Website Manager', + 'write': 1 + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Top Bar' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Top Bar', + 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.', - 'doctype': 'DocField', - 'fieldname': 'title_prefix', - 'fieldtype': 'Data', - 'label': 'Title Prefix' + 'colour': u'White:FFF', + 'description': u'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.', + 'doctype': u'DocField', + 'fieldname': u'title_prefix', + 'fieldtype': u'Data', + 'label': u'Title Prefix', + 'permlevel': 0 }, # DocField { - 'colour': 'White:FFF', - 'description': 'The "Web Page" that is the website home page', - 'doctype': 'DocField', - 'fieldname': 'home_page', - 'fieldtype': 'Link', - 'label': 'Home Page', - 'options': 'Web Page', + 'colour': u'White:FFF', + 'description': u'The "Web Page" that is the website home page', + 'doctype': u'DocField', + 'fieldname': u'home_page', + 'fieldtype': u'Link', + 'label': u'Home Page', + 'options': u'Web Page', + 'permlevel': 0, 'reqd': 1 }, # DocField { - 'colour': 'White:FFF', - 'description': 'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag', - 'doctype': 'DocField', - 'fieldname': 'brand_html', - 'fieldtype': 'Text', - 'label': 'Brand HTML' + 'colour': u'White:FFF', + 'description': u'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag', + 'doctype': u'DocField', + 'fieldname': u'brand_html', + 'fieldtype': u'Text', + 'label': u'Brand HTML', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'top_bar_items', - 'fieldtype': 'Table', - 'label': 'Top Bar Items', - 'options': 'Top Bar Item' + 'doctype': u'DocField', + 'fieldname': u'top_bar_items', + 'fieldtype': u'Table', + 'label': u'Top Bar Items', + 'options': u'Top Bar Item', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Footer' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Footer', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'address', - 'fieldtype': 'Text', - 'label': 'Address' + 'doctype': u'DocField', + 'fieldname': u'address', + 'fieldtype': u'Text', + 'label': u'Address', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'copyright', - 'fieldtype': 'Data', - 'label': 'Copyright' + 'doctype': u'DocField', + 'fieldname': u'copyright', + 'fieldtype': u'Data', + 'label': u'Copyright', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'footer_items', - 'fieldtype': 'Table', - 'label': 'Footer Items', - 'options': 'Top Bar Item' + 'doctype': u'DocField', + 'fieldname': u'footer_items', + 'fieldtype': u'Table', + 'label': u'Footer Items', + 'options': u'Top Bar Item', + 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'file_list', - 'fieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'file_list', + 'fieldtype': u'Text', 'hidden': 1, - 'label': 'File List', + 'label': u'File List', 'no_copy': 1, + 'permlevel': 0, 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Domains', + 'permlevel': 0 + }, + + # DocField + { + 'description': u'Sub-domain provided by erpnext.com', + 'doctype': u'DocField', + 'fieldname': u'subdomain', + 'fieldtype': u'Text', + 'label': u'Your ERPNext provided hostname', + 'permlevel': 1, + 'reqd': 0 + }, + + # DocField + { + 'description': u'Enter domain names associated to this website, each on a new line', + 'doctype': u'DocField', + 'fieldname': u'domain_list', + 'fieldtype': u'Text', + 'label': u'Domain List', + 'permlevel': 0, + 'reqd': 0 } ] \ No newline at end of file From ff0946bbda20aa284d7d2b86b855fa8dc788a138 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 13 Feb 2012 15:26:17 +0530 Subject: [PATCH 66/70] naming fix in web page, list style --- erpnext/website/doctype/web_page/web_page.py | 7 +++++-- version.num | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index e262bfe7577..0a1a60e0109 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -10,8 +10,11 @@ class DocType: self.doc.name = website.utils.page_name(self.doc.title) def validate(self): - """make page for this product""" - p = website.utils.add_page(self.doc.title) + """make page for this product""" + if not self.doc.name: + self.doc.name = website.utils.page_name(self.doc.title) + + p = website.utils.add_page(self.doc.name) from jinja2 import Template from webnotes.utils import global_date_format diff --git a/version.num b/version.num index e41567feb87..1380537bfd7 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -384 \ No newline at end of file +385 \ No newline at end of file From f17ce7bc6782b46c71eebef0067ecc2a6315bed3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 13 Feb 2012 16:50:52 +0530 Subject: [PATCH 67/70] added whitelist check --- erpnext/accounts/__init__.py | 3 +- erpnext/home/page/dashboard/dashboard.py | 5 +-- .../home/page/event_updates/event_updates.py | 11 +++--- erpnext/home/page/my_company/my_company.py | 26 +++++--------- .../page/profile_settings/profile_settings.py | 4 +++ .../page/question_view/question_view.py | 7 ++-- .../page/questions/questions.py | 4 ++- erpnext/selling/page/customers/__init__.py | 0 erpnext/selling/page/customers/customers.html | 1 - erpnext/selling/page/customers/customers.js | 34 ------------------- erpnext/selling/page/customers/customers.txt | 26 -------------- .../doctype/manage_account/manage_account.py | 9 +---- .../doctype/setup_control/setup_control.py | 2 +- erpnext/setup/page/people/__init__.py | 0 erpnext/setup/page/people/people.html | 1 - erpnext/setup/page/people/people.js | 32 ----------------- erpnext/setup/page/people/people.txt | 26 -------------- erpnext/website/page/blog/blog.py | 2 ++ erpnext/website/page/contact/contact.py | 1 + .../website/page/unsubscribe/unsubscribe.py | 4 ++- 20 files changed, 38 insertions(+), 160 deletions(-) delete mode 100644 erpnext/selling/page/customers/__init__.py delete mode 100644 erpnext/selling/page/customers/customers.html delete mode 100644 erpnext/selling/page/customers/customers.js delete mode 100644 erpnext/selling/page/customers/customers.txt delete mode 100644 erpnext/setup/page/people/__init__.py delete mode 100644 erpnext/setup/page/people/people.html delete mode 100644 erpnext/setup/page/people/people.js delete mode 100644 erpnext/setup/page/people/people.txt diff --git a/erpnext/accounts/__init__.py b/erpnext/accounts/__init__.py index c3c50052e47..65d023130e6 100644 --- a/erpnext/accounts/__init__.py +++ b/erpnext/accounts/__init__.py @@ -2,6 +2,7 @@ import webnotes from webnotes.utils import flt from webnotes.model.code import get_obj +@webnotes.whitelist() def get_default_bank_account(): """ Get default bank account for a company @@ -14,7 +15,7 @@ def get_default_bank_account(): if res: return res[0][0] - +@webnotes.whitelist() def get_new_jv_details(): """ Get details which will help create new jv on sales/purchase return diff --git a/erpnext/home/page/dashboard/dashboard.py b/erpnext/home/page/dashboard/dashboard.py index c2378d3155e..e8f11fbc5cd 100644 --- a/erpnext/home/page/dashboard/dashboard.py +++ b/erpnext/home/page/dashboard/dashboard.py @@ -54,11 +54,12 @@ dashboards = [ } ] +import webnotes + class DashboardWidget: def __init__(self, company, start, end, interval): from webnotes.utils import getdate from webnotes.model.code import get_obj - import webnotes self.company = company self.abbr = webnotes.conn.get_value('Company', company, 'abbr') @@ -233,7 +234,7 @@ class DashboardWidget: elif opts['type']=='creation': return self.get_creation_trend(opts['doctype'], start, end) - +@webnotes.whitelist() def load_dashboard(args): """ Get dashboard based on diff --git a/erpnext/home/page/event_updates/event_updates.py b/erpnext/home/page/event_updates/event_updates.py index e4690d00867..cb27043e0e4 100644 --- a/erpnext/home/page/event_updates/event_updates.py +++ b/erpnext/home/page/event_updates/event_updates.py @@ -1,6 +1,7 @@ import webnotes from webnotes.utils import cint +@webnotes.whitelist() def get_online_users(): # get users return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name @@ -9,9 +10,7 @@ def get_online_users(): and t1.user not in ('Guest','Administrator') and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or [] -# -# get unread messages -# +@webnotes.whitelist() def get_unread_messages(): "returns unread (docstatus-0 messages for a user)" return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record` @@ -20,10 +19,9 @@ def get_unread_messages(): AND ifnull(docstatus,0)=0 """, webnotes.user.name)[0][0]) -# -# Get toolbar items -# +@webnotes.whitelist() def get_status_details(arg=None): + """get toolbar items""" from webnotes.utils import cint, date_diff, nowdate, get_defaults online = get_online_users() @@ -43,6 +41,7 @@ def get_status_details(arg=None): } return ret +@webnotes.whitelist() def get_setup_status(): """ Returns the setup status of the current account diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py index 48566f2de18..8070c9d5f8e 100644 --- a/erpnext/home/page/my_company/my_company.py +++ b/erpnext/home/page/my_company/my_company.py @@ -6,13 +6,12 @@ from webnotes.model.doc import Document try: import json except: import simplejson as json +@webnotes.whitelist() def get_account_settings_url(arg=''): import server_tools.gateway_utils return server_tools.gateway_utils.get_account_settings_url() -# -# set max users -# +@webnotes.whitelist() def get_max_users(arg=''): from server_tools.gateway_utils import get_max_users_gateway return { @@ -20,16 +19,12 @@ def get_max_users(arg=''): 'enabled': cint(webnotes.conn.sql("select count(*) from tabProfile where ifnull(enabled,0)=1 and name not in ('Administrator', 'Guest')")[0][0]) } -# -# enable profile in local -# +@webnotes.whitelist() def enable_profile(arg=''): webnotes.conn.sql("update tabProfile set enabled=1 where name=%s", arg) return 1 -# -# disable profile in local -# +@webnotes.whitelist() def disable_profile(arg=''): if arg=='Administrator': return 'Cannot disable Administrator' @@ -38,9 +33,7 @@ def disable_profile(arg=''): webnotes.login_manager.logout(user=arg) return 0 -# -# delete user -# +@webnotes.whitelist() def delete_user(args): args = json.loads(args) webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s", args['user']) @@ -49,9 +42,7 @@ def delete_user(args): from server_tools.gateway_utils import remove_user_gateway remove_user_gateway(args['user']) -# -# add user -# +@webnotes.whitelist() def add_user(args): args = json.loads(args) # erpnext-saas @@ -61,9 +52,7 @@ def add_user(args): add_profile(args) -# -# add profile record -# +@webnotes.whitelist() def add_profile(args): from webnotes.utils import validate_email_add, now email = args['user'] @@ -99,6 +88,7 @@ def add_profile(args): send_welcome_mail(email, args) +@webnotes.whitelist() def send_welcome_mail(email, args): """send welcome mail to user with password and login url""" pr = Document('Profile', email) diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py index ef969ca46f5..cbfb188b9dc 100644 --- a/erpnext/home/page/profile_settings/profile_settings.py +++ b/erpnext/home/page/profile_settings/profile_settings.py @@ -2,6 +2,7 @@ import webnotes from webnotes.utils import load_json, cint, nowdate +@webnotes.whitelist() def change_password(arg): """ Change password @@ -15,12 +16,14 @@ def change_password(arg): webnotes.conn.sql("update tabProfile set password=password(%s), modified=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user'])) webnotes.msgprint('Password Updated'); +@webnotes.whitelist() def get_user_details(arg=None): """ Returns user first name, last name and bio """ return webnotes.conn.sql("select first_name, last_name, bio from tabProfile where name=%s", webnotes.user.name, as_dict=1)[0] +@webnotes.whitelist() def set_user_details(arg=None): """ updates user details given in argument @@ -35,6 +38,7 @@ def set_user_details(arg=None): p.save() webnotes.msgprint('Updated') +@webnotes.whitelist() def set_user_image(fid, fname): """ Set uploaded image as user image diff --git a/erpnext/knowledge_base/page/question_view/question_view.py b/erpnext/knowledge_base/page/question_view/question_view.py index a2eafbcf597..c711b9054ff 100644 --- a/erpnext/knowledge_base/page/question_view/question_view.py +++ b/erpnext/knowledge_base/page/question_view/question_view.py @@ -1,19 +1,22 @@ import webnotes from webnotes.utils import load_json, cstr, now -# update the editable text item +@webnotes.whitelist() def update_item(args): args = load_json(args) webnotes.conn.sql("update `tab%s` set `%s`=%s, modified=%s where name=%s" \ % (args['dt'], args['fn'], '%s', '%s', '%s'), (args['text'], now(), args['dn'])) - + +@webnotes.whitelist() def has_answered(arg): return webnotes.conn.sql("select name from tabAnswer where owner=%s and question=%s", (webnotes.user.name, arg)) and 'Yes' or 'No' +@webnotes.whitelist() def get_question(arg): return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0]) +@webnotes.whitelist() def add_answer(args): args = load_json(args) diff --git a/erpnext/knowledge_base/page/questions/questions.py b/erpnext/knowledge_base/page/questions/questions.py index 5f8b209fe26..d3f0d7c52ec 100644 --- a/erpnext/knowledge_base/page/questions/questions.py +++ b/erpnext/knowledge_base/page/questions/questions.py @@ -3,6 +3,7 @@ import webnotes from webnotes.utils import load_json, cint, cstr # add a new question +@webnotes.whitelist() def add_question(arg): args = load_json(arg) @@ -22,7 +23,7 @@ def add_question(arg): 'notify': 1 }) - +@webnotes.whitelist() def vote(arg): args = load_json(arg) @@ -36,6 +37,7 @@ def vote(arg): return p +@webnotes.whitelist() def delete(arg): """ delete a question or answer (called from kb toolbar) diff --git a/erpnext/selling/page/customers/__init__.py b/erpnext/selling/page/customers/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/selling/page/customers/customers.html b/erpnext/selling/page/customers/customers.html deleted file mode 100644 index 9f3d19c0c92..00000000000 --- a/erpnext/selling/page/customers/customers.html +++ /dev/null @@ -1 +0,0 @@ -
    \ No newline at end of file diff --git a/erpnext/selling/page/customers/customers.js b/erpnext/selling/page/customers/customers.js deleted file mode 100644 index 7902e2476b9..00000000000 --- a/erpnext/selling/page/customers/customers.js +++ /dev/null @@ -1,34 +0,0 @@ -//make tabs - -pscript.onload_customers = function() { - make_customer_tab($i('dcv_customers')); -} - -function make_customer_tab(parent) { - pscript.dcv_customers = new wn.widgets.DocColumnView('Customers', parent, - ['Customer Group', 'Customer', 'Contact'], { - 'Customer Group': { - show_fields : ['name'], - create_fields : ['name'], - search_fields : ['name'], - next_col: 'Customer' - }, - 'Customer': { - show_fields : ['name', 'customer_name'], - create_fields : ['name', 'customer_name'], - search_fields : ['customer_name'], - filter_by : ['Customer Group', 'customer_group'], - next_col: 'Contact' - }, - 'Contact': { - show_fields : ['name', 'first_name', 'last_name'], - create_fields : ['name','first_name', 'last_name'], - search_fields : ['first_name', 'last_name'], - conditions: ['is_customer=1'], - set_values: {'is_customer': 1 }, - filter_by : ['Customer', 'customer'] - }, - }) -} - - diff --git a/erpnext/selling/page/customers/customers.txt b/erpnext/selling/page/customers/customers.txt deleted file mode 100644 index 7f44ab45e76..00000000000 --- a/erpnext/selling/page/customers/customers.txt +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - 'content': None, - 'creation': '2011-03-25 13:48:50', - 'docstatus': 0, - 'doctype': 'Page', - 'icon': None, - 'idx': None, - 'menu_index': None, - 'modified': '2011-03-25 13:48:50', - 'modified_by': 'Administrator', - 'module': 'CRM', - 'name': 'customers', - 'owner': 'Administrator', - 'page_name': 'Customers', - 'parent': None, - 'parent_node': None, - 'parentfield': None, - 'parenttype': None, - 'script': None, - 'show_in_menu': None, - 'standard': 'Yes', - 'static_content': None, - 'style': None - } -] \ No newline at end of file diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py index 757d323fef7..eed566e55e5 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.py +++ b/erpnext/setup/doctype/manage_account/manage_account.py @@ -30,17 +30,10 @@ class DocType: from webnotes.utils import fmt_money, flt bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year)) if bal: - return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1] - - def validate(self): - """validate""" - if not (self.doc.account_url and (self.doc.account_url.startswith('http://') \ - or self.doc.account_url.startswith('https://'))): - webnotes.msgprint("Account URL must start with 'http://' or 'https://'", raise_exception=1) + return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1] def on_update(self): """update defaults""" - self.validate() for key in keydict: webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], '')) diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 6616338e421..f2174023609 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -140,7 +140,7 @@ class DocType: for d in def_args.keys(): ma_obj.doc.fields[d] = def_args[d] ma_obj.doc.save() - ma_obj.update_cp() + ma_obj.on_update() # Set Control Panel Defaults diff --git a/erpnext/setup/page/people/__init__.py b/erpnext/setup/page/people/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/setup/page/people/people.html b/erpnext/setup/page/people/people.html deleted file mode 100644 index ad31e385106..00000000000 --- a/erpnext/setup/page/people/people.html +++ /dev/null @@ -1 +0,0 @@ -
    \ No newline at end of file diff --git a/erpnext/setup/page/people/people.js b/erpnext/setup/page/people/people.js deleted file mode 100644 index fd316bf098e..00000000000 --- a/erpnext/setup/page/people/people.js +++ /dev/null @@ -1,32 +0,0 @@ -//make tabs - -pscript.onload_people = function() { - make_customer_tab($i('crm_home')); -} - -function make_customer_tab(parent) { - new wn.widgets.DocColumnView('Customers', parent, ['Customer Group', 'Customer', 'Contact'], { - 'Customer Group': { - show_fields : ['name'], - create_fields : ['name'], - search_fields : ['name'], - next_col: 'Customer' - }, - 'Customer': { - show_fields : ['name', 'customer_name'], - create_fields : ['name', 'customer_name'], - search_fields : ['customer_name'], - filter_by : ['Customer Group', 'customer_group'], - next_col: 'Contact' - }, - 'Contact': { - show_fields : ['name', 'first_name', 'last_name'], - create_fields : ['name','first_name', 'last_name'], - search_fields : ['first_name', 'last_name'], - conditions: ['is_customer=1'], - filter_by : ['Customer', 'customer'] - }, - }) -} - - diff --git a/erpnext/setup/page/people/people.txt b/erpnext/setup/page/people/people.txt deleted file mode 100644 index 3e7bba297f0..00000000000 --- a/erpnext/setup/page/people/people.txt +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - 'content': None, - 'creation': '2011-03-21 12:12:32', - 'docstatus': 0, - 'doctype': 'Page', - 'icon': None, - 'idx': None, - 'menu_index': None, - 'modified': '2011-03-21 12:13:39', - 'modified_by': 'Administrator', - 'module': 'Setup', - 'name': 'people', - 'owner': 'Administrator', - 'page_name': 'People', - 'parent': None, - 'parent_node': None, - 'parentfield': None, - 'parenttype': None, - 'script': None, - 'show_in_menu': None, - 'standard': 'Yes', - 'static_content': None, - 'style': None - } -] \ No newline at end of file diff --git a/erpnext/website/page/blog/blog.py b/erpnext/website/page/blog/blog.py index 6e7a62e6aa1..2773624f4b8 100644 --- a/erpnext/website/page/blog/blog.py +++ b/erpnext/website/page/blog/blog.py @@ -1,4 +1,6 @@ import webnotes + +@webnotes.whitelist() def subscribe(arg): """subscribe to blog (blog_subscriber)""" if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg): diff --git a/erpnext/website/page/contact/contact.py b/erpnext/website/page/contact/contact.py index a6566a9b847..2fd00f7681e 100644 --- a/erpnext/website/page/contact/contact.py +++ b/erpnext/website/page/contact/contact.py @@ -1,5 +1,6 @@ import json, webnotes +@webnotes.whitelist() def send(args): """create support ticket""" args = json.loads(args) diff --git a/erpnext/website/page/unsubscribe/unsubscribe.py b/erpnext/website/page/unsubscribe/unsubscribe.py index 57d1d47f869..c310c61dec5 100644 --- a/erpnext/website/page/unsubscribe/unsubscribe.py +++ b/erpnext/website/page/unsubscribe/unsubscribe.py @@ -1,6 +1,8 @@ +import webnotes + +@webnotes.whitelist() def unsubscribe(arg): """unsubscribe from lists""" - import webnotes lists = [['Blog Subscriber', 'name']] for l in lists: webnotes.conn.sql("""delete from `tab%s` where %s=%s""" % (l[0], l[1], '%s'), arg) From e8928b8bff5305a1779c93d2a311bbb068f26eea Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 13 Feb 2012 17:56:59 +0530 Subject: [PATCH 68/70] website settings --- erpnext/patches/jan_mar_2012/website/all.py | 4 +++- erpnext/setup/doctype/setup_control/setup_control.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/website/all.py b/erpnext/patches/jan_mar_2012/website/all.py index 03b79775e1f..d6ad3b11a4f 100644 --- a/erpnext/patches/jan_mar_2012/website/all.py +++ b/erpnext/patches/jan_mar_2012/website/all.py @@ -2,9 +2,11 @@ import patches.jan_mar_2012.website.login import patches.jan_mar_2012.website.feed import patches.jan_mar_2012.website.website import patches.jan_mar_2012.website.cleanups +import patches.jan_mar_2012.website.domain_list def execute(): patches.jan_mar_2012.website.login.execute() patches.jan_mar_2012.website.feed.execute() patches.jan_mar_2012.website.website.execute() - patches.jan_mar_2012.website.cleanups.execute() \ No newline at end of file + patches.jan_mar_2012.website.cleanups.execute() + patches.jan_mar_2012.website.domain_list.execute() diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index 194da7a4bee..8bfebd00e2c 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -151,7 +151,7 @@ class DocType: for d in def_args.keys(): ma_obj.doc.fields[d] = def_args[d] ma_obj.doc.save() - ma_obj.update_cp() + ma_obj.on_update() # Set Control Panel Defaults From a9bd79487d390090dd8b506a49bc766187f9cd6b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 13 Feb 2012 13:41:45 +0100 Subject: [PATCH 69/70] company whitelist fix --- erpnext/home/page/event_updates/event_updates.py | 8 +++----- erpnext/home/page/my_company/my_company.py | 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/home/page/event_updates/event_updates.py b/erpnext/home/page/event_updates/event_updates.py index cb27043e0e4..6966b8761cc 100644 --- a/erpnext/home/page/event_updates/event_updates.py +++ b/erpnext/home/page/event_updates/event_updates.py @@ -2,7 +2,7 @@ import webnotes from webnotes.utils import cint @webnotes.whitelist() -def get_online_users(): +def get_online_users(arg=None): # get users return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name from tabSessions t1, tabProfile t2 @@ -10,8 +10,7 @@ def get_online_users(): and t1.user not in ('Guest','Administrator') and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or [] -@webnotes.whitelist() -def get_unread_messages(): +def get_unread_messages(arg=None): "returns unread (docstatus-0 messages for a user)" return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record` WHERE comment_doctype='My Company' @@ -41,8 +40,7 @@ def get_status_details(arg=None): } return ret -@webnotes.whitelist() -def get_setup_status(): +def get_setup_status(arg=None): """ Returns the setup status of the current account """ diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py index 8070c9d5f8e..c5b44fd87d1 100644 --- a/erpnext/home/page/my_company/my_company.py +++ b/erpnext/home/page/my_company/my_company.py @@ -104,6 +104,7 @@ def send_welcome_mail(email, args): # # post comment # +@webnotes.whitelist() def post_comment(arg): arg = load_json(arg) @@ -146,6 +147,7 @@ def post_comment(arg): # # update read messages # +@webnotes.whitelist() def set_read_all_messages(arg=''): webnotes.conn.sql("""UPDATE `tabComment Widget Record` SET docstatus = 1 @@ -153,6 +155,7 @@ def set_read_all_messages(arg=''): AND comment_docname = %s """, webnotes.user.name) +@webnotes.whitelist() def update_security(args=''): import json args = json.loads(args) From d7ddea1e2a156b1692e3d07af8dbc1bedfebc8c3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 13 Feb 2012 18:59:43 +0530 Subject: [PATCH 70/70] domain list patch --- .../jan_mar_2012/website/domain_list.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 erpnext/patches/jan_mar_2012/website/domain_list.py diff --git a/erpnext/patches/jan_mar_2012/website/domain_list.py b/erpnext/patches/jan_mar_2012/website/domain_list.py new file mode 100644 index 00000000000..fabbdceec46 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/website/domain_list.py @@ -0,0 +1,22 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('website', 'doctype', 'website_settings') + + res = webnotes.conn.sql("""\ + SELECT name FROM `tabDocPerm` + WHERE parent='Website Settings' AND role='All' AND permlevel=1""") + if not res: + idx = webnotes.conn.sql("""\ + SELECT MAX(idx) FROM `tabDocPerm` + WHERE parent='Website Settings' + """)[0][0] + from webnotes.model.doc import Document + d = Document('DocType', 'Website Settings') + perm = d.addchild('permissions', 'DocPerm') + perm.read = 1 + perm.role = 'All' + perm.permlevel = 1 + perm.idx = idx + 1 + perm.save() +