fixes to home (multiple loading)

This commit is contained in:
Rushabh Mehta 2011-09-08 14:16:34 +05:30
parent d1ae089c94
commit 5ede3e8411
10 changed files with 127 additions and 85 deletions

View File

@ -1,7 +1,30 @@
## ERPNext - Open Source + SAAS ERP
# ERPNext - Open Source + SAAS ERP
Includes Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS
Built on Python / MySQL / wnframework
http://erpnext.org
- [Download](http://erpnext.org)
- [Use now as SAAS @ $7/user/month](https://erpnext.com)
## Platform
ERPNext is built on [wnframework](https://github.com/webnotes/wnframework)
## Download and Install
For download and install details, please go to [erpnext.org](http://erpnext.org)
## Forums
- [User / Functional](http://groups.google.com/group/erpnext-user-forum)
- [Technical](http://groups.google.com/group/wnframework)
## Contributing
If you interested in contributing to ERPNext, you must go thorough the wnframework. The code is not easily understandable, but we are making a lot of effort to do it.
## License
ERPNext is available under the GNU/GPL license.

File diff suppressed because one or more lines are too long

View File

@ -33,9 +33,6 @@ class DocType:
ml = sql("select distinct t1.name, t1.module_icon, t1.module_label, t1.module_desc, t1.module_page from `tabModule Def` t1, `tabModule Def Role` t2 where t2.role in ('%s') and t1.disabled !='Yes' and ifnull(t1.is_hidden, 'No') != 'Yes' and t1.name = t2.parent order by t1.module_seq asc" % "','".join(rl), as_dict=1)
return ml
def get_login_url(self):
return session['data'].get('login_from', '')
def get_module_details(self,m):
ret = {}
ret['il'] = sql('select doc_type, doc_name, display_name, icon, description, fields, click_function, idx from `tabModule Def Item` where parent=%s and ifnull(`hide`,0)=0 order by idx asc', m, as_dict=1)
@ -50,6 +47,9 @@ class DocType:
AND t2.read=1
AND t2.role IN ("%s")
AND ifnull(standard,"No")="No"''' % (m, '", "'.join(webnotes.user.get_roles())), as_dict=1)
ret['login_url'] = session['data'].get('login_from', '')
return ret
# ----------------------------------------------------------------------------------------------------------------
@ -249,7 +249,12 @@ class DocType:
if msg_id and msg_id != webnotes.conn.get_global('system_message_id', session['user']):
msg = webnotes.conn.get_global('system_message')
return {'user_count': count and cint(count[0][0]) or 0, 'unread': unread and cint(unread[0][0]) or 0, 'system_message':msg}
return {
'user_count': count and cint(count[0][0]) or 0,
'unread': unread and cint(unread[0][0]) or 0,
'system_message':msg,
'registration_complete': self.registration_complete()
}
# -------------------------------------------------------------------------------------------------------

View File

@ -39,9 +39,6 @@ pscript.home_pre_process = function(wrapper) {
var banner = $a(wrapper.banner_area, 'div', '', {paddingBottom:'4px'})
banner.innerHTML = cp.client_name;
}
// complete registration
if(in_list(user_roles,'System Manager')) { pscript.complete_registration(); }
}
// Widgets
@ -78,16 +75,8 @@ pscript.home_make_widgets = function() {
}
}
]
})
sidebar.refresh()
/*$y(cell,{padding:'0px 8px'});
new HomeCalendar(new HomeWidget(cell, 'Calendar', 'Event'));
new HomeToDo(new HomeWidget(cell, 'To Do', 'Item'));*/
});
new FeedList(wrapper.body);
}
@ -618,6 +607,11 @@ pscript.home_make_status = function() {
// render online users
pscript.online_users_obj.render(r.message.online_users);
pscript.online_users = r.message.online_users;
// complete registration
if(in_list(user_roles,'System Manager')) {
pscript.complete_registration(r.registration_complete);
}
// setup wizard
if(r.message.setup_status) {
@ -629,54 +623,50 @@ pscript.home_make_status = function() {
// complete my company registration
// --------------------------------
pscript.complete_registration = function()
{
var reg_callback = function(r, rt){
if(r.message == 'No'){
var d = new Dialog(400, 200, "Please Complete Your Registration");
if(user != 'Administrator'){
d.no_cancel(); // Hide close image
$dh(page_body.wntoolbar.wrapper);
}
$($a(d.body,'div','', {margin:'8px', color:'#888'})).html('<b>Company Name : </b>'+locals['Control Panel']['Control Panel'].company_name);
d.make_body(
[
['Data','Company Abbreviation'],
['Select','Fiscal Year Start Date'],
['Select','Default Currency'],
['Button','Save'],
]);
//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 = [
locals['Control Panel']['Control Panel'].company_name,
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();
$ds(page_body.wntoolbar.wrapper);
});
}
}
d.show();
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
$dh(page_body.wntoolbar.wrapper);
}
$($a(d.body,'div','', {margin:'8px', color:'#888'})).html('<b>Company Name : </b>'+locals['Control Panel']['Control Panel'].company_name);
d.make_body(
[
['Data','Company Abbreviation'],
['Select','Fiscal Year Start Date'],
['Select','Default Currency'],
['Button','Save'],
]);
//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 = [
locals['Control Panel']['Control Panel'].company_name,
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();
$ds(page_body.wntoolbar.wrapper);
});
}
}
d.show();
}
$c_obj('Home Control','registration_complete','',reg_callback);
}
// make dialog fields

View File

@ -45,7 +45,7 @@
<td style="border: 1px solid #AAA; padding: 4px;">
<h3>Import Log:</h3>
<div id="import_result_area">
<iframe src="blank1.html" name="ImportIFrame" style="border: 0px; height: 500px; width: 100%"></iframe>
<iframe name="ImportIFrame" style="border: 0px; height: 500px; width: 100%"></iframe>
</div>
</td>
</tr>

View File

@ -43,18 +43,7 @@ function startup_setup() {
// ------------------
$dh(page_body.footer);
// for logout and payment
var callback = function(r,rt) {
if(r.message){
login_file = 'http://' + r.message;
}
else if(pscript.is_erpnext_saas) {
login_file = 'https://www.erpnext.com';
}
// setup toolbar
pscript.startup_setup_toolbar();
}
$c_obj('Home Control', 'get_login_url', '', callback);
pscript.startup_setup_toolbar();
}
// ====================================================================
@ -63,6 +52,15 @@ pscript.startup_make_sidebar = function() {
$y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
var callback = function(r,rt) {
// login url
if(r.login_url){
login_file = 'http://' + r.message;
}
else if(pscript.is_erpnext_saas) {
login_file = 'https://www.erpnext.com';
}
// menu
var ml = r.message;

View File

@ -17,5 +17,26 @@ webnotes.form = cgi.FieldStorage()
for key in webnotes.form.keys():
webnotes.form_dict[key] = webnotes.form.getvalue(key)
# pass on to legacy handler
import webnotes.handler
# url comes with sid, redirect to html, sid set and all
if 'sid' in webnotes.form_dict:
import webnotes.auth
import webnotes.widgets.page_body
webnotes.auth.HTTPRequest()
print "Content-Type: text/html"
# print cookies, if there ar additional cookies defined during the request, add them here
if webnotes.cookies or webnotes.add_cookies:
for c in webnotes.add_cookies.keys():
webnotes.cookies[c] = webnotes.add_cookies[c]
print webnotes.cookies
print
print webnotes.widgets.page_body.redirect_template % ('Redirecting...', 'index.html')
else:
# pass on to legacy handler
import webnotes.handler

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,5 @@
wn.settings.no_history = true;
wn.require('lib/js/lib/jquery.min.js');
wn.require('lib/js/wn/ui/status_bar.js');

View File

@ -1,7 +1,10 @@
x icons - msgprint / toolbar
x history integration
x loading bar
x blank.html issues
x double (init) loading issue
x redirect (sid) issue
- loading bar
- release
- breakup - form