diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py
index e249234434..844026c09d 100644
--- a/core/doctype/doctype/doctype.py
+++ b/core/doctype/doctype/doctype.py
@@ -84,13 +84,10 @@ class DocType:
# update index
if not self.doc.custom:
- from webnotes.modules import scrub
- doctype = scrub(self.doc.name)
- module = __import__(scrub(self.doc.module) + ".doctype." + doctype + "." + doctype,
- fromlist=[""])
+ from webnotes.model.code import load_doctype_module
+ module = load_doctype_module( self.doc.name, self.doc.module)
if hasattr(module, "on_doctype_update"):
module.on_doctype_update()
-
webnotes.clear_cache(doctype=self.doc.name)
def check_link_replacement_error(self):
@@ -315,4 +312,4 @@ def make_module_and_roles(doclist, perm_doctype="DocPerm"):
if e.args[0]==1146:
pass
else:
- raise e
\ No newline at end of file
+ raise e
diff --git a/core/doctype/profile/profile.py b/core/doctype/profile/profile.py
index 393c9dfa50..35961c1b80 100644
--- a/core/doctype/profile/profile.py
+++ b/core/doctype/profile/profile.py
@@ -91,8 +91,8 @@ class DocType:
if self.in_insert:
webnotes.msgprint("New user created. - %s" % self.doc.name)
if cint(self.doc.send_invite_email):
- webnotes.msgprint("Sent welcome mail.")
self.send_welcome_mail(self.doc.new_password)
+ webnotes.msgprint("Sent welcome mail.")
else:
self.password_reset_mail(self.doc.new_password)
webnotes.msgprint("Password updated.")
@@ -129,12 +129,10 @@ To login to %(product)s, please go to:
Thank you,
%(user_fullname)s
"""
- import startup
- self.send_login_mail("Your " +startup.product_name + " password has been reset", txt, password)
+ self.send_login_mail("Your " + webnotes.get_config().get("app_name") + " password has been reset", txt, password)
def send_welcome_mail(self, password):
"""send welcome mail to user with password and login url"""
- import startup
txt = """
## %(company)s
@@ -153,25 +151,28 @@ To login to your new %(product)s account, please go to:
Thank you,
%(user_fullname)s
"""
- self.send_login_mail("Welcome to " + startup.product_name, txt, password)
+ self.send_login_mail("Welcome to " + webnotes.get_config().get("app_name"), txt, password)
def send_login_mail(self, subject, txt, password):
"""send mail with login details"""
import os
- import startup
from webnotes.utils.email_lib import sendmail_md
from webnotes.profile import get_user_fullname
from webnotes.utils import get_request_site_address
+
+ full_name = get_user_fullname(webnotes.session['user'])
+ if full_name == "Guest":
+ full_name = "Administrator"
args = {
'first_name': self.doc.first_name or self.doc.last_name or "user",
'user': self.doc.name,
'password': password,
- 'company': webnotes.conn.get_default('company') or startup.product_name,
+ 'company': webnotes.conn.get_default('company') or webnotes.get_config().get("app_name"),
'login_url': get_request_site_address(),
- 'product': startup.product_name,
- 'user_fullname': get_user_fullname(webnotes.session['user'])
+ 'product': webnotes.get_config().get("app_name"),
+ 'user_fullname': full_name
}
sender = webnotes.session.user not in ("Administrator", "Guest") and webnotes.session.user or None
diff --git a/core/page/data_import_tool/data_import_tool.py b/core/page/data_import_tool/data_import_tool.py
index 79076485ee..9df3fff47d 100644
--- a/core/page/data_import_tool/data_import_tool.py
+++ b/core/page/data_import_tool/data_import_tool.py
@@ -467,3 +467,9 @@ def delete_child_rows(rows, doctype):
"""delete child rows for all parents"""
for p in list(set([r[1] for r in rows])):
webnotes.conn.sql("""delete from `tab%s` where parent=%s""" % (doctype, '%s'), p)
+
+def import_file_by_path(path):
+ from webnotes.utils.datautils import read_csv_content
+ print "Importing " + path
+ with open(path, "r") as infile:
+ upload(rows = read_csv_content(infile.read()))
diff --git a/public/build.json b/public/build.json
index 1c8985f907..f25bd3d674 100644
--- a/public/build.json
+++ b/public/build.json
@@ -3,9 +3,19 @@
"public/css/all-web.css": [
"lib/public/css/bootstrap.css",
"lib/public/css/font-awesome.css",
+ "lib/public/css/nprogress.css",
"lib/website/css/website.css"
]
},
+
+ {
+ "public/js/all-web.min.js": [
+ "lib/public/js/lib/bootstrap.min.js",
+ "lib/public/js/wn/misc/number_format.js",
+ "lib/public/js/lib/nprogress.js",
+ "lib/website/js/website.js"
+ ]
+ },
{
"public/css/all-app.css": [
@@ -23,14 +33,6 @@
"lib/public/css/nprogress.css",
]
},
-
- {
- "public/js/all-web.min.js": [
- "lib/public/js/lib/bootstrap.min.js",
- "lib/public/js/wn/misc/number_format.js",
- "lib/website/js/website.js"
- ]
- },
{
"public/js/all-app.min.js": [
diff --git a/public/js/wn/form/attachments.js b/public/js/wn/form/attachments.js
index 9a2a976004..36018a2652 100644
--- a/public/js/wn/form/attachments.js
+++ b/public/js/wn/form/attachments.js
@@ -141,7 +141,7 @@ wn.ui.form.Attachments = Class.extend({
this.add_to_attachments(fileid, filename);
this.refresh();
if(fieldname) {
- this.frm.set_value(fieldname, "files/"+filename);
+ this.frm.set_value(fieldname, wn.utils.get_file_link(filename));
this.frm.cscript[fieldname] && this.frm.cscript[fieldname](this.frm.doc);
}
}
diff --git a/public/js/wn/form/control.js b/public/js/wn/form/control.js
index 9b96190da0..71a95b55a7 100644
--- a/public/js/wn/form/control.js
+++ b/public/js/wn/form/control.js
@@ -568,7 +568,7 @@ wn.ui.form.ControlSelect = wn.ui.form.ControlData.extend({
this.set_description("");
var options = [""];
for(var fname in fl) {
- if(fname.substr(0,4)!="http")
+ if(fname.indexOf("/")===-1)
fname = "files/" + fname;
options.push(fname);
}
diff --git a/public/js/wn/form/editors.js b/public/js/wn/form/editors.js
index 303639684f..e5cb266d8d 100644
--- a/public/js/wn/form/editors.js
+++ b/public/js/wn/form/editors.js
@@ -157,8 +157,9 @@ wn.editors.BootstrapWYSIWYG = Class.extend({
me.$textarea.val(html_beautify(me.$editor.cleanHtml()));
me.$parent.find(".for-rich-text").toggle(false);
me.$parent.find(".for-html").toggle(true);
- me.$parent.find(".btn-html").addClass("btn-info").prop("disabled", true);
- me.$parent.find(".btn-rich-text").removeClass("btn-info").prop("disabled", false);
+ console.log(me.$parent.find(".btn-html"));
+ me.$parent.find(".btn-html").attr("disabled", "disabled");
+ me.$parent.find(".btn-rich-text").attr("disabled", false);
me.current_editor = me.$textarea;
});
@@ -167,8 +168,9 @@ wn.editors.BootstrapWYSIWYG = Class.extend({
me.$editor.html(me.$textarea.val());
me.$parent.find(".for-rich-text").toggle(true);
me.$parent.find(".for-html").toggle(false);
- me.$parent.find(".btn-html").removeClass("btn-info").prop("disabled", false);
- me.$parent.find(".btn-rich-text").addClass("btn-info").prop("disabled", true);
+
+ me.$parent.find(".btn-rich-text").attr("disabled", "disabled");
+ me.$parent.find(".btn-html").attr("disabled", false);
me.current_editor = me.$editor;
});
diff --git a/public/js/wn/misc/utils.js b/public/js/wn/misc/utils.js
index de5d58080e..1497e6902b 100644
--- a/public/js/wn/misc/utils.js
+++ b/public/js/wn/misc/utils.js
@@ -5,8 +5,13 @@ wn.provide('wn.utils');
wn.utils = {
get_file_link: function(filename) {
- return wn.utils.is_url(filename) || (filename.indexOf("images/")!=-1) || (filename.indexOf("files/")!=-1)
- ? filename : 'files/' + filename;
+ if(wn.utils.is_url(filename)) {
+ return filename;
+ } else if(filename.indexOf("/")===-1) {
+ return "files/" + filename;
+ } else {
+ return filename;
+ }
},
is_html: function(txt) {
if(txt.indexOf("
")==-1 && txt.indexOf("
') + .html('