@@ -4,50 +4,7 @@ cur_frm.cscript.onload = function(doc) { | |||||
query: "core.doctype.communication.communication.get_user" | query: "core.doctype.communication.communication.get_user" | ||||
} | } | ||||
}; | }; | ||||
cur_frm.fields_dict.lead.get_query = function() { | |||||
return { | |||||
query: "core.doctype.communication.communication.get_lead" | |||||
} | |||||
}; | |||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { | |||||
return { query:"controllers.queries.customer_query" } } | |||||
cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) { | |||||
return { query:"controllers.queries.supplier_query" } } | |||||
if(doc.content) | if(doc.content) | ||||
doc.content = wn.utils.remove_script_and_style(doc.content); | doc.content = wn.utils.remove_script_and_style(doc.content); | ||||
} | |||||
cur_frm.cscript.refresh = function(doc, dt, dn) { | |||||
if(!doc.__islocal) { | |||||
var field_list = ['lead', 'customer', 'supplier', 'contact', 'opportunity', | |||||
'quotation', 'support_ticket']; | |||||
var hide_list = []; | |||||
$.each(field_list, function(i, v) { | |||||
if(!doc[v]) hide_list.push(v); | |||||
}); | |||||
if(hide_list.length < field_list.length) hide_field(hide_list); | |||||
} | |||||
} | |||||
cur_frm.cscript.contact = function(doc, dt, dn) { | |||||
if (doc.contact) { | |||||
return wn.call({ | |||||
method: 'support.doctype.communication.communication.get_customer_supplier', | |||||
args: { | |||||
contact: doc.contact | |||||
}, | |||||
callback: function(r, rt) { | |||||
if (!r.exc && r.message) { | |||||
doc = locals[doc.doctype][doc.name]; | |||||
doc[r.message['fieldname']] = r.message['value']; | |||||
refresh_field(r.message['fieldname']); | |||||
} | |||||
}, | |||||
}); | |||||
} | |||||
} | } |
@@ -2,7 +2,7 @@ | |||||
{ | { | ||||
"creation": "2013-01-29 10:47:14", | "creation": "2013-01-29 10:47:14", | ||||
"docstatus": 0, | "docstatus": 0, | ||||
"modified": "2013-09-02 18:16:52", | |||||
"modified": "2013-09-25 10:30:31", | |||||
"modified_by": "Administrator", | "modified_by": "Administrator", | ||||
"owner": "Administrator" | "owner": "Administrator" | ||||
}, | }, | ||||
@@ -27,18 +27,13 @@ | |||||
"permlevel": 0 | "permlevel": 0 | ||||
}, | }, | ||||
{ | { | ||||
"cancel": 1, | |||||
"create": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"name": "__common__", | "name": "__common__", | ||||
"parent": "Communication", | "parent": "Communication", | ||||
"parentfield": "permissions", | "parentfield": "permissions", | ||||
"parenttype": "DocType", | "parenttype": "DocType", | ||||
"permlevel": 0, | "permlevel": 0, | ||||
"read": 1, | |||||
"report": 1, | |||||
"submit": 0, | |||||
"write": 1 | |||||
"read": 1 | |||||
}, | }, | ||||
{ | { | ||||
"doctype": "DocType", | "doctype": "DocType", | ||||
@@ -153,14 +148,6 @@ | |||||
"options": "Profile", | "options": "Profile", | ||||
"read_only": 1 | "read_only": 1 | ||||
}, | }, | ||||
{ | |||||
"doctype": "DocField", | |||||
"fieldname": "sales_person", | |||||
"fieldtype": "Link", | |||||
"label": "Sales Person", | |||||
"options": "Sales Person", | |||||
"read_only": 1 | |||||
}, | |||||
{ | { | ||||
"doctype": "DocField", | "doctype": "DocField", | ||||
"fieldname": "column_break5", | "fieldname": "column_break5", | ||||
@@ -184,26 +171,16 @@ | |||||
"print_hide": 1 | "print_hide": 1 | ||||
}, | }, | ||||
{ | { | ||||
"amend": 0, | |||||
"doctype": "DocPerm", | |||||
"role": "Support Team" | |||||
}, | |||||
{ | |||||
"amend": 0, | |||||
"doctype": "DocPerm", | |||||
"role": "Sales Manager" | |||||
}, | |||||
{ | |||||
"amend": 0, | |||||
"doctype": "DocPerm", | |||||
"role": "Sales User" | |||||
}, | |||||
{ | |||||
"cancel": 1, | |||||
"create": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"role": "Support Manager" | |||||
"report": 1, | |||||
"role": "System Manager", | |||||
"submit": 0, | |||||
"write": 1 | |||||
}, | }, | ||||
{ | { | ||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"role": "System Manager" | |||||
"role": "All" | |||||
} | } | ||||
] | ] |
@@ -29,7 +29,7 @@ class DocType(): | |||||
def on_trash(self): | def on_trash(self): | ||||
if self.doc.file_name and webnotes.conn.sql("""select count(*) from `tabFile Data` | if self.doc.file_name and webnotes.conn.sql("""select count(*) from `tabFile Data` | ||||
where file_name=%s""", self.doc.file_name)[0][0]==1: | where file_name=%s""", self.doc.file_name)[0][0]==1: | ||||
path = webnotes.utils.get_storage_path(conf.files_path, self.doc.file_name) | |||||
path = webnotes.utils.get_site_path(conf.files_path, self.doc.file_name) | |||||
if os.path.exists(path): | if os.path.exists(path): | ||||
os.remove(path) | os.remove(path) | ||||
@@ -31,7 +31,6 @@ | |||||
"lib/public/css/common.css", | "lib/public/css/common.css", | ||||
"lib/public/css/tree_grid.css", | "lib/public/css/tree_grid.css", | ||||
"lib/public/css/nprogress.css", | "lib/public/css/nprogress.css", | ||||
"lib/public/css/typeahead.css", | |||||
] | ] | ||||
}, | }, | ||||
@@ -42,7 +41,6 @@ | |||||
"lib/public/js/lib/jquery/jquery.hotkeys.js", | "lib/public/js/lib/jquery/jquery.hotkeys.js", | ||||
"lib/public/js/lib/center_image.js", | "lib/public/js/lib/center_image.js", | ||||
"lib/public/js/lib/bootstrap.min.js", | "lib/public/js/lib/bootstrap.min.js", | ||||
"lib/public/js/lib/typeahead.js", | |||||
"lib/public/js/lib/nprogress.js", | "lib/public/js/lib/nprogress.js", | ||||
"lib/public/js/wn/provide.js", | "lib/public/js/wn/provide.js", | ||||
@@ -225,13 +225,6 @@ | |||||
background-color: #e6e6e6; | background-color: #e6e6e6; | ||||
background-repeat: no-repeat; | background-repeat: no-repeat; | ||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6)); | |||||
background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); | |||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); | text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); | ||||
@@ -282,15 +275,6 @@ | |||||
margin-bottom: 18px; | margin-bottom: 18px; | ||||
color: #404040; | color: #404040; | ||||
background-color: #eedc94; | background-color: #eedc94; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94)); | |||||
background-image: -moz-linear-gradient(top, #fceec1, #eedc94); | |||||
background-image: -ms-linear-gradient(top, #fceec1, #eedc94); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94)); | |||||
background-image: -webkit-linear-gradient(top, #fceec1, #eedc94); | |||||
background-image: -o-linear-gradient(top, #fceec1, #eedc94); | |||||
background-image: linear-gradient(top, #fceec1, #eedc94); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #eedc94 #eedc94 #e4c652; | border-color: #eedc94 #eedc94 #e4c652; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -322,16 +306,6 @@ | |||||
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); | -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); | ||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); | ||||
background-color: #c43c35; | background-color: #c43c35; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35)); | |||||
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35)); | |||||
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: linear-gradient(top, #ee5f5b, #c43c35); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | |||||
border-color: #c43c35 #c43c35 #882a25; | border-color: #c43c35 #c43c35 #882a25; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -610,14 +584,6 @@ | |||||
cursor: pointer; | cursor: pointer; | ||||
display: inline-block; | display: inline-block; | ||||
background-color: #e6e6e6; | background-color: #e6e6e6; | ||||
background-repeat: no-repeat; | |||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6)); | |||||
background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); | |||||
padding: 5px 14px 6px; | padding: 5px 14px 6px; | ||||
margin: 0; | margin: 0; | ||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); | text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); | ||||
@@ -641,15 +607,6 @@ | |||||
.ui-button-primary { | .ui-button-primary { | ||||
color: #ffffff; | color: #ffffff; | ||||
background-color: #0064cd; | background-color: #0064cd; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd)); | |||||
background-image: -moz-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -ms-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd)); | |||||
background-image: -webkit-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -o-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: linear-gradient(top, #049cdb, #0064cd); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #0064cd #0064cd #003f81; | border-color: #0064cd #0064cd #003f81; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -659,15 +616,6 @@ | |||||
.ui-button-success{ | .ui-button-success{ | ||||
color:#ffffff; | color:#ffffff; | ||||
background-color: #57a957; | background-color: #57a957; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957)); | |||||
background-image: -moz-linear-gradient(top, #62c462, #57a957); | |||||
background-image: -ms-linear-gradient(top, #62c462, #57a957); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957)); | |||||
background-image: -webkit-linear-gradient(top, #62c462, #57a957); | |||||
background-image: -o-linear-gradient(top, #62c462, #57a957); | |||||
background-image: linear-gradient(top, #62c462, #57a957); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #57a957 #57a957 #3d773d; | border-color: #57a957 #57a957 #3d773d; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -676,15 +624,6 @@ | |||||
.ui-button-error{ | .ui-button-error{ | ||||
color:#ffffff; | color:#ffffff; | ||||
background-color: #c43c35; | background-color: #c43c35; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35)); | |||||
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35)); | |||||
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); | |||||
background-image: linear-gradient(top, #ee5f5b, #c43c35); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #c43c35 #c43c35 #882a25; | border-color: #c43c35 #c43c35 #882a25; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -720,15 +659,6 @@ button.ui-button-icons-only { width: 3.7em; } | |||||
.ui-buttonset .ui-state-active { | .ui-buttonset .ui-state-active { | ||||
color: #ffffff; | color: #ffffff; | ||||
background-color: #0064cd; | background-color: #0064cd; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd)); | |||||
background-image: -moz-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -ms-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd)); | |||||
background-image: -webkit-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -o-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: linear-gradient(top, #049cdb, #0064cd); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #0064cd #0064cd #003f81; | border-color: #0064cd #0064cd #003f81; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -761,15 +691,6 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad | |||||
color: #ffffff; | color: #ffffff; | ||||
background: #0064cd; | background: #0064cd; | ||||
background-color: #0064cd; | background-color: #0064cd; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd)); | |||||
background-image: -moz-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -ms-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd)); | |||||
background-image: -webkit-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -o-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: linear-gradient(top, #049cdb, #0064cd); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #0064cd #0064cd #003f81; | border-color: #0064cd #0064cd #003f81; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -811,15 +732,6 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad | |||||
color: #ffffff; | color: #ffffff; | ||||
background-color: #0064cd; | background-color: #0064cd; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd)); | |||||
background-image: -moz-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -ms-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd)); | |||||
background-image: -webkit-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -o-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: linear-gradient(top, #049cdb, #0064cd); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #0064cd #0064cd #003f81; | border-color: #0064cd #0064cd #003f81; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -965,15 +877,6 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad | |||||
color: #ffffff; | color: #ffffff; | ||||
background: #0064cd; | background: #0064cd; | ||||
background-color: #0064cd; | background-color: #0064cd; | ||||
background-repeat: repeat-x; | |||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd)); | |||||
background-image: -moz-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -ms-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd)); | |||||
background-image: -webkit-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: -o-linear-gradient(top, #049cdb, #0064cd); | |||||
background-image: linear-gradient(top, #049cdb, #0064cd); | |||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0); | |||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); | ||||
border-color: #0064cd #0064cd #003f81; | border-color: #0064cd #0064cd #003f81; | ||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); | ||||
@@ -609,8 +609,8 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({ | |||||
//this.bind_change_event(); | //this.bind_change_event(); | ||||
var me = this; | var me = this; | ||||
this.setup_buttons(); | this.setup_buttons(); | ||||
this.setup_typeahead(); | |||||
//this.setup_autocomplete(); | |||||
//this.setup_typeahead(); | |||||
this.setup_autocomplete(); | |||||
}, | }, | ||||
setup_buttons: function() { | setup_buttons: function() { | ||||
var me = this; | var me = this; | ||||
@@ -643,81 +643,82 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({ | |||||
this.$input_area.find(".btn-new").remove(); | this.$input_area.find(".btn-new").remove(); | ||||
} | } | ||||
}, | }, | ||||
setup_typeahead: function() { | |||||
var me = this; | |||||
var method = "webnotes.widgets.search.search_link"; | |||||
var args = {}; | |||||
this.set_custom_query(args); | |||||
// custom query | |||||
if(args.query) { | |||||
method = args.query | |||||
} | |||||
var _change = function() { | |||||
var val = me.get_value(); | |||||
if(me.frm && me.frm.doc) { | |||||
me.selected = true; | |||||
me.parse_validate_and_set_in_model(val); | |||||
} else { | |||||
me.$input.trigger("change"); | |||||
} | |||||
} | |||||
// filter based on arguments | |||||
var filter_fn = function(r) { | |||||
if(r.exc) console.log(r.exc); | |||||
var filter_args = {}; | |||||
me.set_custom_query(filter_args) | |||||
if(filter_args.filters) { | |||||
return wn.utils.filter_dict(r.results, filter_args.filters); | |||||
} else { | |||||
return r.results; | |||||
} | |||||
} | |||||
// default query args | |||||
var query_args = { | |||||
cmd: method, | |||||
txt: "%", | |||||
page_len: "9999", | |||||
doctype: me.df.options, | |||||
} | |||||
// append filter keys (needed for client-side filtering) | |||||
if(args.filters) { | |||||
query_args.search_fields = ["name"].concat(keys(args.filters)); | |||||
} | |||||
this.$input.typeahead("destroy").typeahead({ | |||||
name: me.df.parent + ":" + me.df.fieldname, | |||||
prefetch: { | |||||
url: "server.py?" + wn.utils.get_url_from_dict(query_args), | |||||
filter: filter_fn, | |||||
}, | |||||
remote: { | |||||
url: "server.py?" + wn.utils.get_url_from_dict($.extend(query_args, {"txt": null})) + "&txt=%QUERY", | |||||
filter: filter_fn, | |||||
}, | |||||
template: function(d) { | |||||
if(keys(d).length > 1) { | |||||
d.info = $.map(d, function(val, key) { return key==="name" ? null : val }).join(", "); | |||||
return repl("<p>%(value)s<br><span class='text-muted'>%(info)s</span></p>", d); | |||||
} else { | |||||
return d.value; | |||||
} | |||||
} | |||||
}).on("typeahead:selected", function(d) { | |||||
_change(); | |||||
}).on("typeahead:autocompleted", function(d) { | |||||
_change(); | |||||
}); | |||||
this.set_input = function(val) { | |||||
me.$input.typeahead("setQuery", val || ""); | |||||
} | |||||
}, | |||||
// setup_typeahead: function() { | |||||
// var me = this; | |||||
// var method = "webnotes.widgets.search.search_link"; | |||||
// var args = {}; | |||||
// this.set_custom_query(args); | |||||
// | |||||
// // custom query | |||||
// if(args.query) { | |||||
// method = args.query | |||||
// } | |||||
// | |||||
// var _change = function() { | |||||
// var val = me.get_value(); | |||||
// if(me.frm && me.frm.doc) { | |||||
// me.selected = true; | |||||
// me.parse_validate_and_set_in_model(val); | |||||
// } else { | |||||
// me.$input.trigger("change"); | |||||
// } | |||||
// } | |||||
// | |||||
// // filter based on arguments | |||||
// var filter_fn = function(r) { | |||||
// if(r.exc) console.log(r.exc); | |||||
// var filter_args = {}; | |||||
// me.set_custom_query(filter_args) | |||||
// if(filter_args.filters) { | |||||
// return wn.utils.filter_dict(r.results, filter_args.filters); | |||||
// } else { | |||||
// return r.results; | |||||
// } | |||||
// } | |||||
// | |||||
// // default query args | |||||
// var query_args = { | |||||
// cmd: method, | |||||
// txt: "%", | |||||
// page_len: "9999", | |||||
// doctype: me.df.options, | |||||
// } | |||||
// | |||||
// // append filter keys (needed for client-side filtering) | |||||
// if(args.filters) { | |||||
// query_args.search_fields = ["name"].concat(keys(args.filters)); | |||||
// } | |||||
// | |||||
// this.$input.typeahead("destroy").typeahead({ | |||||
// name: me.df.parent + ":" + me.df.fieldname, | |||||
// prefetch: { | |||||
// url: "server.py?" + wn.utils.get_url_from_dict(query_args), | |||||
// filter: filter_fn, | |||||
// }, | |||||
// remote: { | |||||
// url: "server.py?" + wn.utils.get_url_from_dict($.extend(query_args, {"txt": null})) + "&txt=%QUERY", | |||||
// filter: filter_fn, | |||||
// }, | |||||
// template: function(d) { | |||||
// if(keys(d).length > 1) { | |||||
// d.info = $.map(d, function(val, key) { return key==="name" ? null : val }).join(", "); | |||||
// return repl("<p>%(value)s<br><span class='text-muted'>%(info)s</span></p>", d); | |||||
// } else { | |||||
// return d.value; | |||||
// } | |||||
// } | |||||
// }).on("typeahead:selected", function(d) { | |||||
// _change(); | |||||
// }).on("typeahead:autocompleted", function(d) { | |||||
// _change(); | |||||
// }); | |||||
// | |||||
// this.set_input = function(val) { | |||||
// me.$input.typeahead("setQuery", val || ""); | |||||
// } | |||||
// }, | |||||
setup_autocomplete: function() { | setup_autocomplete: function() { | ||||
var me = this; | |||||
this.$input.on("blur", function() { | this.$input.on("blur", function() { | ||||
if(me.selected) { | if(me.selected) { | ||||
me.selected = false; | me.selected = false; | ||||
@@ -742,6 +743,7 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({ | |||||
return wn.call({ | return wn.call({ | ||||
type: "GET", | type: "GET", | ||||
method:'webnotes.widgets.search.search_link', | method:'webnotes.widgets.search.search_link', | ||||
no_spinner: true, | |||||
args: args, | args: args, | ||||
callback: function(r) { | callback: function(r) { | ||||
response(r.results); | response(r.results); | ||||
@@ -764,13 +766,18 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({ | |||||
me.$input.trigger("change"); | me.$input.trigger("change"); | ||||
} | } | ||||
} | } | ||||
}).data('uiAutocomplete')._renderItem = function(ul, item) { | |||||
if(!item.label) item.label = item.value; | |||||
}).data('uiAutocomplete')._renderItem = function(ul, d) { | |||||
var html = ""; | |||||
if(keys(d).length > 1) { | |||||
d.info = $.map(d, function(val, key) { return ["value", "label"].indexOf(key)!==-1 ? null : val }).join(", "); | |||||
html = repl("<a>%(value)s<br><span class='text-muted'>%(info)s</span></a>", d); | |||||
} else { | |||||
html = "<a>" + d.value + "</a>"; | |||||
} | |||||
return $('<li></li>') | return $('<li></li>') | ||||
.data('item.autocomplete', item) | |||||
.append(repl('<a><span style="font-weight: bold;">%(label)s</span><br>\ | |||||
<span style="font-size:10px;">%(info)s</span></a>', | |||||
item)) | |||||
.data('item.autocomplete', d) | |||||
.append(html) | |||||
.appendTo(ul); | .appendTo(ul); | ||||
}; | }; | ||||
// remove accessibility span (for now) | // remove accessibility span (for now) | ||||
@@ -535,16 +535,16 @@ def get_config(): | |||||
def get_conf(site): | def get_conf(site): | ||||
# TODO Should be heavily cached! | # TODO Should be heavily cached! | ||||
import conf | import conf | ||||
from webnotes.utils import get_storage_base_path | |||||
conf = _dict(conf.__dict__) | |||||
from webnotes.utils import get_site_base_path | |||||
site_config = _dict({}) | |||||
conf = site_config.update(conf.__dict__) | |||||
if conf.sites_dir and site: | if conf.sites_dir and site: | ||||
conf_path = os.path.join(get_storage_base_path(sites_dir=conf.sites_dir, hostname=site), 'site_config.json') | |||||
conf_path = os.path.join(get_site_base_path(sites_dir=conf.sites_dir, hostname=site), 'site_config.json') | |||||
if os.path.exists(conf_path): | if os.path.exists(conf_path): | ||||
with open(conf_path, 'r') as f: | with open(conf_path, 'r') as f: | ||||
site_config = json.load(f) | |||||
site_config.update(conf) | |||||
site_config.update(json.load(f)) | |||||
site_config['site'] = site | site_config['site'] = site | ||||
return _dict(site_config) | |||||
return site_config | |||||
else: | else: | ||||
raise NotFound() | raise NotFound() | ||||
@@ -77,7 +77,7 @@ def execute_patch(patchmodule, method=None, methodargs=None): | |||||
def add_to_patch_log(tb): | def add_to_patch_log(tb): | ||||
"""add error log to patches/patch.log""" | """add error log to patches/patch.log""" | ||||
import conf, os | import conf, os | ||||
# TODO use get_storage_base_path | |||||
# TODO use get_site_base_path | |||||
with open(os.path.join(os.path.dirname(conf.__file__), 'app', 'patches','patch.log'),'a') as patchlog: | with open(os.path.join(os.path.dirname(conf.__file__), 'app', 'patches','patch.log'),'a') as patchlog: | ||||
patchlog.write('\n\n' + tb) | patchlog.write('\n\n' + tb) | ||||
@@ -822,8 +822,8 @@ def get_base_path(): | |||||
import os | import os | ||||
return os.path.dirname(os.path.abspath(conf.__file__)) | return os.path.dirname(os.path.abspath(conf.__file__)) | ||||
def get_storage_base_path(sites_dir=None, hostname=None): | |||||
if not conf.sites_dir: | |||||
def get_site_base_path(sites_dir=None, hostname=None): | |||||
if conf and not conf.sites_dir: | |||||
return get_base_path() | return get_base_path() | ||||
if not sites_dir and not hostname: | if not sites_dir and not hostname: | ||||
@@ -833,8 +833,8 @@ def get_storage_base_path(sites_dir=None, hostname=None): | |||||
import os | import os | ||||
return os.path.join(sites_dir, hostname) | return os.path.join(sites_dir, hostname) | ||||
def get_storage_path(*path): | |||||
return get_path(base=get_storage_base_path(), *path) | |||||
def get_site_path(*path): | |||||
return get_path(base=get_site_base_path(), *path) | |||||
def get_url(uri=None): | def get_url(uri=None): | ||||
url = get_request_site_address() | url = get_request_site_address() | ||||
@@ -70,7 +70,7 @@ class BackupGenerator: | |||||
self.backup_path_db = this_file_path | self.backup_path_db = this_file_path | ||||
def zip_files(self): | def zip_files(self): | ||||
files_path = webnotes.utils.get_storage_path(conf.files_path) | |||||
files_path = webnotes.utils.get_site_path(conf.files_path) | |||||
cmd_string = """tar -cf %s %s""" % (self.backup_path_files, files_path) | cmd_string = """tar -cf %s %s""" % (self.backup_path_files, files_path) | ||||
err, out = webnotes.utils.execute_in_shell(cmd_string) | err, out = webnotes.utils.execute_in_shell(cmd_string) | ||||
@@ -185,8 +185,8 @@ def get_backup_path(): | |||||
global backup_path | global backup_path | ||||
if not backup_path: | if not backup_path: | ||||
import os | import os | ||||
# TODO Use get_storage_base_path | |||||
backup_path = webnotes.utils.get_storage_path(conf.backup_path) | |||||
# TODO Use get_site_base_path | |||||
backup_path = webnotes.utils.get_site_path(conf.backup_path) | |||||
return backup_path | return backup_path | ||||
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||||
@@ -4,7 +4,7 @@ | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
import webnotes | import webnotes | ||||
import os | import os | ||||
from webnotes.utils import cstr, cint, get_storage_path | |||||
from webnotes.utils import cstr, cint, get_site_path | |||||
from webnotes import _ | from webnotes import _ | ||||
from webnotes import conf | from webnotes import conf | ||||
@@ -65,7 +65,7 @@ def get_uploaded_content(): | |||||
def save_file(fname, content, dt, dn): | def save_file(fname, content, dt, dn): | ||||
import filecmp | import filecmp | ||||
from webnotes.model.code import load_doctype_module | from webnotes.model.code import load_doctype_module | ||||
files_path = get_storage_path(conf.public_path) | |||||
files_path = get_site_path(conf.public_path) | |||||
module = load_doctype_module(dt, webnotes.conn.get_value("DocType", dt, "module")) | module = load_doctype_module(dt, webnotes.conn.get_value("DocType", dt, "module")) | ||||
if hasattr(module, "attachments_folder"): | if hasattr(module, "attachments_folder"): | ||||
@@ -103,7 +103,7 @@ def save_file(fname, content, dt, dn): | |||||
f = webnotes.bean({ | f = webnotes.bean({ | ||||
"doctype": "File Data", | "doctype": "File Data", | ||||
"file_name": os.path.relpath(os.path.join(files_path, fname), get_storage_path(conf.public_path)), | |||||
"file_name": os.path.relpath(os.path.join(files_path, fname), get_site_path(conf.public_path)), | |||||
"attached_to_doctype": dt, | "attached_to_doctype": dt, | ||||
"attached_to_name": dn, | "attached_to_name": dn, | ||||
"file_size": file_size | "file_size": file_size | ||||
@@ -184,7 +184,7 @@ def get_file(fname): | |||||
# read the file | # read the file | ||||
import os | import os | ||||
files_path = get_storage_path(conf.files_path) | |||||
files_path = get_site_path(conf.files_path) | |||||
file_path = os.path.join(files_path, file_name) | file_path = os.path.join(files_path, file_name) | ||||
if not os.path.exists(file_path): | if not os.path.exists(file_path): | ||||
# check in folders | # check in folders | ||||