Kaynağa Gözat

[fix] [client script] call cur_frm.cscript.custom_ type functions in the callback of standard functions

version-14
Anand Doshi 12 yıl önce
ebeveyn
işleme
f6f54d7027
44 değiştirilmiş dosya ile 94 ekleme ve 105 silme
  1. +1
    -1
      core/doctype/communication/communication.js
  2. +1
    -1
      core/doctype/custom_field/custom_field.js
  3. +3
    -3
      core/doctype/customize_form/customize_form.js
  4. +2
    -2
      core/doctype/documentation_tool/documentation_tool.js
  5. +2
    -2
      core/doctype/profile/profile.js
  6. +2
    -2
      core/page/data_import_tool/data_import_tool.js
  7. +3
    -3
      core/page/messages/messages.js
  8. +1
    -1
      core/page/modules_setup/modules_setup.js
  9. +8
    -8
      core/page/permission_manager/permission_manager.js
  10. +3
    -3
      core/page/todo/todo.js
  11. +1
    -1
      core/page/update_manager/update_manager.js
  12. +4
    -4
      core/page/user_properties/user_properties.js
  13. +3
    -23
      public/js/legacy/clientscriptAPI.js
  14. +1
    -1
      public/js/legacy/form.js
  15. +3
    -3
      public/js/legacy/handler.js
  16. +3
    -3
      public/js/wn/app.js
  17. +1
    -1
      public/js/wn/defaults.js
  18. +1
    -1
      public/js/wn/form/assign_to.js
  19. +1
    -1
      public/js/wn/form/attachments.js
  20. +2
    -2
      public/js/wn/form/comments.js
  21. +7
    -2
      public/js/wn/form/control.js
  22. +1
    -1
      public/js/wn/form/infobar.js
  23. +1
    -1
      public/js/wn/form/link_selector.js
  24. +9
    -5
      public/js/wn/form/script_manager.js
  25. +1
    -1
      public/js/wn/misc/tools.js
  26. +2
    -2
      public/js/wn/model/create_new.js
  27. +1
    -1
      public/js/wn/model/doclist.js
  28. +4
    -4
      public/js/wn/model/model.js
  29. +2
    -2
      public/js/wn/request.js
  30. +1
    -1
      public/js/wn/ui/listing.js
  31. +2
    -2
      public/js/wn/ui/tags.js
  32. +1
    -1
      public/js/wn/ui/toolbar/toolbar.js
  33. +1
    -1
      public/js/wn/ui/tree.js
  34. +1
    -1
      public/js/wn/upload.js
  35. +2
    -2
      public/js/wn/views/calendar.js
  36. +2
    -2
      public/js/wn/views/communication.js
  37. +1
    -1
      public/js/wn/views/doclistview.js
  38. +1
    -1
      public/js/wn/views/ganttview.js
  39. +1
    -1
      public/js/wn/views/grid_report.js
  40. +1
    -1
      public/js/wn/views/moduleview.js
  41. +1
    -1
      public/js/wn/views/pageview.js
  42. +2
    -2
      public/js/wn/views/query_report.js
  43. +2
    -2
      public/js/wn/views/reportview.js
  44. +1
    -1
      public/js/wn/views/sidebar_stats.js

+ 1
- 1
core/doctype/communication/communication.js Dosyayı Görüntüle

