fixes to routing and activating web page
This commit is contained in:
parent
c22d9e03e7
commit
5ab8163140
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ version.num
|
||||
public/*.html
|
||||
!public/blank.html
|
||||
!public/unsupported.html
|
||||
!public/login-page.html
|
||||
public/js/lib
|
||||
public/images/lib
|
||||
public/files
|
||||
|
@ -25,13 +25,21 @@ class DocType:
|
||||
* clear cache
|
||||
"""
|
||||
self.set_home_page()
|
||||
|
||||
self.validate_domain_list()
|
||||
self.rewrite_pages()
|
||||
|
||||
from webnotes.session_cache import clear_cache
|
||||
clear_cache('Guest')
|
||||
|
||||
|
||||
def rewrite_pages(self):
|
||||
"""rewrite all web pages"""
|
||||
import webnotes
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
for p in webnotes.conn.sql("""select name from tabPage where docstatus=0
|
||||
and web_page = 'Yes'"""):
|
||||
get_obj('Page', p[0]).write_cms_page()
|
||||
|
||||
def set_home_page(self):
|
||||
|
||||
import webnotes
|
||||
|
@ -116,7 +116,7 @@ def get_header():
|
||||
</ul>
|
||||
<img src="images/lib/ui/spinner.gif" id="spinner"/>
|
||||
<ul class="nav pull-right">
|
||||
<li id="login-topbar-item"><a href="#!Login Page">Login</a></li>
|
||||
<li id="login-topbar-item"><a href="login-page.html">Login</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -179,7 +179,8 @@ return repl('<div style="\
|
||||
background: linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* W3C */\
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#%(col1)s\', endColorstr=\'#%(col2)s\',GradientType=0 ); /* IE6-9 */\
|
||||
">%(letter)s</div>',args);}}
|
||||
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
|
||||
wn.get_cookie=function(c){var clist=(document.cookie+'').split(';');var cookies={};for(var i=0;i<clist.length;i++){var tmp=clist[i].split('=');cookies[strip(tmp[0])]=strip(tmp[1]);}
|
||||
return cookies[c];}
|
||||
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||
$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')};(function($){$.fn.add_options=function(options_list){for(var i=0;i<options_list.length;i++){var v=options_list[i];value=v.value||v;label=v.label||v;$('<option>').html(label).attr('value',value).appendTo(this);}
|
||||
@ -252,7 +253,8 @@ wn.re_route={}
|
||||
wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];}
|
||||
wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route=function(route){if(!wn.boot){return[window.page_name];}
|
||||
return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route_str=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
|
||||
@ -370,9 +372,9 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span clas
|
||||
/*
|
||||
* lib/js/wn/views/pageview.js
|
||||
*/
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if((locals.Page&&locals.Page[name])||name==window.home_page){callback();}else{wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}},show:function(name){if(!name)name=(wn.boot?wn.boot.home_page:'Login Page');wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={with_page:function(name,callback){if((locals.Page&&locals.Page[name])||name==window.page_name){callback();}else{wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}},show:function(name){if(!name)name=(wn.boot?wn.boot.home_page:window.page_name);wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){new wn.views.Page(name);}
|
||||
wn.container.change_to(name);});}}
|
||||
wn.views.Page=Class.extend({init:function(name,wrapper){this.name=name;var me=this;if(name==window.home_page){this.wrapper=document.getElementById('page-'+name);this.wrapper.title=document.title;this.wrapper.label=window.home_page;}else{this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.page_name=this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');}
|
||||
wn.views.Page=Class.extend({init:function(name,wrapper){this.name=name;var me=this;if(name==window.page_name){this.wrapper=document.getElementById('page-'+name);this.wrapper.title=document.title;this.wrapper.label=window.page_name;wn.pages[window.page_name]=this.wrapper;}else{this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.page_name=this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');}
|
||||
this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Found</h1><br>\
|
||||
@ -403,7 +405,7 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
|
||||
* lib/js/core.js
|
||||
*/
|
||||
if(!console){var console={log:function(txt){}}}
|
||||
$(document).bind('ready',function(){wn.versions.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
|
||||
$(document).ready(function(){wn.versions.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
|
||||
|
||||
/*
|
||||
* lib/js/legacy/globals.js
|
||||
@ -2110,11 +2112,7 @@ this.prepare_col_heads(this.flist);var table=me.make_print_table(this.flist);thi
|
||||
_e.email_as_field='email_id';_e.email_as_dt='Contact';_e.email_as_in='email_id,contact_name';sendmail=function(emailto,emailfrom,cc,subject,message,fmt,with_attachments){var fn=function(html){$c('webnotes.utils.email_lib.send_form',{'sendto':emailto,'sendfrom':emailfrom?emailfrom:'','cc':cc?cc:'','subject':subject,'message':replace_newlines(message),'body':html,'full_domain':wn.urllib.get_base_url(),'with_attachments':with_attachments?1:0,'dt':cur_frm.doctype,'dn':cur_frm.docname},function(r,rtxt){});}
|
||||
_p.build(fmt,fn);}
|
||||
_e.make=function(){var d=new Dialog(440,440,"Send Email");var email_go=function(){var emailfrom=d.widgets['From'].value;var emailto=d.widgets['To'].value;if(!emailfrom)
|
||||
emailfrom=user_email;emailto=emailto.replace(/ /g,"")
|
||||
var email_list=emailto.split(/[,|;]/);var valid=1;console.log(email_list)
|
||||
for(var i=0;i<email_list.length;i++){console.log(email_list[i]);console.log(!email_list[i]);if(!email_list[i]){email_list.splice(i,1);}else if(!validate_email(email_list[i])){msgprint('error:'+email_list[i]+' is not a valid email id');valid=0;}}
|
||||
emailto=email_list.join(",")
|
||||
console.log(emailto)
|
||||
emailfrom=user_email;var email_list=emailto.split(/[,|;]/);var valid=1;for(var i=0;i<email_list.length;i++){if(!validate_email(email_list[i])){msgprint('error:'+email_list[i]+' is not a valid email id');valid=0;}}
|
||||
if(emailfrom&&!validate_email(emailfrom)){msgprint('error:'+emailfrom+' is not a valid email id. To change the default please click on Profile on the top right of the screen and change it.');return;}
|
||||
if(!valid)return;var cc=emailfrom;if(!emailfrom){emailfrom=wn.control_panel.auto_email_id;cc='';}
|
||||
sendmail(emailto,emailfrom,emailfrom,d.widgets['Subject'].value,d.widgets['Message'].value,sel_val(cur_frm.print_sel),d.widgets['Send With Attachments'].checked);_e.dialog.hide();}
|
||||
@ -2241,7 +2239,8 @@ me.dialog.clear();me.dialog.show();}});
|
||||
*/
|
||||
wn.Application=Class.extend({init:function(){var me=this;if(window.app){wn.call({method:'startup',callback:function(r,rt){wn.provide('wn.boot');wn.boot=r;if(wn.boot.profile.name=='Guest'){window.location='index.html';return;}
|
||||
me.startup();}})}else{document.cookie="sid=Guest;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"
|
||||
this.startup();}},startup:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){if(wn.boot){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
|
||||
this.startup();}},startup:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');if(wn.boot){wn.route();}
|
||||
$(document).trigger('app_ready');},load_bootinfo:function(){if(wn.boot){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
|
||||
console.log(wn.boot.error_messages)
|
||||
if(wn.boot.server_messages)
|
||||
msgprint(wn.boot.server_messages);this.set_globals();}else{this.set_as_guest();}},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},set_as_guest:function(){profile={name:'Guest'};user='Guest';user_fullname='Guest';user_defaults={};user_roles=['Guest'];user_email='';sys_defaults={};},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();},make_nav_bar:function(){if(wn.boot){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;me.logged_out=true;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);}
|
||||
@ -2339,4 +2338,4 @@ msgprint('Grid "'+fort+'" does not exists');}}}}})
|
||||
* conf.js
|
||||
*/
|
||||
wn.provide('erpnext');erpnext.set_about=function(){wn.provide('wn.app');$.extend(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'});}
|
||||
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html((wn.boot.website_settings.brand_html||'erpnext')+' <i class="icon-home icon-white navbar-icon-home" ></i>').css('max-width','200px').css('overflow','hidden').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
|
||||
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html((wn.boot.website_settings.brand_html||'erpnext')+' <i class="icon-home icon-white navbar-icon-home" ></i>').css('max-width','200px').css('overflow','hidden').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
|
@ -66,7 +66,8 @@ return repl('<div style="\
|
||||
background: linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* W3C */\
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#%(col1)s\', endColorstr=\'#%(col2)s\',GradientType=0 ); /* IE6-9 */\
|
||||
">%(letter)s</div>',args);}}
|
||||
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
|
||||
wn.get_cookie=function(c){var clist=(document.cookie+'').split(';');var cookies={};for(var i=0;i<clist.length;i++){var tmp=clist[i].split('=');cookies[strip(tmp[0])]=strip(tmp[1]);}
|
||||
return cookies[c];}
|
||||
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||
$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')};(function($){$.fn.add_options=function(options_list){for(var i=0;i<options_list.length;i++){var v=options_list[i];value=v.value||v;label=v.label||v;$('<option>').html(label).attr('value',value).appendTo(this);}
|
||||
@ -139,7 +140,8 @@ wn.re_route={}
|
||||
wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];}
|
||||
wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show();break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route=function(route){if(!wn.boot){return[window.page_name];}
|
||||
return $.map(wn.get_route_str(route).split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.get_route_str=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
|
||||
@ -257,9 +259,9 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span clas
|
||||
/*
|
||||
* lib/js/wn/views/pageview.js
|
||||
*/
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if((locals.Page&&locals.Page[name])||name==window.home_page){callback();}else{wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}},show:function(name){if(!name)name=(wn.boot?wn.boot.home_page:'Login Page');wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={with_page:function(name,callback){if((locals.Page&&locals.Page[name])||name==window.page_name){callback();}else{wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}},show:function(name){if(!name)name=(wn.boot?wn.boot.home_page:window.page_name);wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){new wn.views.Page(name);}
|
||||
wn.container.change_to(name);});}}
|
||||
wn.views.Page=Class.extend({init:function(name,wrapper){this.name=name;var me=this;if(name==window.home_page){this.wrapper=document.getElementById('page-'+name);this.wrapper.title=document.title;this.wrapper.label=window.home_page;}else{this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.page_name=this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');}
|
||||
wn.views.Page=Class.extend({init:function(name,wrapper){this.name=name;var me=this;if(name==window.page_name){this.wrapper=document.getElementById('page-'+name);this.wrapper.title=document.title;this.wrapper.label=window.page_name;wn.pages[window.page_name]=this.wrapper;}else{this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.page_name=this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');}
|
||||
this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Found</h1><br>\
|
||||
@ -290,7 +292,7 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
|
||||
* lib/js/core.js
|
||||
*/
|
||||
if(!console){var console={log:function(txt){}}}
|
||||
$(document).bind('ready',function(){wn.versions.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
|
||||
$(document).ready(function(){wn.versions.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
|
||||
|
||||
/*
|
||||
* lib/js/legacy/globals.js
|
||||
@ -693,7 +695,8 @@ if(errfld.length)msgprint('<b>Mandatory fields required in '+
|
||||
*/
|
||||
wn.Application=Class.extend({init:function(){var me=this;if(window.app){wn.call({method:'startup',callback:function(r,rt){wn.provide('wn.boot');wn.boot=r;if(wn.boot.profile.name=='Guest'){window.location='index.html';return;}
|
||||
me.startup();}})}else{document.cookie="sid=Guest;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"
|
||||
this.startup();}},startup:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){if(wn.boot){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
|
||||
this.startup();}},startup:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');if(wn.boot){wn.route();}
|
||||
$(document).trigger('app_ready');},load_bootinfo:function(){if(wn.boot){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
|
||||
console.log(wn.boot.error_messages)
|
||||
if(wn.boot.server_messages)
|
||||
msgprint(wn.boot.server_messages);this.set_globals();}else{this.set_as_guest();}},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},set_as_guest:function(){profile={name:'Guest'};user='Guest';user_fullname='Guest';user_defaults={};user_roles=['Guest'];user_email='';sys_defaults={};},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();},make_nav_bar:function(){if(wn.boot){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;me.logged_out=true;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);}
|
||||
|
@ -1,5 +1,5 @@
|
||||
window._version_number = "d9f42d1e15307de62f68d890d4e40adbe2472a85153ddc965775bebd";
|
||||
window.home_page = "Login Page";
|
||||
window._version_number = "c1dee2b8be9abfbe2a74619482b586b538f7253911fcb06c4c950b10";
|
||||
window.home_page = "index";
|
||||
// footer signup widget
|
||||
// automatically adds it to the .layout-main div of the page
|
||||
// adds events and also random goodies.
|
||||
|
250
public/login-page.html
Normal file
250
public/login-page.html
Normal file
@ -0,0 +1,250 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Login Page</title>
|
||||
<meta name="generator" content="wnframework">
|
||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
|
||||
<script type="text/javascript" src="js/lib/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/all-web.js"></script>
|
||||
<script type="text/javascript" src="js/wn-web.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="css/all-web.css">
|
||||
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
|
||||
|
||||
<script>
|
||||
window.page_name = "Login Page";
|
||||
|
||||
$(document).bind('app_ready', function() {
|
||||
var _page = new wn.views.Page(window.page_name);
|
||||
|
||||
// page script
|
||||
// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
|
||||
//
|
||||
// MIT License (MIT)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
pscript['onload_Login Page'] = function(wrapper){
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
|
||||
wrapper.appframe.title('Login');
|
||||
wrapper.appframe.$w.find('.close').toggle(false);
|
||||
|
||||
var lw = $i('login_wrapper');
|
||||
$bs(lw, '1px 1px 3px #888');
|
||||
|
||||
$('#login_btn').click(pscript.doLogin)
|
||||
|
||||
$('#password').keypress(function(ev){
|
||||
if(ev.which==13 && $('#password').val())
|
||||
pscript.doLogin();
|
||||
});
|
||||
$(document).trigger('login_rendered');
|
||||
}
|
||||
|
||||
pscript['onshow_Login Page'] = function() {
|
||||
// set banner
|
||||
}
|
||||
|
||||
// Login Callback
|
||||
pscript.onLoginReply = function(r, rtext) {
|
||||
$('#login_btn').done_working();
|
||||
if(r.message=="Logged In"){
|
||||
window.location.href='app.html' + (get_url_arg('page') ? ('?page='+get_url_arg('page')) : '');
|
||||
} else {
|
||||
$i('login_message').innerHTML = '<span style="color: RED;">'+(r.message)+'</span>';
|
||||
//if(r.exc)alert(r.exc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Login
|
||||
pscript.doLogin = function(){
|
||||
|
||||
var args = {};
|
||||
args['usr']=$i("login_id").value;
|
||||
args['pwd']=$i("password").value;
|
||||
if($i('remember_me').checked)
|
||||
args['remember_me'] = 1;
|
||||
|
||||
$('#login_btn').set_working();
|
||||
|
||||
$c("login", args, pscript.onLoginReply);
|
||||
}
|
||||
|
||||
|
||||
wn.show_forgot_password = function(){
|
||||
// create dialog
|
||||
var d = new wn.ui.Dialog({
|
||||
title:"Forgot Password",
|
||||
fields: [
|
||||
{'label':'Email Id', 'fieldname':'email_id', 'fieldtype':'Data', 'reqd':true},
|
||||
{'label':'Email Me A New Password', 'fieldname':'run', 'fieldtype':'Button'}
|
||||
]
|
||||
});
|
||||
|
||||
$(d.fields_dict.run.input).click(function() {
|
||||
var values = d.get_values();
|
||||
if(!values) return;
|
||||
wn.call({
|
||||
method:'reset_password',
|
||||
args: { user: values.email_id },
|
||||
callback: function() {
|
||||
d.hide();
|
||||
}
|
||||
})
|
||||
})
|
||||
d.show();
|
||||
}
|
||||
|
||||
|
||||
// trigger onload
|
||||
_page.trigger('onload');
|
||||
|
||||
// activate page
|
||||
wn.container.change_to(window.page_name);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<style>#login_wrapper {
|
||||
width: 300px !important;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.login-banner {
|
||||
margin-bottom: 20px;
|
||||
}</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header><div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand">erpnext</a>
|
||||
<ul class="nav">
|
||||
|
||||
|
||||
<li data-label="Pricing">
|
||||
<a href="pages/erpnext-pricing.html" None>
|
||||
Pricing
|
||||
|
||||
</a></li>
|
||||
|
||||
|
||||
|
||||
<li data-label="Customers">
|
||||
<a href="None" None>
|
||||
Customers
|
||||
|
||||
</a></li>
|
||||
|
||||
|
||||
|
||||
<li data-label="Demo">
|
||||
<a href="http://demo.erpnext.com" target = "_blank">
|
||||
Demo
|
||||
|
||||
</a></li>
|
||||
|
||||
|
||||
|
||||
<li data-label="Developers">
|
||||
<a href="open-source.html" None>
|
||||
Developers
|
||||
|
||||
</a></li>
|
||||
|
||||
|
||||
|
||||
<li data-label="About">
|
||||
<a href="None" None>
|
||||
About
|
||||
|
||||
</a></li>
|
||||
|
||||
|
||||
|
||||
<li data-label="Blog">
|
||||
<a href="None" None>
|
||||
Blog
|
||||
|
||||
</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
<img src="images/lib/ui/spinner.gif" id="spinner"/>
|
||||
<ul class="nav pull-right">
|
||||
<li id="login-topbar-item"><a href="login-page.html">Login</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div></header>
|
||||
<div id="body_div">
|
||||
<div class="content" id="page-Login Page" style="display: block;">
|
||||
<div class="layout-wrapper layout-wrapper-appframe" id='login_wrapper'>
|
||||
<div class="appframe-area"></div>
|
||||
<div class="layout-main" style="padding: 15px;">
|
||||
<table border="0" cellspacing="8">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Login Id</td>
|
||||
<td><input id="login_id" type="text" style="width: 180px"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Password</td>
|
||||
<td><input id="password" type="password" style="width: 180px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align:right"><input id="remember_me" type="checkbox" /></td>
|
||||
<td>Remember Me</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td id="login_message"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<button id="login_btn" class="btn btn-small btn-primary">Login</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p style="margin-left: 72px;"><span class="link_type"
|
||||
onclick="wn.show_forgot_password()">Forgot Password</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="web-footer">
|
||||
<div class="web-footer-menu"><ul>
|
||||
|
||||
<li><a href="None" None
|
||||
data-label="Contact Us">Contact Us</a></li>
|
||||
|
||||
<li><a href="None" None
|
||||
data-label="About Us">About Us</a></li>
|
||||
|
||||
<li><a href="None" None
|
||||
data-label="FAQ">FAQ</a></li>
|
||||
|
||||
</ul></div>
|
||||
<div class="web-footer-copyright">© Web Notes Technologies Pvt Ltd
|
||||
</div></footer>
|
||||
</body>
|
Loading…
x
Reference in New Issue
Block a user