fix to profile_settings
This commit is contained in:
parent
ea943668ce
commit
ef048f7256
@ -0,0 +1,5 @@
|
|||||||
|
<div class="layout-wrapper layout-wrapper-appframe">
|
||||||
|
<div class="layout-appframe"></div>
|
||||||
|
<div class="layout-main">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
pscript['onload_profile-settings'] = function() {
|
pscript['onload_profile-settings'] = function() {
|
||||||
var wrapper = wn.pages['profile-settings'];
|
var wrapper = wn.pages['profile-settings'];
|
||||||
wrapper.className = 'layout_wrapper';
|
|
||||||
pscript.myprofile = new MyProfile(wrapper)
|
pscript.myprofile = new MyProfile(wrapper)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +24,11 @@ MyProfile = function(wrapper) {
|
|||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this.make = function() {
|
this.make = function() {
|
||||||
this.head = new PageHeader(this.wrapper, 'My Profile Settings');
|
this.wrapper.appframe = new wn.ui.AppFrame($(this.wrapper).find('.layout-appframe'), 'Profile Settings');
|
||||||
this.head.add_button('Change Password', this.change_password);
|
this.wrapper.appframe.add_button('Change Password', this.change_password);
|
||||||
this.head.add_button('Change Background', this.change_background);
|
this.wrapper.appframe.add_button('Change Background', this.change_background);
|
||||||
|
|
||||||
this.tab = make_table($a(this.wrapper, 'div', '', {marginTop:'19px'}),
|
this.tab = make_table($a($(this.wrapper).find('.layout-main').get(0), 'div', '', {marginTop:'19px'}),
|
||||||
1, 2, '90%', ['50%', '50%'], {padding:'11px'})
|
1, 2, '90%', ['50%', '50%'], {padding:'11px'})
|
||||||
this.img = $a($td(this.tab, 0, 0), 'img', '', {width: '120px', maxHeight:'200px'});
|
this.img = $a($td(this.tab, 0, 0), 'img', '', {width: '120px', maxHeight:'200px'});
|
||||||
this.img.src = wn.user_info(user).image;
|
this.img.src = wn.user_info(user).image;
|
||||||
|
|||||||
@ -18,11 +18,19 @@ import webnotes
|
|||||||
|
|
||||||
from webnotes.utils import load_json, cint, nowdate
|
from webnotes.utils import load_json, cint, nowdate
|
||||||
|
|
||||||
|
|
||||||
|
def check_demo():
|
||||||
|
demo_user = 'demo@webnotestech.com'
|
||||||
|
if webnotes.session['user']==demo_user:
|
||||||
|
webnotes.msgprint("Can't change in demo", raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def change_password(arg):
|
def change_password(arg):
|
||||||
"""
|
"""
|
||||||
Change password
|
Change password
|
||||||
"""
|
"""
|
||||||
|
check_demo()
|
||||||
arg = load_json(arg)
|
arg = load_json(arg)
|
||||||
|
|
||||||
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
|
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
|
||||||
@ -44,6 +52,7 @@ def set_user_details(arg=None):
|
|||||||
"""
|
"""
|
||||||
updates user details given in argument
|
updates user details given in argument
|
||||||
"""
|
"""
|
||||||
|
check_demo()
|
||||||
from webnotes.model.doc import Document
|
from webnotes.model.doc import Document
|
||||||
|
|
||||||
p = Document('Profile', webnotes.user.name)
|
p = Document('Profile', webnotes.user.name)
|
||||||
@ -59,6 +68,7 @@ def set_user_image(fid, fname):
|
|||||||
"""
|
"""
|
||||||
Set uploaded image as user image
|
Set uploaded image as user image
|
||||||
"""
|
"""
|
||||||
|
check_demo()
|
||||||
from webnotes.utils.file_manager import add_file_list, remove_file
|
from webnotes.utils.file_manager import add_file_list, remove_file
|
||||||
user = webnotes.session['user']
|
user = webnotes.session['user']
|
||||||
|
|
||||||
@ -76,6 +86,7 @@ def set_user_background(fid, fname):
|
|||||||
"""
|
"""
|
||||||
Set uploaded image as user image
|
Set uploaded image as user image
|
||||||
"""
|
"""
|
||||||
|
check_demo()
|
||||||
from webnotes.utils.file_manager import add_file_list, remove_file
|
from webnotes.utils.file_manager import add_file_list, remove_file
|
||||||
user = webnotes.session['user']
|
user = webnotes.session['user']
|
||||||
|
|
||||||
|
|||||||
@ -85,8 +85,8 @@ erpnext.startup.start = function() {
|
|||||||
|
|
||||||
// border to the body
|
// border to the body
|
||||||
// ------------------
|
// ------------------
|
||||||
//$('footer').html('<div class="web-footer erpnext-footer">\
|
$('footer').html('<div class="web-footer erpnext-footer">\
|
||||||
// <a href="#!attributions">ERPNext | Attributions and License</a></div>');
|
<a href="#!attributions">ERPNext | Attributions and License</a></div>');
|
||||||
|
|
||||||
// complete registration
|
// complete registration
|
||||||
if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) {
|
if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) {
|
||||||
|
|||||||
@ -982,10 +982,11 @@ if(f.init)f.init();f.make_body();return f;}
|
|||||||
/*
|
/*
|
||||||
* lib/js/wn/ui/appframe.js
|
* lib/js/wn/ui/appframe.js
|
||||||
*/
|
*/
|
||||||
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
wn.ui.AppFrame=Class.extend({init:function(parent,title){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||||
<span class="appframe-title"></span>\
|
<span class="appframe-title"></span>\
|
||||||
<span class="close">×</span>\
|
<span class="close">×</span>\
|
||||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})
|
||||||
|
if(title)this.title(title);},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('<div class="layout-wrapper layout-wrapper-appframe">\
|
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('<div class="layout-wrapper layout-wrapper-appframe">\
|
||||||
@ -2230,7 +2231,8 @@ if(user=='Guest'){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;}
|
if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}
|
||||||
if(wn.boot.startup_code){eval(wn.boot.startup_code);}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages'])
|
if(wn.boot.startup_code){eval(wn.boot.startup_code);}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages'])
|
||||||
if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');}
|
if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');}
|
||||||
erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();}
|
erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="web-footer erpnext-footer">\
|
||||||
|
<a href="#!attributions">ERPNext | Attributions and License</a></div>');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();}
|
||||||
if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('<div class="expiry-info"> \
|
if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('<div class="expiry-info"> \
|
||||||
Your ERPNext subscription will <b>expire %(expiry_string)s</b>. \
|
Your ERPNext subscription will <b>expire %(expiry_string)s</b>. \
|
||||||
Please renew your subscription to continue using ERPNext \
|
Please renew your subscription to continue using ERPNext \
|
||||||
|
|||||||
@ -642,10 +642,11 @@ $(wrapper).hide().fadeIn(1000);}
|
|||||||
/*
|
/*
|
||||||
* lib/js/wn/ui/appframe.js
|
* lib/js/wn/ui/appframe.js
|
||||||
*/
|
*/
|
||||||
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
wn.ui.AppFrame=Class.extend({init:function(parent,title){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||||
<span class="appframe-title"></span>\
|
<span class="appframe-title"></span>\
|
||||||
<span class="close">×</span>\
|
<span class="close">×</span>\
|
||||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})
|
||||||
|
if(title)this.title(title);},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('<div class="layout-wrapper layout-wrapper-appframe">\
|
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('<div class="layout-wrapper layout-wrapper-appframe">\
|
||||||
@ -841,7 +842,8 @@ if(user=='Guest'){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;}
|
if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}
|
||||||
if(wn.boot.startup_code){eval(wn.boot.startup_code);}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages'])
|
if(wn.boot.startup_code){eval(wn.boot.startup_code);}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages'])
|
||||||
if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');}
|
if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');}
|
||||||
erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();}
|
erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="web-footer erpnext-footer">\
|
||||||
|
<a href="#!attributions">ERPNext | Attributions and License</a></div>');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup.show();}
|
||||||
if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('<div class="expiry-info"> \
|
if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil.str_to_obj(dateutil.get_today());var expires_on=dateutil.str_to_obj(wn.boot.expires_on);var diff=dateutil.get_diff(expires_on,today);if(0<=diff&&diff<=15){var expiry_string=diff==0?"today":repl("in %(diff)s day(s)",{diff:diff});$('header').append(repl('<div class="expiry-info"> \
|
||||||
Your ERPNext subscription will <b>expire %(expiry_string)s</b>. \
|
Your ERPNext subscription will <b>expire %(expiry_string)s</b>. \
|
||||||
Please renew your subscription to continue using ERPNext \
|
Please renew your subscription to continue using ERPNext \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user