@@ -36,7 +36,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {


cur_frm.cscript.contact = function(doc, dt, dn) { cur_frm.cscript.contact = function(doc, dt, dn) {
if (doc.contact) { if (doc.contact) {
wn.call({
return wn.call({
method: 'support.doctype.communication.communication.get_customer_supplier', method: 'support.doctype.communication.communication.get_customer_supplier',
args: { args: {
contact: doc.contact contact: doc.contact


+ 1
- 1
core/doctype/custom_field/custom_field.js Dosyayı Görüntüle

@@ -75,7 +75,7 @@ cur_frm.cscript.dt = function(doc, dt, dn) {
set_field_options('insert_after', ''); set_field_options('insert_after', '');
return; return;
} }
wn.call({
return wn.call({
method: 'core.doctype.custom_field.custom_field.get_fields_label', method: 'core.doctype.custom_field.custom_field.get_fields_label',
args: { doctype: doc.dt, fieldname: doc.fieldname }, args: { doctype: doc.dt, fieldname: doc.fieldname },
callback: function(r, rt) { callback: function(r, rt) {


+ 3
- 3
core/doctype/customize_form/customize_form.js Dosyayı Görüntüle

@@ -27,7 +27,7 @@ $(cur_frm.wrapper).on("grid-row-render", function(e, grid_row) {
}) })


cur_frm.cscript.doc_type = function(doc, dt, dn) { cur_frm.cscript.doc_type = function(doc, dt, dn) {
cur_frm.call({
return cur_frm.call({
method: "get", method: "get",
doc: cur_frm.doc, doc: cur_frm.doc,
callback: function(r) { callback: function(r) {
@@ -58,7 +58,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {


cur_frm.add_custom_button('Update', function() { cur_frm.add_custom_button('Update', function() {
if(cur_frm.doc.doc_type) { if(cur_frm.doc.doc_type) {
cur_frm.call({
return cur_frm.call({
doc: cur_frm.doc, doc: cur_frm.doc,
method: "post", method: "post",
callback: function(r) { callback: function(r) {
@@ -129,7 +129,7 @@ cur_frm.confirm = function(msg, doc, dt, dn) {
$y(button_wrapper, {paddingTop: '15px'}); $y(button_wrapper, {paddingTop: '15px'});
var proceed_btn = $btn(button_wrapper, 'Proceed', function() { var proceed_btn = $btn(button_wrapper, 'Proceed', function() {
cur_frm.call({
return cur_frm.call({
doc: cur_frm.doc, doc: cur_frm.doc,
method: "delete", method: "delete",
callback: function(r) { callback: function(r) {


+ 2
- 2
core/doctype/documentation_tool/documentation_tool.js Dosyayı Görüntüle

@@ -64,7 +64,7 @@ wn.docs.generate_all = function(logarea) {
logarea.empty().append("Downloading server docs...<br>"); logarea.empty().append("Downloading server docs...<br>");
wn.call({
return wn.call({
"method": "core.doctype.documentation_tool.documentation_tool.get_docs", "method": "core.doctype.documentation_tool.documentation_tool.get_docs",
args: {options: cur_frm.doc}, args: {options: cur_frm.doc},
callback: function(r) { callback: function(r) {
@@ -86,7 +86,7 @@ wn.docs.generate_all = function(logarea) {
make_page("docs"); make_page("docs");


logarea.append("Writing...<br>"); logarea.append("Writing...<br>");
wn.call({
return wn.call({
method: "core.doctype.documentation_tool.documentation_tool.write_docs", method: "core.doctype.documentation_tool.documentation_tool.write_docs",
args: { args: {
data: JSON.stringify(wn.docs.to_write), data: JSON.stringify(wn.docs.to_write),


+ 2
- 2
core/doctype/profile/profile.js Dosyayı Görüntüle

@@ -68,7 +68,7 @@ wn.RoleEditor = Class.extend({
var me = this; var me = this;
this.wrapper = wrapper; this.wrapper = wrapper;
$(wrapper).html('<div class="help">Loading...</div>') $(wrapper).html('<div class="help">Loading...</div>')
wn.call({
return wn.call({
method:'core.doctype.profile.profile.get_all_roles', method:'core.doctype.profile.profile.get_all_roles',
callback: function(r) { callback: function(r) {
me.roles = r.message; me.roles = r.message;
@@ -174,7 +174,7 @@ wn.RoleEditor = Class.extend({
if(!this.perm_dialog) if(!this.perm_dialog)
this.make_perm_dialog() this.make_perm_dialog()
$(this.perm_dialog.body).empty(); $(this.perm_dialog.body).empty();
wn.call({
return wn.call({
method:'core.doctype.profile.profile.get_perm_info', method:'core.doctype.profile.profile.get_perm_info',
args: {role: role}, args: {role: role},
callback: function(r) { callback: function(r) {


+ 2
- 2
core/page/data_import_tool/data_import_tool.js Dosyayı Görüntüle

@@ -46,7 +46,7 @@ wn.pages['data-import-tool'].onload = function(wrapper) {
"Performing hardcore import process....", 100); "Performing hardcore import process....", 100);
// load doctypes // load doctypes
wn.call({
return wn.call({
method:'core.page.data_import_tool.data_import_tool.get_doctypes', method:'core.page.data_import_tool.data_import_tool.get_doctypes',
callback: function(r) { callback: function(r) {
$select.add_options(['Select...'].concat(r.message)); $select.add_options(['Select...'].concat(r.message));
@@ -71,7 +71,7 @@ wn.pages['data-import-tool'].onload = function(wrapper) {
$('#dit-download').empty(); $('#dit-download').empty();
// get options // get options
wn.call({
return wn.call({
method:'core.page.data_import_tool.data_import_tool.get_doctype_options', method:'core.page.data_import_tool.data_import_tool.get_doctype_options',
args: {doctype: val}, args: {doctype: val},
callback: function(r) { callback: function(r) {


+ 3
- 3
core/page/messages/messages.js Dosyayı Görüntüle

@@ -61,7 +61,7 @@ erpnext.Messages = Class.extend({
$('#post-message .btn').click(function() { $('#post-message .btn').click(function() {
var txt = $('#post-message textarea').val(); var txt = $('#post-message textarea').val();
if(txt) { if(txt) {
wn.call({
return wn.call({
module:'core', module:'core',
page:'messages', page:'messages',
method:'post', method:'post',
@@ -163,7 +163,7 @@ erpnext.Messages = Class.extend({
}, },
delete: function(ele) { delete: function(ele) {
$(ele).parent().css('opacity', 0.6); $(ele).parent().css('opacity', 0.6);
wn.call({
return wn.call({
method:'core.page.messages.messages.delete', method:'core.page.messages.messages.delete',
args: {name : $(ele).attr('data-name')}, args: {name : $(ele).attr('data-name')},
callback: function() { callback: function() {
@@ -173,7 +173,7 @@ erpnext.Messages = Class.extend({
}, },
show_active_users: function() { show_active_users: function() {
var me = this; var me = this;
wn.call({
return wn.call({
module:'core', module:'core',
page:'messages', page:'messages',
method:'get_active_users', method:'get_active_users',


+ 1
- 1
core/page/modules_setup/modules_setup.js Dosyayı Görüntüle

@@ -36,7 +36,7 @@ wn.modules_setup = {
ml.push($(this).attr('data-module')); ml.push($(this).attr('data-module'));
}); });
wn.call({
return wn.call({
method: 'core.page.modules_setup.modules_setup.update', method: 'core.page.modules_setup.modules_setup.update',
args: { args: {
ml: ml ml: ml


+ 8
- 8
core/page/permission_manager/permission_manager.js Dosyayı Görüntüle

@@ -84,7 +84,7 @@ wn.PermissionEngine = Class.extend({
var me = this; var me = this;
me.make_reset_button(); me.make_reset_button();
wn.call({
return wn.call({
module:"core", module:"core",
page:"permission_manager", page:"permission_manager",
method: "get_roles_and_doctypes", method: "get_roles_and_doctypes",
@@ -120,7 +120,7 @@ wn.PermissionEngine = Class.extend({
var me = this; var me = this;
me.reset_button = me.wrapper.appframe.add_button("Reset Permissions", function() { me.reset_button = me.wrapper.appframe.add_button("Reset Permissions", function() {
if(wn.confirm("Reset Permissions for " + me.get_doctype() + "?", function() { if(wn.confirm("Reset Permissions for " + me.get_doctype() + "?", function() {
wn.call({
return wn.call({
module:"core", module:"core",
page:"permission_manager", page:"permission_manager",
method:"reset", method:"reset",
@@ -151,7 +151,7 @@ wn.PermissionEngine = Class.extend({
return; return;
} }
// get permissions // get permissions
wn.call({
return wn.call({
module: "core", module: "core",
page: "permission_manager", page: "permission_manager",
method: "get_permissions", method: "get_permissions",
@@ -239,7 +239,7 @@ wn.PermissionEngine = Class.extend({
.attr("data-role", role) .attr("data-role", role)
.click(function() { .click(function() {
var role = $(this).attr("data-role"); var role = $(this).attr("data-role");
wn.call({
return wn.call({
module: "core", module: "core",
page: "permission_manager", page: "permission_manager",
method: "get_users_with_role", method: "get_users_with_role",
@@ -279,7 +279,7 @@ wn.PermissionEngine = Class.extend({
.attr("data-name", d.name) .attr("data-name", d.name)
.attr("data-doctype", d.parent) .attr("data-doctype", d.parent)
.click(function() { .click(function() {
wn.call({
return wn.call({
module: "core", module: "core",
page: "permission_manager", page: "permission_manager",
method: "remove", method: "remove",
@@ -307,7 +307,7 @@ wn.PermissionEngine = Class.extend({
ptype: chk.attr("data-ptype"), ptype: chk.attr("data-ptype"),
value: chk.prop("checked") ? 1 : 0 value: chk.prop("checked") ? 1 : 0
} }
wn.call({
return wn.call({
module: "core", module: "core",
page: "permission_manager", page: "permission_manager",
method: "update", method: "update",
@@ -355,7 +355,7 @@ wn.PermissionEngine = Class.extend({
if(!args) { if(!args) {
return; return;
} }
wn.call({
return wn.call({
module: "core", module: "core",
page: "permission_manager", page: "permission_manager",
method: "add", method: "add",
@@ -416,7 +416,7 @@ wn.PermissionEngine = Class.extend({
.click(function() { .click(function() {
var match_value = $(dialog.wrapper).find(":radio:checked").val(); var match_value = $(dialog.wrapper).find(":radio:checked").val();
var perm = me.get_perm($(this).attr('data-name')) var perm = me.get_perm($(this).attr('data-name'))
wn.call({
return wn.call({
module: "core", module: "core",
page: "permission_manager", page: "permission_manager",
method: "update_match", method: "update_match",


+ 3
- 3
core/page/todo/todo.js Dosyayı Görüntüle

@@ -18,7 +18,7 @@ wn.provide('erpnext.todo');


erpnext.todo.refresh = function() { erpnext.todo.refresh = function() {
wn.call({
return wn.call({
method: 'core.page.todo.todo.get', method: 'core.page.todo.todo.get',
callback: function(r,rt) { callback: function(r,rt) {
var todo_list = $('#todo-list div.todo-content'); var todo_list = $('#todo-list div.todo-content');
@@ -117,7 +117,7 @@ erpnext.todo.ToDoItem = Class.extend({
.data('name', todo.name) .data('name', todo.name)
.click(function() { .click(function() {
$(this).parent().css('opacity', 0.5); $(this).parent().css('opacity', 0.5);
wn.call({
return wn.call({
method:'core.page.todo.todo.delete', method:'core.page.todo.todo.delete',
args: {name: $(this).data('name')}, args: {name: $(this).data('name')},
callback: function() { callback: function() {
@@ -172,7 +172,7 @@ erpnext.todo.save = function(btn) {
} }
det.name = d.det.name || ''; det.name = d.det.name || '';
wn.call({
return wn.call({
method:'core.page.todo.todo.edit', method:'core.page.todo.todo.edit',
args: det, args: det,
btn: btn, btn: btn,


+ 1
- 1
core/page/update_manager/update_manager.js Dosyayı Görüntüle

@@ -50,7 +50,7 @@ wn.UpdateThisApp = Class.extend({
</div> \ </div> \
<div>' + wn._("Update is in progress. This may take some time.") + '</div>'); <div>' + wn._("Update is in progress. This may take some time.") + '</div>');
wn.call({
return wn.call({
module: "core", module: "core",
page: "update_manager", page: "update_manager",
method: "update_this_app", method: "update_this_app",


+ 4
- 4
core/page/user_properties/user_properties.js Dosyayı Görüntüle

@@ -33,7 +33,7 @@ wn.UserProperties = Class.extend({
}, },
make: function() { make: function() {
var me = this; var me = this;
wn.call({
return wn.call({
module:"core", module:"core",
page:"user_properties", page:"user_properties",
method: "get_users_and_links", method: "get_users_and_links",
@@ -101,7 +101,7 @@ wn.UserProperties = Class.extend({
return; return;
} }
// get permissions // get permissions
wn.call({
return wn.call({
module: "core", module: "core",
page: "user_properties", page: "user_properties",
method: "get_properties", method: "get_properties",
@@ -147,7 +147,7 @@ wn.UserProperties = Class.extend({
.attr("data-name", d.name) .attr("data-name", d.name)
.attr("data-user", d.parent) .attr("data-user", d.parent)
.click(function() { .click(function() {
wn.call({
return wn.call({
module: "core", module: "core",
page: "user_properties", page: "user_properties",
method: "remove", method: "remove",
@@ -212,7 +212,7 @@ wn.UserProperties = Class.extend({
if(!args) { if(!args) {
return; return;
} }
wn.call({
return wn.call({
module: "core", module: "core",
page: "user_properties", page: "user_properties",
method: "add", method: "add",


+ 3
- 23
public/js/legacy/clientscriptAPI.js Dosyayı Görüntüle

@@ -20,29 +20,9 @@
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //


// Client Side Scripting API
// ======================================================================================

$c_get_values = function(args, doc, dt, dn, user_callback) {
var call_back = function(r,rt) {
if(!r.message)return;
if(user_callback) user_callback(r.message);
var fl = args.fields.split(',');
for(var i in fl) {
locals[dt][dn][fl[i]] = r.message[fl[i]]; // set value
if(args.table_field)
refresh_field(fl[i], dn, args.table_field);
else
refresh_field(fl[i]);
}
}
$c('webnotes.widgets.form.utils.get_fields',args,call_back);
}

get_server_fields = function(method, arg, table_field, doc, dt, dn, allow_edit, call_back) { get_server_fields = function(method, arg, table_field, doc, dt, dn, allow_edit, call_back) {
wn.dom.freeze(); wn.dom.freeze();
$c('runserverobj',
return $c('runserverobj',
args={'method':method, args={'method':method,
'docs':wn.model.compress(make_doclist(doc.doctype, doc.name)), 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name)),
'arg':arg 'arg':arg
@@ -205,7 +185,7 @@ _f.Frm.prototype.toggle_display = function(fnames, show) {
} }


_f.Frm.prototype.call_server = function(method, args, callback) { _f.Frm.prototype.call_server = function(method, args, callback) {
$c_obj(cur_frm.get_doclist(), method, args, callback);
return $c_obj(cur_frm.get_doclist(), method, args, callback);
} }


_f.Frm.prototype.get_files = function() { _f.Frm.prototype.get_files = function() {
@@ -270,7 +250,7 @@ _f.Frm.prototype.call = function(opts) {
} }
} }
wn.call(opts);
return wn.call(opts);
} }


_f.Frm.prototype.get_field = function(field) { _f.Frm.prototype.get_field = function(field) {


+ 1
- 1
public/js/legacy/form.js Dosyayı Görüntüle

@@ -611,7 +611,7 @@ _f.Frm.prototype.runscript = function(scriptname, callingfield, onrefresh) {
if(callingfield) if(callingfield)
$(callingfield.input).set_working(); $(callingfield.input).set_working();


$c('runserverobj', {'docs':doclist, 'method':scriptname },
return $c('runserverobj', {'docs':doclist, 'method':scriptname },
function(r, rtxt) { function(r, rtxt) {
// run refresh // run refresh
if(onrefresh) if(onrefresh)


+ 3
- 3
public/js/legacy/handler.js Dosyayı Görüntüle

@@ -21,7 +21,7 @@
// //


function $c(command, args, callback, error, no_spinner, freeze_msg, btn) { function $c(command, args, callback, error, no_spinner, freeze_msg, btn) {
wn.request.call({
return wn.request.call({
args: $.extend(args, {cmd: command}), args: $.extend(args, {cmd: command}),
success: callback, success: callback,
error: error, error: error,
@@ -46,7 +46,7 @@ function $c_obj(doclist, method, arg, callback, no_spinner, freeze_msg, btn) {
else else
args.docs = wn.model.compress(doclist) args.docs = wn.model.compress(doclist)
wn.request.call({
return wn.request.call({
args: args, args: args,
success: callback, success: callback,
btn: btn, btn: btn,
@@ -58,7 +58,7 @@ function $c_obj(doclist, method, arg, callback, no_spinner, freeze_msg, btn) {
// For call a page metho // For call a page metho
function $c_page(module, page, method, arg, callback, no_spinner, freeze_msg, btn) { function $c_page(module, page, method, arg, callback, no_spinner, freeze_msg, btn) {
if(arg && typeof arg!='string') arg = JSON.stringify(arg); if(arg && typeof arg!='string') arg = JSON.stringify(arg);
wn.request.call({
return wn.request.call({
args: { args: {
cmd: module+'.page.'+page+'.'+page+'.'+method, cmd: module+'.page.'+page+'.'+page+'.'+method,
arg: arg, arg: arg,


+ 3
- 3
public/js/wn/app.js Dosyayı Görüntüle

@@ -23,7 +23,7 @@ wn.Application = Class.extend({
load_startup: function() { load_startup: function() {
var me = this; var me = this;
if(window.app) { if(window.app) {
wn.call({
return wn.call({
method: 'startup', method: 'startup',
callback: function(r, rt) { callback: function(r, rt) {
wn.provide('wn.boot'); wn.provide('wn.boot');
@@ -109,7 +109,7 @@ wn.Application = Class.extend({
refresh_notifications: function() { refresh_notifications: function() {
if(wn.session_alive) { if(wn.session_alive) {
wn.call({
return wn.call({
method: "webnotes.widgets.notification.get", method: "webnotes.widgets.notification.get",
callback: function(r) { callback: function(r) {
if(r.message) { if(r.message) {
@@ -175,7 +175,7 @@ wn.Application = Class.extend({
logout: function() { logout: function() {
var me = this; var me = this;
me.logged_out = true; me.logged_out = true;
wn.call({
return wn.call({
method:'logout', method:'logout',
callback: function(r) { callback: function(r) {
if(r.exc) { if(r.exc) {


+ 1
- 1
public/js/wn/defaults.js Dosyayı Görüntüle

@@ -24,7 +24,7 @@ wn.defaults = {
value = JSON.stringify(value); value = JSON.stringify(value);
wn.boot.profile.defaults[key] = value; wn.boot.profile.defaults[key] = value;
wn.call({
return wn.call({
method: "webnotes.client.set_default", method: "webnotes.client.set_default",
args: { args: {
key: key, key: key,


+ 1
- 1
public/js/wn/form/assign_to.js Dosyayı Görüntüle

@@ -118,7 +118,7 @@ wn.ui.form.AssignTo = Class.extend({
var assign_to = me.dialog.fields_dict.assign_to.get_value(); var assign_to = me.dialog.fields_dict.assign_to.get_value();
var args = me.dialog.get_values(); var args = me.dialog.get_values();
if(assign_to) { if(assign_to) {
wn.call({
return wn.call({
method:'webnotes.widgets.form.assign_to.add', method:'webnotes.widgets.form.assign_to.add',
args: $.extend(args, { args: $.extend(args, {
doctype: me.frm.doctype, doctype: me.frm.doctype,


+ 1
- 1
public/js/wn/form/attachments.js Dosyayı Görüntüle

@@ -100,7 +100,7 @@ wn.ui.form.Attachments = Class.extend({
wn.confirm(wn._("Are you sure you want to delete the attachment?"), wn.confirm(wn._("Are you sure you want to delete the attachment?"),
function() { function() {
var data = $(remove_btn).data("fileid"); var data = $(remove_btn).data("fileid");
wn.call({
return wn.call({
method: 'webnotes.widgets.form.utils.remove_attach', method: 'webnotes.widgets.form.utils.remove_attach',
args: { args: {
fid: data, fid: data,


+ 2
- 2
public/js/wn/form/comments.js Dosyayı Görüntüle

@@ -78,7 +78,7 @@ wn.ui.form.Comments = Class.extend({
comment_by: user comment_by: user
}; };
wn.call({
return wn.call({
method: "webnotes.widgets.form.utils.add_comment", method: "webnotes.widgets.form.utils.add_comment",
args: { args: {
doclist:[comment] doclist:[comment]
@@ -97,7 +97,7 @@ wn.ui.form.Comments = Class.extend({
}, },
delete_comment: function(name) { delete_comment: function(name) {
var me = this; var me = this;
wn.call({
return wn.call({
method: "webnotes.client.delete", method: "webnotes.client.delete",
args: { args: {
doctype: "Comment", doctype: "Comment",


+ 7
- 2
public/js/wn/form/control.js Dosyayı Görüntüle

@@ -619,7 +619,11 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
//this.bind_change_event(); //this.bind_change_event();
var me = this; var me = this;
this.$input.on("blur", function() { this.$input.on("blur", function() {
if(me.doctype && me.docname && !me.autocomplete_open) {
if(me.selected) {
me.selected = false;
return;
}
if(me.doctype && me.docname) {
var value = me.get_value(); var value = me.get_value();
if(value!==me.last_value) { if(value!==me.last_value) {
me.parse_validate_and_set_in_model(value); me.parse_validate_and_set_in_model(value);
@@ -671,7 +675,7 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({


me.set_custom_query(args); me.set_custom_query(args);


wn.call({
return wn.call({
type: "GET", type: "GET",
method:'webnotes.widgets.search.search_link', method:'webnotes.widgets.search.search_link',
args: args, args: args,
@@ -693,6 +697,7 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
select: function(event, ui) { select: function(event, ui) {
me.autocomplete_open = false; me.autocomplete_open = false;
if(me.frm && me.frm.doc) { if(me.frm && me.frm.doc) {
me.selected = true;
me.parse_validate_and_set_in_model(ui.item.value); me.parse_validate_and_set_in_model(ui.item.value);
} else { } else {
me.$input.val(ui.item.value); me.$input.val(ui.item.value);


+ 1
- 1
public/js/wn/form/infobar.js Dosyayı Görüntüle

@@ -110,7 +110,7 @@ wn.ui.form.InfoBar = Class.extend({
}, },
go_prev_next: function(prev) { go_prev_next: function(prev) {
var me = this; var me = this;
wn.call({
return wn.call({
method: "webnotes.widgets.form.utils.get_next", method: "webnotes.widgets.form.utils.get_next",
args: { args: {
doctype: me.frm.doctype, doctype: me.frm.doctype,


+ 1
- 1
public/js/wn/form/link_selector.js Dosyayı Görüntüle

@@ -67,7 +67,7 @@ wn.ui.form.LinkSelector = Class.extend({


this.target.set_custom_query(args); this.target.set_custom_query(args);
wn.call({
return wn.call({
method: "webnotes.widgets.search.search_widget", method: "webnotes.widgets.search.search_widget",
type: "GET", type: "GET",
args: args, args: args,


+ 9
- 5
public/js/wn/form/script_manager.js Dosyayı Görüntüle

@@ -6,13 +6,17 @@ wn.ui.form.ScriptManager = Class.extend({
this.frm.cscript = $.extend(this.frm.cscript, new ControllerClass({frm: this.frm})); this.frm.cscript = $.extend(this.frm.cscript, new ControllerClass({frm: this.frm}));
}, },
trigger: function(event_name, doctype, name) { trigger: function(event_name, doctype, name) {
var me = this;
doctype = doctype || this.frm.doctype; doctype = doctype || this.frm.doctype;
name = name || this.frm.docname; name = name || this.frm.docname;
if(this.frm.cscript[event_name])
this.frm.cscript[event_name](this.frm.doc, doctype, name);
if(this.frm.cscript["custom_" + event_name])
if(this.frm.cscript[event_name]) {
$.when(this.frm.cscript[event_name](this.frm.doc, doctype, name)).then(function() {
if(me.frm.cscript["custom_" + event_name])
me.frm.cscript["custom_" + event_name](me.frm.doc, doctype, name);
});
} else if(this.frm.cscript["custom_" + event_name]) {
this.frm.cscript["custom_" + event_name](this.frm.doc, doctype, name); this.frm.cscript["custom_" + event_name](this.frm.doc, doctype, name);
}
}, },
setup: function() { setup: function() {
var doctype = this.frm.meta; var doctype = this.frm.meta;
@@ -46,7 +50,7 @@ wn.ui.form.ScriptManager = Class.extend({
if(this.frm && this.frm.fetch_dict[df.fieldname]) if(this.frm && this.frm.fetch_dict[df.fieldname])
fetch = this.frm.fetch_dict[df.fieldname].columns.join(', '); fetch = this.frm.fetch_dict[df.fieldname].columns.join(', ');
wn.call({
return wn.call({
method:'webnotes.widgets.form.utils.validate_link', method:'webnotes.widgets.form.utils.validate_link',
type: "GET", type: "GET",
args: { args: {


+ 1
- 1
public/js/wn/misc/tools.js Dosyayı Görüntüle

@@ -111,7 +111,7 @@ wn.slickgrid_tools = {
$.each(grid.getColumns(), function(i, col) { $.each(grid.getColumns(), function(i, col) {
if(col.docfield && col.previousWidth != col.width && if(col.docfield && col.previousWidth != col.width &&
!in_list(wn.model.std_fields_list, col.docfield.fieldname) ) { !in_list(wn.model.std_fields_list, col.docfield.fieldname) ) {
wn.call({
return wn.call({
method:"webnotes.client.make_width_property_setter", method:"webnotes.client.make_width_property_setter",
args: { args: {
doclist: [{ doclist: [{


+ 2
- 2
public/js/wn/model/create_new.js Dosyayı Görüntüle

@@ -129,7 +129,7 @@ $.extend(wn.model, {
}, },
open_mapped_doc: function(opts) { open_mapped_doc: function(opts) {
wn.call({
return wn.call({
type: "GET", type: "GET",
method: opts.method, method: opts.method,
args: { args: {
@@ -151,7 +151,7 @@ $.extend(wn.model, {
} }
} }
var _map = function() { var _map = function() {
wn.call({
return wn.call({
type: "GET", type: "GET",
method: opts.method, method: opts.method,
args: { args: {


+ 1
- 1
public/js/wn/model/doclist.js Dosyayı Görüntüle

@@ -124,7 +124,7 @@ wn.model.DocList = Class.extend({
// btn: btn // btn: btn
// } // }
$(opts.btn).attr("disabled", true); $(opts.btn).attr("disabled", true);
wn.call({
return wn.call({
freeze: true, freeze: true,
method: opts.method, method: opts.method,
args: opts.args, args: opts.args,


+ 4
- 4
public/js/wn/model/model.js Dosyayı Görüntüle

@@ -67,7 +67,7 @@ $.extend(wn.model, {
var cached_doclist = JSON.parse(localStorage["_doctype:" + doctype]); var cached_doclist = JSON.parse(localStorage["_doctype:" + doctype]);
cached_timestamp = cached_doclist[0].modified; cached_timestamp = cached_doclist[0].modified;
} }
wn.call({
return wn.call({
method:'webnotes.widgets.form.load.getdoctype', method:'webnotes.widgets.form.load.getdoctype',
type: "GET", type: "GET",
args: { args: {
@@ -106,7 +106,7 @@ $.extend(wn.model, {
if(locals[doctype] && locals[doctype][name] && wn.model.get_docinfo(doctype, name)) { if(locals[doctype] && locals[doctype][name] && wn.model.get_docinfo(doctype, name)) {
callback(name); callback(name);
} else { } else {
wn.call({
return wn.call({
method: 'webnotes.widgets.form.load.getdoc', method: 'webnotes.widgets.form.load.getdoc',
type: "GET", type: "GET",
args: { args: {
@@ -410,7 +410,7 @@ $.extend(wn.model, {
delete_doc: function(doctype, docname, callback) { delete_doc: function(doctype, docname, callback) {
wn.confirm("Permanently delete "+ docname + "?", function() { wn.confirm("Permanently delete "+ docname + "?", function() {
wn.call({
return wn.call({
method: 'webnotes.model.delete_doc', method: 'webnotes.model.delete_doc',
args: { args: {
dt:doctype, dt:doctype,
@@ -441,7 +441,7 @@ $.extend(wn.model, {
var args = d.get_values(); var args = d.get_values();
if(!args) return; if(!args) return;
d.get_input("rename").set_working(); d.get_input("rename").set_working();
wn.call({
return wn.call({
method:"webnotes.model.rename_doc.rename_doc", method:"webnotes.model.rename_doc.rename_doc",
args: { args: {
doctype: doctype, doctype: doctype,


+ 2
- 2
public/js/wn/request.js Dosyayı Görüntüle

@@ -51,7 +51,7 @@ wn.call = function(opts) {
} }
} }


wn.request.call({
return wn.request.call({
type: opts.type || "POST", type: opts.type || "POST",
args: args, args: args,
success: opts.callback, success: opts.callback,
@@ -110,7 +110,7 @@ wn.request.call = function(opts) {
}) })
} }
$.ajax(ajax_args);
return $.ajax(ajax_args);
} }


// call execute serverside request // call execute serverside request


+ 1
- 1
public/js/wn/ui/listing.js Dosyayı Görüntüle

@@ -229,7 +229,7 @@ wn.ui.Listing = Class.extend({
if(!me.opts.no_loading) if(!me.opts.no_loading)
me.set_working(true); me.set_working(true);
wn.call({
return wn.call({
method: this.opts.method || 'webnotes.widgets.query_builder.runquery', method: this.opts.method || 'webnotes.widgets.query_builder.runquery',
type: "GET", type: "GET",
args: this.get_call_args(), args: this.get_call_args(),


+ 2
- 2
public/js/wn/ui/tags.js Dosyayı Görüntüle

@@ -17,14 +17,14 @@ wn.ui.TagEditor = Class.extend({
placeholderText: 'Add Tag', placeholderText: 'Add Tag',
onTagAdded: function(ev, tag) { onTagAdded: function(ev, tag) {
if(me.initialized) { if(me.initialized) {
wn.call({
return wn.call({
method: 'webnotes.widgets.tags.add_tag', method: 'webnotes.widgets.tags.add_tag',
args: me.get_args(tag.find('.tagit-label').text()) args: me.get_args(tag.find('.tagit-label').text())
}); });
} }
}, },
onTagRemoved: function(ev, tag) { onTagRemoved: function(ev, tag) {
wn.call({
return wn.call({
method: 'webnotes.widgets.tags.remove_tag', method: 'webnotes.widgets.tags.remove_tag',
args: me.get_args(tag.find('.tagit-label').text()) args: me.get_args(tag.find('.tagit-label').text())
}); });


+ 1
- 1
public/js/wn/ui/toolbar/toolbar.js Dosyayı Görüntüle

@@ -260,7 +260,7 @@ wn.ui.toolbar.clear_cache = function() {


wn.ui.toolbar.download_backup = function() { wn.ui.toolbar.download_backup = function() {
msgprint(wn._("Your download is being built, this may take a few moments...")); msgprint(wn._("Your download is being built, this may take a few moments..."));
$c('webnotes.utils.backups.get_backup',{},function(r,rt) {});
return $c('webnotes.utils.backups.get_backup',{},function(r,rt) {});
return false; return false;
} }




+ 1
- 1
public/js/wn/ui/tree.js Dosyayı Görüntüle

@@ -104,7 +104,7 @@ wn.ui.TreeNode = Class.extend({


$(me.$a).set_working(); $(me.$a).set_working();


wn.call({
return wn.call({
method: this.tree.method, method: this.tree.method,
args: args, args: args,
callback: function(r) { callback: function(r) {


+ 1
- 1
public/js/wn/upload.js Dosyayı Görüntüle

@@ -54,7 +54,7 @@ wn.upload = {
var _upload_file = function() { var _upload_file = function() {
var msgbox = msgprint(wn._("Uploading...")); var msgbox = msgprint(wn._("Uploading..."));
wn.call({
return wn.call({
"method": "uploadfile", "method": "uploadfile",
args: args, args: args,
callback: function(r) { callback: function(r) {


+ 2
- 2
public/js/wn/views/calendar.js Dosyayı Görüntüle

@@ -92,7 +92,7 @@ wn.views.Calendar = Class.extend({
selectable: true, selectable: true,
selectHelper: true, selectHelper: true,
events: function(start, end, callback) { events: function(start, end, callback) {
wn.call({
return wn.call({
method: me.get_events_method || "webnotes.widgets.calendar.get_events", method: me.get_events_method || "webnotes.widgets.calendar.get_events",
type: "GET", type: "GET",
args: me.get_args(start, end), args: me.get_args(start, end),
@@ -180,7 +180,7 @@ wn.views.Calendar = Class.extend({
update_event: function(event, revertFunc) { update_event: function(event, revertFunc) {
var me = this; var me = this;
wn.model.remove_from_locals(me.doctype, event.name); wn.model.remove_from_locals(me.doctype, event.name);
wn.call({
return wn.call({
method: me.update_event_method || "webnotes.widgets.calendar.update_event", method: me.update_event_method || "webnotes.widgets.calendar.update_event",
args: me.get_update_args(event), args: me.get_update_args(event),
callback: function(r) { callback: function(r) {


+ 2
- 2
public/js/wn/views/communication.js Dosyayı Görüntüle

@@ -254,7 +254,7 @@ wn.views.CommunicationComposer = Class.extend({
var print_html = ""; var print_html = "";
} }
wn.call({
return wn.call({
method:"core.doctype.communication.communication.make", method:"core.doctype.communication.communication.make",
args: { args: {
sender: [wn.user_info(user).fullname, wn.boot.profile.email], sender: [wn.user_info(user).fullname, wn.boot.profile.email],
@@ -331,7 +331,7 @@ wn.views.CommunicationComposer = Class.extend({
}) })
.autocomplete({ .autocomplete({
source: function(request, response) { source: function(request, response) {
wn.call({
return wn.call({
method:'webnotes.utils.email_lib.get_contact_list', method:'webnotes.utils.email_lib.get_contact_list',
args: { args: {
'select': "email_id", 'select': "email_id",


+ 1
- 1
public/js/wn/views/doclistview.js Dosyayı Görüntüle

@@ -267,7 +267,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
wn.confirm(wn._('This is permanent action and you cannot undo. Continue?'), wn.confirm(wn._('This is permanent action and you cannot undo. Continue?'),
function() { function() {
me.set_working(true); me.set_working(true);
wn.call({
return wn.call({
method: 'webnotes.widgets.reportview.delete_items', method: 'webnotes.widgets.reportview.delete_items',
args: { args: {
items: $.map(dl, function(d, i) { return d.name }), items: $.map(dl, function(d, i) { return d.name }),


+ 1
- 1
public/js/wn/views/ganttview.js Dosyayı Görüntüle

@@ -65,7 +65,7 @@ wn.views.Gantt = Class.extend({
.html('<div class="alert">Loading...</div>'); .html('<div class="alert">Loading...</div>');
var me = this; var me = this;
wn.call({
return wn.call({
method: this.get_events_method, method: this.get_events_method,
type: "GET", type: "GET",
args: { args: {


+ 1
- 1
public/js/wn/views/grid_report.js Dosyayı Görüntüle

@@ -8,7 +8,7 @@ $.extend(wn.report_dump, {
last_modified: {}, last_modified: {},
with_data: function(doctypes, callback, progress_bar) { with_data: function(doctypes, callback, progress_bar) {
var pre_loaded = keys(wn.report_dump.last_modified); var pre_loaded = keys(wn.report_dump.last_modified);
wn.call({
return wn.call({
method: "webnotes.widgets.report_dump.get_data", method: "webnotes.widgets.report_dump.get_data",
type: "GET", type: "GET",
args: { args: {


+ 1
- 1
public/js/wn/views/moduleview.js Dosyayı Görüntüle

@@ -194,7 +194,7 @@ wn.views.moduleview.ModuleView = Class.extend({
render_dynamic: function() { render_dynamic: function() {
// render reports // render reports
var me = this; var me = this;
wn.call({
return wn.call({
method: "webnotes.widgets.moduleview.get_data", method: "webnotes.widgets.moduleview.get_data",
args: { args: {
module: me.module, module: me.module,


+ 1
- 1
public/js/wn/views/pageview.js Dosyayı Görüntüle

@@ -23,7 +23,7 @@ wn.views.pageview = {
callback(); callback();
} else { } else {
// get fresh // get fresh
wn.call({
return wn.call({
method: 'webnotes.widgets.page.getpage', method: 'webnotes.widgets.page.getpage',
args: {'name':name }, args: {'name':name },
callback: function(r) { callback: function(r) {


+ 2
- 2
public/js/wn/views/query_report.js Dosyayı Görüntüle

@@ -86,7 +86,7 @@ wn.views.QueryReport = Class.extend({
me.appframe.set_title(wn._("Query Report")+": " + me.report_name); me.appframe.set_title(wn._("Query Report")+": " + me.report_name);
if(!wn.query_reports[me.report_name]) { if(!wn.query_reports[me.report_name]) {
wn.call({
return wn.call({
method:"webnotes.widgets.query_report.get_script", method:"webnotes.widgets.query_report.get_script",
args: { args: {
report_name: me.report_name report_name: me.report_name
@@ -142,7 +142,7 @@ wn.views.QueryReport = Class.extend({
$.each(this.filters || [], function(i, f) { $.each(this.filters || [], function(i, f) {
filters[f.df.fieldname] = f.get_parsed_value(); filters[f.df.fieldname] = f.get_parsed_value();
}) })
wn.call({
return wn.call({
method: "webnotes.widgets.query_report.run", method: "webnotes.widgets.query_report.run",
args: { args: {
"report_name": me.report_name, "report_name": me.report_name,


+ 2
- 2
public/js/wn/views/reportview.js Dosyayı Görüntüle

@@ -368,7 +368,7 @@ wn.views.ReportView = wn.ui.Listing.extend({
} }
// callback // callback
wn.call({
return wn.call({
method: 'webnotes.widgets.reportview.save_report', method: 'webnotes.widgets.reportview.save_report',
args: { args: {
name: name, name: name,
@@ -416,7 +416,7 @@ wn.views.ReportView = wn.ui.Listing.extend({
return; return;
if(wn.confirm(wn._("This is PERMANENT action and you cannot undo. Continue?"), if(wn.confirm(wn._("This is PERMANENT action and you cannot undo. Continue?"),
function() { function() {
wn.call({
return wn.call({
method: 'webnotes.widgets.reportview.delete_items', method: 'webnotes.widgets.reportview.delete_items',
args: { args: {
items: delete_list, items: delete_list,


+ 1
- 1
public/js/wn/views/sidebar_stats.js Dosyayı Görüntüle

@@ -17,7 +17,7 @@ wn.views.SidebarStats = Class.extend({
}, },
get_stats: function() { get_stats: function() {
var me = this var me = this
wn.call({
return wn.call({
type: "GET", type: "GET",
method: 'webnotes.widgets.reportview.get_stats', method: 'webnotes.widgets.reportview.get_stats',
args: { args: {


Yükleniyor…
İptal
Kaydet