@@ -330,7 +330,7 @@ def upload(): | |||||
return [d] | return [d] | ||||
def main_doc_empty(row): | def main_doc_empty(row): | ||||
return not (row and len(row) > 2 and (row[1] or row[2])) | |||||
return not (row and ((len(row) > 1 and row[1]) or (len(row) > 2 and row[2]))) | |||||
# extra input params | # extra input params | ||||
import json | import json | ||||
@@ -75,10 +75,13 @@ wn.core.pages.desktop.show_pending_notifications = function() { | |||||
var sum = 0; | var sum = 0; | ||||
if(module_doctypes) { | if(module_doctypes) { | ||||
$.each(module_doctypes, function(j, doctype) { | |||||
sum += (wn.boot.notification_info.open_count_doctype[doctype] || 0); | |||||
}); | |||||
} else if(wn.boot.notification_info.open_count_module[module]!=null) { | |||||
if(wn.boot.notification_info.open_count_doctype) { | |||||
$.each(module_doctypes, function(j, doctype) { | |||||
sum += (wn.boot.notification_info.open_count_doctype[doctype] || 0); | |||||
}); | |||||
} | |||||
} else if(wn.boot.notification_info.open_count_module | |||||
&& wn.boot.notification_info.open_count_module[module]!=null) { | |||||
sum = wn.boot.notification_info.open_count_module[module]; | sum = wn.boot.notification_info.open_count_module[module]; | ||||
} | } | ||||
var notifier = $("#module-count-" + wn.modules[module]._link); | var notifier = $("#module-count-" + wn.modules[module]._link); | ||||
@@ -35,10 +35,19 @@ wn.pages['finder'].onload = function(wrapper) { | |||||
var $list = get_col(6, "file", wn._("Documents"), "info"); | var $list = get_col(6, "file", wn._("Documents"), "info"); | ||||
var $doctype_label = $list.find(".col-heading") | var $doctype_label = $list.find(".col-heading") | ||||
var $list_link = $list.find(".panel-heading .pull-right") | |||||
.append('<a class="list-link"><i class="icon-list"></i></a>') | |||||
.find(".list-link") | |||||
.click(function() { wn.set_route("List", doctype); }) | |||||
.toggle(false); | |||||
var $new_link = $list.find(".panel-heading .pull-right") | var $new_link = $list.find(".panel-heading .pull-right") | ||||
.html('<a class="new-link"><i class="icon-plus"></i></a>') | |||||
.append(' <a class="new-link"><i class="icon-plus"></i></a>') | |||||
.find(".new-link") | |||||
.click(function() { new_doc(doctype); }) | .click(function() { new_doc(doctype); }) | ||||
.toggle(false); | .toggle(false); | ||||
$list = $list.find(".list-group"); | $list = $list.find(".list-group"); | ||||
var reset_module = function() { | var reset_module = function() { | ||||
@@ -52,6 +61,7 @@ wn.pages['finder'].onload = function(wrapper) { | |||||
var reset_doctype = function() { | var reset_doctype = function() { | ||||
$list.empty(); | $list.empty(); | ||||
$new_link.toggle(false); | $new_link.toggle(false); | ||||
$list_link.toggle(false); | |||||
$doctype_label.html(wn._("Documents")); | $doctype_label.html(wn._("Documents")); | ||||
$('<div class="list-group-item row-select text-muted text-center">'+ | $('<div class="list-group-item row-select text-muted text-center">'+ | ||||
wn._("Select Document Type")+'</div>').appendTo($list); | wn._("Select Document Type")+'</div>').appendTo($list); | ||||
@@ -103,6 +113,7 @@ wn.pages['finder'].onload = function(wrapper) { | |||||
// new link | // new link | ||||
$new_link.toggle(!!wn.model.can_create(doctype)); | $new_link.toggle(!!wn.model.can_create(doctype)); | ||||
$list_link.toggle(!!wn.model.can_read(doctype)); | |||||
render_list(); | render_list(); | ||||
}) | }) | ||||
@@ -23,14 +23,15 @@ import conf | |||||
session_stopped = """<!DOCTYPE html> | session_stopped = """<!DOCTYPE html> | ||||
<html lang="en"> | <html lang="en"> | ||||
<head> | <head> | ||||
<title>Session Stopped</title> | |||||
<title>%(title)s</title> | |||||
</head> | </head> | ||||
<body style="background-color: #eee; font-family: Arial, Sans Serif;"> | <body style="background-color: #eee; font-family: Arial, Sans Serif;"> | ||||
<div style="margin: 30px auto; width: 500px; background-color: #fff; | <div style="margin: 30px auto; width: 500px; background-color: #fff; | ||||
border: 1px solid #aaa; padding: 20px; text-align: center"> | border: 1px solid #aaa; padding: 20px; text-align: center"> | ||||
<b>%(app_name)s: Upgrading...</b> | |||||
<b>%(app_name)s: %(title)s</b> | |||||
<p>We will be back in a few moments.</p> | <p>We will be back in a few moments.</p> | ||||
</div> | </div> | ||||
<!-- trace %(trace)s --> | |||||
</body> | </body> | ||||
</html>""" | </html>""" | ||||
@@ -48,12 +49,20 @@ def respond(): | |||||
except webnotes.SessionStopped: | except webnotes.SessionStopped: | ||||
print "Content-type: text/html" | print "Content-type: text/html" | ||||
print session_stopped % {"app_name": webnotes.get_config().app_name} | |||||
print session_stopped % { | |||||
"app_name": webnotes.get_config().app_name, | |||||
"trace": webnotes.getTraceback(), | |||||
"title": "Upgrading..." | |||||
} | |||||
except MySQLdb.ProgrammingError, e: | except MySQLdb.ProgrammingError, e: | ||||
if e.args[0]==1146: | if e.args[0]==1146: | ||||
print "Content-type: text/html" | print "Content-type: text/html" | ||||
print session_stopped % {"app_name": webnotes.get_config().app_name} | |||||
print session_stopped % { | |||||
"app_name": webnotes.get_config().app_name, | |||||
"trace": webnotes.getTraceback(), | |||||
"title": "Installing..." | |||||
} | |||||
else: | else: | ||||
raise e | raise e | ||||
@@ -32,7 +32,7 @@ $.extend(wn.meta, { | |||||
if(!c[doctype][docname]) | if(!c[doctype][docname]) | ||||
c[doctype][docname] = {}; | c[doctype][docname] = {}; | ||||
$.each(wn.meta.docfield_list[doctype], function(i, df) { | |||||
$.each(wn.meta.docfield_list[doctype] || [], function(i, df) { | |||||
c[doctype][docname][df.fieldname || df.label] = copy_dict(df); | c[doctype][docname][df.fieldname || df.label] = copy_dict(df); | ||||
}) | }) | ||||
}, | }, | ||||
@@ -109,6 +109,8 @@ class Installer: | |||||
{'doctype':'Role', 'role_name': 'All', 'name': 'All'}, | {'doctype':'Role', 'role_name': 'All', 'name': 'All'}, | ||||
{'doctype':'Role', 'role_name': 'System Manager', 'name': 'System Manager'}, | {'doctype':'Role', 'role_name': 'System Manager', 'name': 'System Manager'}, | ||||
{'doctype':'Role', 'role_name': 'Report Manager', 'name': 'Report Manager'}, | {'doctype':'Role', 'role_name': 'Report Manager', 'name': 'Report Manager'}, | ||||
{'doctype':'Role', 'role_name': 'Website Manager', 'name': 'Website Manager'}, | |||||
{'doctype':'Role', 'role_name': 'Blogger', 'name': 'Blogger'}, | |||||
{'doctype':'Role', 'role_name': 'Guest', 'name': 'Guest'}, | {'doctype':'Role', 'role_name': 'Guest', 'name': 'Guest'}, | ||||
# profiles | # profiles | ||||
@@ -130,14 +132,6 @@ class Installer: | |||||
doc.insert() | doc.insert() | ||||
webnotes.conn.commit() | webnotes.conn.commit() | ||||
# from webnotes.modules.import_file import import_files | |||||
# | |||||
# import_files([ | |||||
# ["core", "doctype", "docperm"], | |||||
# ["core", "doctype", "docfield"], | |||||
# ["core", "doctype", "doctype"], | |||||
# ]) | |||||
def set_all_patches_as_completed(self): | def set_all_patches_as_completed(self): | ||||
try: | try: | ||||
from patches.patch_list import patch_list | from patches.patch_list import patch_list | ||||
@@ -45,13 +45,20 @@ def translate(lang=None): | |||||
os.remove('_lang_tmp.csv') | os.remove('_lang_tmp.csv') | ||||
def get_all_languages(): | def get_all_languages(): | ||||
return [f[:-4] for f in os.listdir("app/translations") if f.endswith(".csv")] | |||||
try: | |||||
return [f[:-4] for f in os.listdir("app/translations") if f.endswith(".csv")] | |||||
except OSError, e: | |||||
if e.args[0]==2: | |||||
return [] | |||||
else: | |||||
raise e | |||||
def get_lang_dict(): | def get_lang_dict(): | ||||
languages_path = os.path.join(get_base_path(), "app", "translations", "languages.json") | languages_path = os.path.join(get_base_path(), "app", "translations", "languages.json") | ||||
if os.path.exists(languages_path): | if os.path.exists(languages_path): | ||||
with open(languages_path, "r") as langfile: | with open(languages_path, "r") as langfile: | ||||
return json.loads(langfile.read()) | return json.loads(langfile.read()) | ||||
else: return {} | |||||
def update_translations(): | def update_translations(): | ||||
""" | """ | ||||