diff --git a/core/doctype/customize_form/customize_form.js b/core/doctype/customize_form/customize_form.js
index 245cae5ede..c2e39406b5 100644
--- a/core/doctype/customize_form/customize_form.js
+++ b/core/doctype/customize_form/customize_form.js
@@ -63,9 +63,9 @@ cur_frm.cscript.refresh = function() {
if(!cur_frm.doc.doc_type) {
var frm_head = cur_frm.frm_head.appframe;
- $(frm_head.buttons['Update']).attr('disabled', true);
- $(frm_head.buttons['Refresh Form']).attr('disabled', true);
- $(frm_head.buttons['Reset to defaults']).attr('disabled', true);
+ $(frm_head.buttons['Update']).prop('disabled', true);
+ $(frm_head.buttons['Refresh Form']).prop('disabled', true);
+ $(frm_head.buttons['Reset to defaults']).prop('disabled', true);
}
cur_frm.cscript.hide_allow_attach(cur_frm.doc);
diff --git a/core/page/permission_manager/permission_manager.js b/core/page/permission_manager/permission_manager.js
index 07479176e4..821f2e8133 100644
--- a/core/page/permission_manager/permission_manager.js
+++ b/core/page/permission_manager/permission_manager.js
@@ -341,11 +341,11 @@ wn.PermissionEngine = Class.extend({
});
if(me.get_doctype()) {
d.set_value("parent", me.get_doctype());
- d.get_input("parent").attr("disabled", true);
+ d.get_input("parent").prop("disabled", true);
}
if(me.get_role()) {
d.set_value("role", me.get_role());
- d.get_input("role").attr("disabled", true);
+ d.get_input("role").prop("disabled", true);
}
d.set_value("permlevel", "0");
d.get_input("add").click(function() {
diff --git a/core/page/user_properties/user_properties.js b/core/page/user_properties/user_properties.js
index b6df5ae273..f9c3c13853 100644
--- a/core/page/user_properties/user_properties.js
+++ b/core/page/user_properties/user_properties.js
@@ -185,11 +185,11 @@ wn.UserProperties = Class.extend({
});
if(me.get_user()) {
d.set_value("parent", me.get_user());
- d.get_input("parent").attr("disabled", true);
+ d.get_input("parent").prop("disabled", true);
}
if(me.get_property()) {
d.set_value("defkey", me.get_property());
- d.get_input("defkey").attr("disabled", true);
+ d.get_input("defkey").prop("disabled", true);
}
d.fields_dict["defvalue"].get_query = function(txt) {
diff --git a/public/build.json b/public/build.json
index c8a36e3e34..abf636cbd4 100644
--- a/public/build.json
+++ b/public/build.json
@@ -26,6 +26,7 @@
{
"public/js/all-web.min.js": [
"lib/public/js/lib/bootstrap.min.js",
+ "lib/public/js/wn/misc/number_format.js"
]
},
diff --git a/public/js/wn/dom.js b/public/js/wn/dom.js
index 8c887df947..6f0c6f1b44 100644
--- a/public/js/wn/dom.js
+++ b/public/js/wn/dom.js
@@ -231,7 +231,7 @@ wn.dom.set_box_shadow = function(ele, spread) {
}
$.fn.set_working = function() {
var ele = this.get(0);
- $(ele).attr('disabled', 'disabled');
+ $(ele).prop('disabled', true);
if(ele.loading_img) {
$(ele.loading_img).toggle(true);
} else {
@@ -242,7 +242,7 @@ wn.dom.set_box_shadow = function(ele, spread) {
}
$.fn.done_working = function() {
var ele = this.get(0);
- $(ele).attr('disabled', null);
+ $(ele).prop('disabled', false);
if(ele.loading_img) {
$(ele.loading_img).toggle(false);
};
diff --git a/public/js/wn/form/editors.js b/public/js/wn/form/editors.js
index e8cb6ef8a1..303639684f 100644
--- a/public/js/wn/form/editors.js
+++ b/public/js/wn/form/editors.js
@@ -152,23 +152,23 @@ wn.editors.BootstrapWYSIWYG = Class.extend({
this.current_editor = this.$editor;
this.$parent.find(".btn-html").click(function() {
- if($(this).attr("disabled")=="disabled") return;
+ if($(this).prop("disabled")==true) return;
wn.require("lib/js/lib/beautify-html.js");
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").attr("disabled", "disabled");
- me.$parent.find(".btn-rich-text").removeClass("btn-info").attr("disabled", false);
+ me.$parent.find(".btn-html").addClass("btn-info").prop("disabled", true);
+ me.$parent.find(".btn-rich-text").removeClass("btn-info").prop("disabled", false);
me.current_editor = me.$textarea;
});
this.$parent.find(".btn-rich-text").click(function() {
- if($(this).attr("disabled")=="disabled") return;
+ if($(this).prop("disabled")==true) return;
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").attr("disabled", false);
- me.$parent.find(".btn-rich-text").addClass("btn-info").attr("disabled", "disabled");
+ me.$parent.find(".btn-html").removeClass("btn-info").prop("disabled", false);
+ me.$parent.find(".btn-rich-text").addClass("btn-info").prop("disabled", true);
me.current_editor = me.$editor;
});
diff --git a/public/js/wn/form/workflow.js b/public/js/wn/form/workflow.js
index 6f118692aa..785e613c3c 100644
--- a/public/js/wn/form/workflow.js
+++ b/public/js/wn/form/workflow.js
@@ -97,7 +97,7 @@ wn.ui.form.States = Class.extend({
this.show_actions(state);
if(this.frm.doc.__islocal) {
- this.workflow_button.attr('disabled', true);
+ this.workflow_button.prop('disabled', true);
}
}
},
@@ -119,7 +119,7 @@ wn.ui.form.States = Class.extend({
// disable the button if user cannot change state
var is_final = !$ul.find("li").length;
this.workflow_button
- .attr('disabled', is_final);
+ .prop('disabled', is_final);
this.workflow_button.find(".caret").toggle(is_final ? false : true)
},
diff --git a/public/js/wn/misc/number_format.js b/public/js/wn/misc/number_format.js
index 8faeaa0428..2e767a707f 100644
--- a/public/js/wn/misc/number_format.js
+++ b/public/js/wn/misc/number_format.js
@@ -1,6 +1,8 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// MIT License. See license.txt
+if(!window.wn) wn = {};
+
function flt(v, decimals, number_format) {
if(v==null || v=='')return 0;
diff --git a/public/js/wn/misc/utils.js b/public/js/wn/misc/utils.js
index 6e2c6bc31d..de5d58080e 100644
--- a/public/js/wn/misc/utils.js
+++ b/public/js/wn/misc/utils.js
@@ -104,7 +104,7 @@ wn.utils = {
},
disable_export_btn: function(btn) {
if(!wn.user.is_report_manager()) {
- btn.attr("disabled", "disabled").attr("title",
+ btn.prop("disabled", true).attr("title",
wn._("Can only be exported by users with role 'Report Manager'"));
}
},
diff --git a/public/js/wn/model/doclist.js b/public/js/wn/model/doclist.js
index fb19fa330a..2de7096a0a 100644
--- a/public/js/wn/model/doclist.js
+++ b/public/js/wn/model/doclist.js
@@ -104,13 +104,13 @@ wn.model.DocList = Class.extend({
// callback: callback,
// btn: btn
// }
- $(opts.btn).attr("disabled", true);
+ $(opts.btn).prop("disabled", true);
return wn.call({
freeze: true,
method: opts.method,
args: opts.args,
callback: function(r) {
- $(opts.btn).attr("disabled", false);
+ $(opts.btn).prop("disabled", false);
opts.callback && opts.callback(r);
}
})
diff --git a/public/js/wn/views/communication.js b/public/js/wn/views/communication.js
index a0b7b4729f..34d2fe74da 100644
--- a/public/js/wn/views/communication.js
+++ b/public/js/wn/views/communication.js
@@ -288,7 +288,8 @@ wn.views.CommunicationComposer = Class.extend({
? cur_frm.communication_view.list
: [];
var signature = wn.boot.profile.email_signature || "";
-
+ var portal_link = this.setup_portal_link();
+
if(!wn.utils.is_html(signature)) {
signature = signature.replace(/\n/g, "
");
}
@@ -297,18 +298,44 @@ wn.views.CommunicationComposer = Class.extend({
this.message = '
'+wn._('Dear') +' ' + this.real_name + ",
" + (this.message || ""); } + var reply = (this.message || "") + + "" + signature + + "" + portal_link; + if(comm_list.length > 0) { - fields.content.set_input((this.message || "") + - "" - + signature - +"" + fields.content.set_input(reply + + "" +"-----"+wn._("In response to")+"-----" + comm_list[0].content); } else { - fields.content.set_input((this.message || "") - + "" + signature) + fields.content.set_input(reply); } }, + setup_portal_link: function() { + var me = this; + var portal_link = ""; + var show_portal_link = wn.boot.portal_links[this.doc.doctype] && + !(wn.boot.website_settings && cint(wn.boot.website_settings.disable_signup)); + if(show_portal_link) { + var portal_args = wn.boot.portal_links[this.doc.doctype]; + var valid = true; + if(portal_args.conditions) { + $.each(portal_args.conditions, function(k, v) { + if(me.doc[k] !== v) valid = false; + }); + } + if(valid) { + // set portal link + portal_link = repl("%(location)s/%(page)s?name=%(name)s", { + location: window.location.origin, + page: portal_args["page"], + name: encodeURIComponent(this.doc.name) + }); + portal_link = '--diff --git a/webnotes/webutils.py b/webnotes/webutils.py index eeb99d1f48..d38607c381 100644 --- a/webnotes/webutils.py +++ b/webnotes/webutils.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals -import os import conf import webnotes import webnotes.utils @@ -113,9 +112,6 @@ def build_html(args): return html -def get_standard_pages(): - return webnotes.get_config()["web"]["pages"].keys() - def prepare_args(page_name): has_app = True @@ -239,4 +235,13 @@ def get_generators(): def get_page_settings(): return webnotes.get_config()["web"]["pages"] - +def get_portal_links(): + portal_args = {} + for page, opts in webnotes.get_config()["web"]["pages"].items(): + if opts.get("portal"): + portal_args[opts["portal"]["doctype"]] = { + "page": page, + "conditions": opts["portal"].get("conditions") + } + + return portal_args